Commit Graph
4 Commits
Author SHA1 Message Date
Accessibility ModandClaude Opus 5 9945703fb7 Menu narration + code-driven testbed
Pulls menu focus narration forward from Phase 4: it was a blocker, since the
screen name was spoken but not the selected option, so the game could not be
started at all.

Game-file footprint unchanged: still one line in main.lua.

- menus.lua: descriptor driver supporting both D3 backends (upvalue probe and
  patched-announce), sharing one render per screen. Probe self-test included.
- Descriptors for main_menu, settings_menu, load_game, new_game, narration.
- testbed.lua: drives the game by code via love.event.push, so input takes the
  same path as a human keypress. Coroutine-based, and navigates by READING focus
  rather than counting keypresses, which drifts when options are disabled.

Three bugs found by the testbed and fixed:

1. love.keypressed was still bound to the pre-wrapper states.keypressed.
   states.setup() captures love[callback] by value and runs before us, and
   main.lua does not define love.keypressed itself, so wrapping the states table
   field alone had no effect. Now reassigns love.keypressed/textinput.

2. Focus can move with no keypress: main_menu.mousemoved assigns selectedOption
   from cursor position, silently overriding selection including at startup.
   Focus is now polled in the update hook instead of announced only on keypress.

3. Probes sometimes need chaining. narration.keypressed only calls
   continueNarration(), so the text locals are upvalues of that inner function.

Verified: main menu -> new game -> name entry -> intro narration -> gameplay,
8/8 checks passing, including console.print capture and its (x2) fold.

Known gap: ingame_dialogue announces 'Game' and reads no dialogue text.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 20:53:29 +02:00
Accessibility ModandClaude Opus 5 fe872be683 Phase 1: console history, review keys, and wall tones
Game-file footprint unchanged: still one line in main.lua.

Console (Q4: speak everything queued, cancelled by explicit action):
- history.lua keeps our own unbounded history, since the game's console buffer
  expires entries after 3s. Mirrors the game's (xN) coalescing so what is heard
  matches what is on screen. The review cursor holds position while new lines
  arrive rather than being yanked to the tail mid-read.
- patches/console.lua wraps console.print, calling the real one first so a bug
  on our side cannot swallow a message the player would otherwise see.
- Any keypress reaching the game silences the pending speech backlog.

Hotkeys: [ and ] review, Shift+[/] jump to ends, \ repeat, Shift+\ copy.
Chosen from scancodes the game does not bind. Note keybindings.getCommand()
ignores modifiers, so Ctrl+Up would read to the game as a movement -- our keys
are consumed and never overlay a game-claimed scancode.

Wall tones (Q5: on step, 3D-positioned, radius 5):
- Direction and distance are deliberately decoupled. The listener sits at the
  camera 4 units above the plane under an inverse distance model, so placing a
  tone at the wall's real position would make distant walls quieter (the
  opposite of the request) and collapse the stereo pan. Instead the source sits
  at a fixed radius in the wall's direction at listener height, and volume is
  computed explicitly from distance.
- Step detection polls player coordinates rather than hooking movement, so it
  covers walking, pathing, portals and pushes for free.
- Respects FoV/rememberedFoV; never leaks unseen geometry.

tests/test_history.lua: 16 assertions, all passing, pure Lua.

Not yet verified in actual play -- needs a human at the keyboard.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 20:38:28 +02:00
Accessibility ModandClaude Opus 5 ff402e64c9 docs: update scratch.md with Phase 0 results
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 20:29:04 +02:00
Accessibility ModandClaude Opus 5 e57350ded3 Phase 0: accessibility mod bootstrap and TTS
Establishes the mod skeleton and gets speech working end to end.

Game-file footprint: one line in main.lua.

- accessibility/init.lua: sole entry point. Patch registry, hooks states.switch
  (announces screen changes) and states.update (per-frame speech flush, avoiding
  an edit to love.update). Startup self-test prints what resolved -- the canary
  for when a future game version moves something we hook.
- accessibility/speech.lua: TTS wrapper. pcall-guarded so a missing DLL degrades
  to silence instead of crashing. Queues utterances within a frame and joins them,
  since one game turn emits several console.print calls and speaking each with
  interrupt would leave only the last audible.
- accessibility/stateNames.lua: spoken names for the 28 states.
- accessibility/vendor/love2talk: vendored TTS library, see VENDORED.md.
  Loads Tolk.dll by absolute path via love.filesystem.getSource() and adds that
  directory via SetDllDirectory, so the DLLs live in the project instead of
  needing an elevated copy into Program Files.

Verified with lovec against NVDA: TTS available, speech channel yes,
'Main menu' spoken on startup.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 20:28:30 +02:00