fix: 15+ bug fixes — item dup, descend, slime AI, combat, camera, UI

CRITICAL:
- Fix use_item duplicating weapons/armor (not removed from inventory)
- Fix unwrap() panic in update_ragdoll_entity
- Fix descend proceeding without stairs when player entity missing

HIGH:
- Fix projectile hardcoded id==0 preventing enemy projectiles hitting player
- Fix previously equipped item lost on re-equip (returned to inventory)
- Fix i32::abs() overflow panic in background_color (use wrapping_abs)

MEDIUM:
- Fix slime AI ignoring vertical direction to player
- Fix combat damage applied to dead player
- Fix camera movement keys non-functional (added cam_offset_x/y)
- Fix Unicode emoji status icons (replaced with ASCII F/P/I/B)
- Fix Unicode UI chars (█░·─│┌┐└┘◆■ → ASCII #-./|++++*#)
- Add missing char_bitmap glyphs (+, =, >, <, *, %, #, |, @, _)

LOW:
- Fix draw_messages writing to negative y coordinates
- Fix WindowInput losing key state on focus loss (clear_keys on Focused(false))
- Fix compute_lighting using full grid scan instead of gather_sources_in_range

All 171 tests + 14 scenarios pass.
This commit is contained in:
Emil
2026-06-21 16:24:51 +03:00
parent 357db17c2f
commit 0b20f3ef9b
9 changed files with 107 additions and 53 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ fn background_color(wx: i32, wy: i32, vy: i32, view_h: i32) -> [u8; 4] {
let base_g = (10.0 + t * 25.0) as u8;
let base_b = (25.0 + t * 35.0) as u8;
let hash = ((wx.wrapping_mul(73856093)) ^ (wy.wrapping_mul(19349663))).abs();
let hash = ((wx.wrapping_mul(73856093)) ^ (wy.wrapping_mul(19349663))).wrapping_abs();
if hash % 80 == 0 {
let brightness = (60 + (hash % 120) as u8).min(255);
return [brightness, brightness, brightness + 20, 255];