# List of bugs to investigate

[x] Main menu stat names not displaying (fixed in a7bc6c9: chargen attribute labels were empty backing buffers)
[x] Can't enter lower case text (fixed properly in 650cba5, superseding the gate-on-g_text_input_active fix from bugfix/lowercase-text-universal: that fix suppressed handle_keyboard_message's WM_CHAR uppercase fold during text entry, but the fold itself -- and the DAT_0024af60 "command-input mode"/Caps-Lock flag driving it -- turned out to be a workaround for a narrower problem: W/S/X/A/D/Z/C were only registered under their UPPERCASE VK codes (register_key_binding, game.c), so lowercase keypresses needed folding to match. Root-cause fix: register all seven under BOTH cases (confirmed live that a held SHIFT+<lowercase letter> combo delivers the RAW lowercase WM_CHAR code, e.g. 0x77 for 'w', not an auto-uppercased one -- this is a real path, not just defensive), remove the fold entirely, and let DAT_0024af60 default to its real, correct value -- Caps Lock off -- since nothing needs it on any more. ('J'/'j' are deliberately two separate, differently-bound actions and were left untouched.) The unrelated held-key acceleration-ramp usage of DAT_0024af60 in the main loop was decoupled so its behavior is unchanged (that flag was always 1 throughout the loop in practice, so dropping the now-dead check is a no-op there). Verified live: plain WASD already went through gx_stub.c's own case-independent free-look poller (unaffected either way); SHIFT+w was confirmed via a temporary trace to correctly invoke move_key_directional_step(2), same as SHIFT+W. New coverage: demos/demo_shift_wasd_case_test.txt (live SHIFT+<lowercase letter> sweep); tests/test_keyboard.c updated to assert plain pass-through instead of fold-then-suppress.)
[x] Monsters giving too much XP (investigated, no decompilation bug: formula verified byte-for-byte against the real shipped ARM binary (disassembled UU.exe); displayed XP curve is ~3-675 vs a level-16 cap of 9600, an unremarkable RPG curve. This appears to be the original game's actual balance, not a port bug. Independently re-confirmed 2026-10-05 after the many bug-fixes-pass-4/code-cleanup-pass-2 commits that landed since: award_monster_kill_experience (src/combat.c) is byte-identical to the version originally verified -- confirmed via `git log -p` across the full range since this checkoff. Re-disassembled FUN_00027f14 myself from the real ARM UU.exe with Capstone and matched it instruction-for-instruction against the current decompiled source: class mask (&0x1c0==0x40), the &DAT_001007d0+idx*0x30 monster-record indexing (literal pool value 0x1007d0, confirmed by reading the raw word), the +0x28/+0x29 XP-stat field, roll_dice_sum(2,sVar1) argument order, the base*4 term, the ce_rand()%24 spread gated on the 0x400/bit-10 flag (algebraically identical to the source's `param_1[7] & 4`, just phrased on a different byte grouping), the round-toward-zero `+0xf` before `>>4`, and the final call into grant_experience_points -- all exact. Also verified every call-chain callee (set_hud_status_value@0x6cff4, set_pending_music_track@0x735b0, roll_dice_sum@0x6a058, grant_experience_points@0x69bd0) resolves to the same address the source's "was FUN_xxx" comments already claim. Checked the one real risk: the Sizing-audit pass (e50e407/7d8825b) that shrank/re-aliased several fields of the same per-class monster-record table (DAT_001007d0: 6144->3072 bytes, plus DAT_001007dd/e0/e3/fd aliased in) -- confirmed via ai.h that the XP field itself (DAT_001007f8 = DAT_001007d0_backing[0x28], already labeled "per-class XP, 16 bits") and the 0x30 stride were untouched; only sibling fields at different offsets moved. grant_experience_points (src/player.c) and roll_dice_sum (src/math.c) also unchanged in that window (the one player.c-touching commit, d4ba628, edited unrelated lines). Conclusion holds.)
[x] Carry weight too low on start (fixed properly in d4ba628, merged from bug-fixes-pass-2 at 45d4093: recompute_level7_hazard_from_character_level renamed to recalculate_player_stats, and g_player_carry_weight/g_player_max_carry_weight are now #define aliases directly into the player status struct (DAT_0023bca8_backing+0x4a/+0x4c) instead of separate flat globals needing manual sync -- the real root-cause fix, superseding the earlier reverted c8e1166 sync-based patch. Also fixed a dropped-argument bug in compute_object_weight and populated real recovered armor-protection table data. Broader character-stats-pipeline investigation now complete: traced
    every recalculate_player_stats call site (chargen's initial roll,
    chargen's class/race bonus reroll, level-up, and skill training's
    own stat bump) -- all 5 real call sites are present, none missing.
    Checked both save/load paths (write_player_status_block/
    read_player_status_block's 0xd2-byte block, and
    write_player_save_record/restore_player_save_record's 220-byte
    DAT_0023bca8 memmove) against every other derived stat (max HP,
    current/max mana, Strength/Dexterity/Intelligence): all of them
    already read/write the struct directly with no separate flat-
    global duplicate, so the carry-weight pair was a real but isolated
    instance of the split-symbol pattern, not a wider epidemic --
    confirmed by grepping for every `g_player_*` flat global in src/
    and finding none left after this fix. Live-verified via
    UW_DEBUG_WEIGHT=1 against a freshly chargen'd character:
    max_capacity=400, scaling correctly with rolled Strength instead
    of the old hardcoded 200.)
[x] "Use key / combine" cursor not drawing over 3d view - timing? (investigated; this turned out to be two overlapping issues, both already resolved. (1) An older, already-fixed root cause: draw_idle_mouse_cursor's confine-rect check (src/hud.c) used to get corrupted by init_cursor_subsystem's `(&DAT_002047b0)[iVar2]=10000` loop writing 20 shorts through a lone-scalar global -- but DAT_002047b0 was already widened to a real 20-element array in the code-cleanup-pass-2 merge (commit e0e419e), well before this pass, so that corruption no longer happens; confirmed live by holding/hovering the cursor at screen x=131, past the old corrupted bound's x2=109, with no confine-rect early-return. (2) The real remaining cause of the "timing" symptom -- the forced per-tick 3D redraw (main_loop_hud_flush) painting over the cursor whenever the mouse sat still for a tick -- is the SAME mechanism as bug-list item "Cursors not drawing always" and is fixed by that item's commit 05e8727 (main_loop_hud_flush now calls update_mouse_state() unconditionally every tick). No separate fix needed/made here; re-verified live after rebasing onto that commit.)
[x] Automap cursor not invalidating, leaves a trail behind (fixed in ebacc53: set_cursor_sprite_id discarded resolve_sprite_id_to_frame's result, using the raw unresolved id for the g_grtile_registry lookup, so the cursor's tracked erase-rect size fell back to 0x0 for every 0x1000+ (BUTTONS.GR) icon)
[x] Automap should lightly draw a wall when not discovered (fixed in 0d1d7f5/b676768, merged from bug-fixes-pass-1)
[x] Automap notes not persisting (fixed in 7d8825b, earlier this session; a more thorough fix for the same underlying issue -- note X/Y screen position lost on save/reload, archive resizing, and deletion-compaction bugs -- merged in from bug-fixes-pass-2 in a24a154/9d7f406, commit c73b391)
[x] Crash when using a mantra (fixed in c9d58c8: handle_mantra_chant's typed-word/mantra-name locals were `undefined4`, truncating _strupr's and get_message_string's real 64-bit pointer returns -- ce_strcmp then dereferenced the truncated pointer and crashed, unconditionally, on literally every invocation)
[x] Crash when using a ranged weapon (fixed: fire_ranged_weapon called free_object_slot() with no argument instead of free_object_slot(puVar7), the consumed ammo object's slot -- every other call site in the codebase passes the object pointer; this one read whatever was left in the argument register instead, corrupting the free-object-slot list on every shot. Also right-sized find_and_consume_ammo's unrelated oversized dead scratch buffer (544528 -> 64 bytes), the same already-fixed Ghidra stack-size artifact, left unfixed on this hot path.)
[x] Attack charge not consistent (fixed properly in 93ee600, merged from bug-fixes-pass-2 at 9e7d533: several weapon-animation state globals -- DAT_000870d8/dc (sprite-category loaded/requested), DAT_000870e4 (idle frame counter), DAT_000870e0 (pending action), DAT_000870e8 (ready-pose frame offset) -- were zero-initialized instead of matching the real ARM .data defaults (-1 sentinels for "not loaded", 6 for idle pose, 1 for ready-pose offset). A zero pending-action value was being misread as a real swing action instead of idle, causing inconsistent/spurious charge-timing behavior. This supersedes the earlier reverted narrow fix (e6110d4, reverted as "way off course from the original code") with the actual root cause: restoring the correct original binary defaults, not reworking the state machine.)
[x] Pitch off - spell casting offset is off now. Revert earlier fix, reverse pitch look direction visually? (fixed in 2b6c192: compute_drop_aim_from_cursor in src/item_use.c -- the player-aim path shared by thrown items and apply_targeted_spell_effect's player-cast targeted spells -- divided view-pitch global DAT_0023beb4 directly into the launch-angle field DAT_00202a3c, un-inverted. DAT_00202a3c is "positive = aim up" (confirmed via compute_vertical_aim_offset in src/ai.c) but DAT_0023beb4 is "negative = up" (confirmed independently via src/player.c's screenshot-verified camera projection and src/game.c's recovered original key-1/2/3 handler, debug_adjust_view_heading) -- opposite sign conventions mixed into the same field. Was latent/harmless before view-pitch controls existed. NOT the suspected earlier fix (src/combat.c's resolve_melee_swing_hit, commit 38ef8d6): that one already inverts the same global correctly for melee swing height and was left alone.)
[x] Door placement / collision (investigated, no reproducible bug: movement collision confirmed working live, visual placement already fixed earlier; found but did NOT fix an unrelated issue -- automap visibility flood sees through closed doors, see src/visibility.c / code-analysis.md "Surprises and open questions", needs real disasm to fix safely.
    RE-VERIFIED 2026-10-05 against current HEAD, after the many
    automap.c/movement.c/collision-adjacent fixes merged since the
    original investigation: live repro walked the player into the
    closed door object at level-1 tile (24,7) [SETPLAYERPOS 24.5 6.3
    640 0 0, held forward] -- position advanced tile-y 6.30 -> 6.87
    then held rock-solid for 45+ real seconds of continued forward
    input. Movement collision still blocks correctly; finding stands.
    Also resolved the automap-sees-through-closed-doors sub-issue
    flagged above as needing real disassembly access: used Ghidra
    headless decompilation of the real ARM binary (FUN_0005cacc/
    FUN_0005c70c advance_visibility_ray/extend_visibility_ray_row,
    FUN_0005e604 process_visible_tile_cell, automap_reveal_byte) and
    confirmed byte-for-byte that the real flood and reveal-byte
    computation never reference door objects or door state at all --
    it's a pure static-tile-shape lookup, identical to this port's own
    logic. So that's not a porting bug either; it's the original 1992
    engine's own design (no "door" tile type distinct from open floor
    -- doors are objects overlaid on it), out of scope to invent new
    logic for. See code-analysis.md, "Surprises and open questions".)
[x] Spell crashes - test each (fixed in 1125790: added a CASTALLSPELLS test hook that drives all 48 readied-spell table entries directly; found and fixed 3 real crashes under ASan/lldb -- pointer truncation in cast_summon_or_spawn_effect and in cast_cone_damage_spell/cast_targeted_search_effect, a dropped-args tilemap_lookup() call, and a NULL-callback crash from the never-populated DAT_00087604/PTR_FUN_00087614 spell-effect tables, now guarded. All 48 spells dispatch cleanly; see demos/bug_spell_crash.txt)
[x] Critters dropping shrines during combat / death (fixed in 73a6613: spawn_creature_death_loot() was called with its argument dropped at all 4 babl.c call sites that lazily generate a creature's death loot during conversation/barter/search, leaving param_1 garbage -- the resulting wild object_list_insert_head(garbage+6, ...) write is a plausible mechanism for an unrelated fixture object like a shrine getting spliced into a dead critter's drop/inventory chain. Not independently reproduced live: no existing demo script kills a monster and then re-interacts with its corpse, so this exact path wasn't exercised before or after the fix -- see UW_DEBUG_LOOT trace added in 93e6869 if it needs re-investigating.)
[x] Cursors not drawing always (fixed in 05e8727: main_loop_hud_flush's forced per-tick 3D redraw painted over the cursor sprite whenever the mouse was motionless, since update_mouse_state only repaints it reactively on a real WM_MOUSEMOVE; now called unconditionally every tick)
[x] Clicking in the inventory area stamps a yellow box there (fixed: erase_cursor_icon in src/hud.c unconditionally painted a "restore" rect in draw color 0x15 whenever DAT_00204844 was nonzero, but handle_mouse_message's WM_LBUTTONDOWN handler (src/input.c) also sets DAT_00204844 directly as a general click-pending flag -- to 2 whenever g_cursor_mode/g_cursor_holding_state is nonzero -- with no matching save_cursor_background() call, so DAT_00204848 (the real "a background is saved, safe to restore" sentinel rect_fill_or_save_restore checks) stayed 0; rect_fill_or_save_restore then silently fell through to an ordinary flat fill using 0x15 as a literal palette index (renders bright yellow) instead of restoring anything, stamping a permanent box at the mouse position. Now only paints/flushes when DAT_00204848 is actually armed. Confirmed live via a temporary unconditional rect_fill_or_save_restore trace: a plain click inside the open inventory panel reproduced color=21 flat fills at DAT_00204848=0.)
[x] Automap text entry has regressed - typing shows only bits of text, hitting enter moves the cursor somewhere way off to the right (real cause: NOT 8f8536a/ebacc53/05e8727 -- erase_cursor_icon (src/hud.c) unconditionally flat-filled with color 0x15 whenever DAT_00204844 was set but no real save_cursor_background() save was pending (DAT_00204848==0), stamping that stray palette color over the note text's own pixels every time the pencil-cursor caret warped along while typing, and over the final post-Enter position too -- same mechanism as the "inventory-click yellow box" bug, already fixed by commit 992313f gating the restore/flat-fill on DAT_00204848. Confirmed live via before/after screenshots (garbled "T e ' | /" fragments pre-fix, clean "TEST" post-fix) and added regression tests: test_erase_cursor_icon_does_not_flat_fill_without_a_real_save (fails on pre-992313f hud.c, confirmed) and test_typing_a_multichar_note_then_enter_lands_cursor_just_past_the_text, both in tests/test_automap.c)
[x] Entering a real mantra like "summ ra" crashes the game (distinct from the already-fixed universal mantra crash in c9d58c8 -- found two real, independent, DATA-DEPENDENT bugs further down handle_mantra_chant's success path, past where c9d58c8's fix stopped, which is why the existing demos/demo_mantra_test.txt could pass clean on some runs: (1) player.c's roll_skill_use_improvement reassigned `iVar7` (declared plain `int`) to `iVar1 + DAT_00086df8`, a real 64-bit `char *`, truncating it to 32 bits before dereferencing -- the same pointer-truncation bug class as c9d58c8, just one call deeper, only taken when the rolled skill's training progress is still below its class-tier base; (2) hud.c's msg_scroll_wrap_split_line checked its lower-bound against `param_1` one iteration too late for a 1- or 2-character span, reading/writing 1-2 bytes before the string -- an AddressSanitizer stack-buffer-underflow reached from handle_mantra_chant's very first message_scroll_print_wrapped("\n") call whenever the scroll cursor is already near the panel's right edge. Confirmed live via ASan on both; fixed (1) with a correctly-typed `char *` local and (2) by moving the bounds check before the pointer decrement/read/write. demos/demo_mantra_test.txt extended to repeat SUMM RA/MU AHM/OM CAH several times to raise the odds of re-hitting either data-dependent branch on regression.)
[x] Player head bob when walking and swimming is missing (fixed: apply_movement_tick's forward-walk/sidestep bob and trigger_view_transition's jump/landing wobble all index a 16-entry byte curve table with the walk-phase counter DAT_0023bf18>>4 to compute the per-tick vertical view-bob offset DAT_0023be98 -- but all three tables (DAT_00086e38/DAT_00086e48/DAT_00086e58 in src/movement.c and src/player.c) were still all-zero placeholders (a prior sizing-only pass had already corrected them from 256 to the real 16 bytes but never recovered their contents), so every bob lookup returned 0 even though the trigger condition itself (g_jump_ascent_timer ramped past a threshold while g_movement_mode == 1 -- also the swim-forward code path, which shares this exact condition, only scaled by locomotion-dependent speed constants) already fired correctly. Recovered the real byte-for-byte table contents from UU.exe via a headless Ghidra decompile + memory dump (DAT_00086e68, the scalar immediately after these three tables, was already independently recovered elsewhere as the literal 15 found at this same address, confirming the alignment). Verified live via UW_DEBUG_EYEHEIGHT: walking forward now produces a repeating be98=2,6,8,6,2,-6,0,0 cycle added to view_elevation every tick, where it was a flat 0 before.)
[x] Many scroll message strings render incorrectly. Some are missing newlines, some are missing spaces, some have underscores instead of spaces. Notes for the agent: do an audit of constant strings in dat-vars.json against the data and text bytes in Ghidra. (fixed: audited every dat-vars.json string-backed entry that reaches message_scroll_print_wrapped/print_scroll_message_by_id or a sibling sentence-fragment concatenated into scroll text, plus a handful of draw_text_string/debug_print/NKDbgPrintfW strings mangled the identical way, against the real ARM UU.exe .data bytes (the Pocket PC binary at /Users/ccuddigan/Projects/UW1/decomp -- UW.EXE in the same Ghidra project is the original 16-bit DOS binary and wasn't used), read via a Ghidra headless script. Ghidra had rendered embedded spaces as underscores in ~25 literals, and in several also dropped a leading/trailing space or a trailing '\n', or truncated the string partway through (e.g. s_Your_bumbling_attempts_have_set_o_00087384 silently dropped "ff the " off the end). Fixed each one byte-for-byte against the confirmed real content, no blind underscore-to-space substitution -- verified first that the babl.c script-command identifiers (s_npc_attitude, s_take_from_npc, etc.) and s_armor_f_00085c60 are genuinely underscored tokens, not mis-renderings, and left those alone. Also recovered three previously-undiscovered real strings while cross-checking neighboring addresses: DAT_00085c88 ("The ", containers.c/interact.c/item_use.c's shared item-name sentence prefix, previously an uninitialized scratch buffer marked "content unrecovered"), DAT_00084f20 (".\n", ai.c's sentence terminator after an item/trap name, previously zero-initialized), and item_use.c's DAT_00085ce0 ("...\n") and DAT_000878ec ("Use "), both likewise previously marked "content unrecovered" by an earlier sizing-only pass. Full list of fixed strings (old -> new, file) is in the bugfix/scroll-message-string-audit commit message. Verified with ctest (20/20) and the full 23-script regression suite (23/23 clean).)
[x] Door collision box seems too large and misplaced (investigated with real Ghidra + real game-data evidence; no collision-math bug found, so no behavior change -- see below for what WAS fixed/confirmed). The suspected culprits were (1) collision_add_candidate_object's `local_40[1]&7 == 4` special case (collision.c:671) using a fixed FULL-TILE box for doors instead of a radius-centered one, and (2) the per-object-class "radius" field itself (uw_object_type_props_t's old _unk01_02, src/headers/uw.h) being unconfirmed. Both ruled out with direct evidence: a fresh Ghidra headless decompile of the real ARM UU.exe collision_add_candidate_object (was FUN_00051658, 0x51658-0x51743) matches src/collision.c line-for-line, including the shape==4 branch and the sub-tile position decode (which independently matches uw_object_hdr_t's own confirmed xpos/ypos bitfields exactly) -- so this is not a decompilation bug. Reading the REAL data/DATA/COMOBJ.DAT bytes for every one of the 8 door type ids (0x140-0x147, confirmed "7 door skins/types + secret" by src/tmap.c's emit_anim_object_frames comment) shows every door has that radius field == 3, never 4, so doors never hit the full-tile branch; they get an ordinary symmetric radius-3 (6-unit-wide) box. Live-confirmed too: running the existing regression suite with a temporary UW_DEBUG_DOOR_BOX trace (demos/demo_objects.txt/demo_object_test.txt both touch a real door, item 0x140) printed exactly `radius=3 ... box_x=[10,16]` -- a 6-unit box tracking the tile offset by 8 units per tile, never the full 8-unit-from-corner shape produced by the shape==4 branch. Named the now-confirmed field `collision_radius`/`unit_weight` in uw_object_type_props_t (src/headers/uw.h) -- the latter from src/objects.c's own calculate_object_weight comment -- and added test_real_door_types_use_collision_radius_three_not_shape_four (tests/test_movement.c) asserting the real loaded COMOBJ.DAT byte for all 8 door types, plus documented the investigation directly in collision.c's own comment. The real (likely visual, not collision) explanation for "too large and misplaced" is almost certainly src/tmap.c's own still-open, previously-attempted-and-reverted note a few lines into its door-rendering branch: "door frame looks to be offset 16 units into the wall... to the right or left, depending on direction" -- a rendering-anchor bug, left alone here since a prior attempt at it caused a different door to disappear and there's no new ARM/data evidence found this session to fix it safely.
[ ] No music playback. Investigated 2026-10-05 (bug-fixes-pass-4): confirmed the format question first -- the real game data does ship data/SOUND/UW01.MOD..UW15.MOD (genuine Amiga/ProTracker .MOD files, not XMI/MIDI), loaded by audio.c's fully-decompiled custom player (construct_and_load_mod_player/start_mod_player_playback/queue_mod_audio_buffer), so the Shockolate MusicDevice.c (xmi/midi) suggestion doesn't apply, and waveOutOpen/waveOutWrite being no-op stubs (src/ordinal_stubs.c) looked like the obvious next gap. It is NOT the actual blocker, though -- live instrumentation (added DEBUG(TRACE) calls in play_music_track/set_music_enabled, still present in src/audio.c) found the real chain, in order:
  1. DAT_00087454/DAT_00087448 (src/audio.c): the "audio subsystem initialized"/"music enabled" gate flags are permanently 0 -- no writer exists anywhere in this decompile (grepped exhaustively) -- so play_music_track, resume_music_playback and set_music_enabled take their very first early-out branch on literally every call, every run. This is the actual root cause, confirmed live; waveOut is never even reached.
  2. cpp_operator_new (src/ordinal_stubs.c) is ALSO a hardcoded NULL-returning stub -- the second half of the same gap. Together, these two bugs mean construct_and_load_mod_player has apparently never executed even once since this was decompiled.
  3. Fixing both (tried live) immediately exposes a THIRD, previously-invisible bug: construct_and_load_mod_player SIGSEGVs on its first real run. Root cause: every MOD-engine "dynamic array" struct (pattern/instrument/channel-state/etc., ~20 functions across ~1400 lines of audio.c) stores its allocation in a 4-byte (undefined4) field and reads it back later as a real address -- faithful to the original 32-bit ARM binary's pointer width, but on this native 64-bit recompile no allocation can land below 4GB (confirmed empirically, not just in theory: calloc() and even mmap(MAP_FIXED) at every low address tried from 0x1000000 to 0xff000000 are refused by the kernel on arm64 macOS), so the stored pointer silently truncates and the next read-back dereferences a wrong, almost always unmapped address.
Fixing #3 for real needs either an offset-shifting struct refactor across the whole MOD engine or a guaranteed-low-address allocator (confirmed infeasible on this platform) -- bigger than one pass. Shipping fixes for #1/#2 alone would trade silence for a guaranteed crash the moment anyone enables music (every game startup calls play_music_track(1,1) for the splash-screen tune), so those were reverted back to original (silent, stable) behavior rather than shipped half-done; see src/audio.c's DAT_00087454 comment and src/ordinal_stubs.c's cpp_operator_new comment for the full writeup. waveOutOpen/waveOutWrite were NOT touched since reaching them is still blocked upstream -- implementing a real SDL2 backend behind them would be unverifiable scaffolding until #1-#3 are resolved. Next step for whoever picks this up: resolve #3 first (it's the load-bearing blocker), then #1/#2 are a one-line-each flip, then waveOut* becomes the easy, well-scoped remainder.
[ ] Automap note entry drops keystrokes while typing. User-reported hypothesis was "font4x5p.sys has no lowercase glyphs" -- investigated and ruled out: font4x5p.sys (data/DATA/FONT4X5P.SYS, 497 bytes, 12-byte header + 97 5-byte glyph records covering ASCII 0-0x60) genuinely has no glyphs past 0x60 (no lowercase), BUT handle_automap_note_click (src/automap.c) already force-applies ce_toupper() to every typed character before storing it, and has done so since the original decompile (not something touched by any fix today) -- so case/font-coverage was never actually reaching the renderer as lowercase. Confirmed live via UW_DEBUG_AUTOMAP_NOTE=1 tracing: typing "lowercase" into a note stores as "loease" -- characters w, r, c were silently dropped (not case-mangled), reproduced with the demo harness's already-realistic one-character-per-tick TYPE pacing (not a rapid-fire test artifact). The real bug is a keystroke-dropping issue in the note-entry key-polling loop/event-dispatch re-entry (handle_automap_note_click is a click-region handler; need to trace how/when it gets re-invoked per keystroke and where events are getting lost between polls), unrelated to font glyph coverage or case folding. Needs real investigation, not a font/case fix.
[x] Conversations don't end when they should, and barter menus can't be left (fixed: babl_menu returned the chosen entry's string id (DAT_001007a0[position]) instead of its 1-based position -- the original ARM babl_menu (0x2912c, tail at 0x29348) returns DAT_00100788 directly; the id form was copied from babl_fmenu, whose ARM tail really does index DAT_001007a0. Scripts compare the result to 1, 2, ..., so no branch matched: Ketchaval's "consent of my bride" refusal fell through into the normal greeting instead of ending, and every barter loop's "I do not wish to barter any further" (4) never matched, so the barter menu repeated forever. Covered by tests/test_babl_conversation.c, which runs the real CNV.ARK scripts. Also: exit_talk_mode only calls end_barter_ui when DAT_001006d0 is non-zero, but nothing in the C or ARM ever sets it, so leftover barter-slot items were never returned; as a hack init_barter_ui now sets the flag and exit_talk_mode clears it.)
[x] Player name not shown in conversation options, e.g. "I am @GS8." with Ketchaval (fixed: ce_atoi in src/ordinal_stubs.c was a stub that always returned 0, so babl_expand_string_refs parsed every "@GS8"-style reference as variable 0 instead of variable 8 (play_name) and expanded it to an empty string. Now a real atoi; this also fixes babl's `val` builtin and the numeric text prompt in item_use.c. Covered by test_the_player_can_tell_ketchaval_their_name in tests/test_babl_conversation.c.)
