Pre-Flight — WP-130 — 2026-11-30
Filled-in copy of docs/reference/pre-flight for WP-130. Verdict at the bottom.
Drafted and executed by one session, after Jeff approved the packet’s decisions and said “Execute WP-130” (2026-11-30). Checked at claim time: no
wp-130branch in either repository, and no PR naming WP-130 but the drafting PR #324 (merged). The claim branches were pushed before anything else.
Header
- WP:
WP-130 - Title: Debug tools — state setters and the hit overlay (Gen 1)
- Pre-flight date:
2026-11-30 - Targets generation(s): 1
- Targets disc(s): Phantom for the run; the code covers both titles.
Dependency check
| Prereq | Status in WORK_INDEX |
Notes |
|---|---|---|
| WP-116 | ✅ Done | handleEvent(), the event path the script verbs feed. |
| WP-026 | ✅ Done | The profile’s [Game] section and its setters. |
| WP-031 | ✅ Done | giveClue() (clues.cpp). |
Rule check: every prereq is ✅ Done.
Repo + disc state
- Docs repo: branch
claude/wp-130-debug-toolscut fromorigin/main @ 4d37add, pushed at once. - Fork worktree, the claim:
tools/New-ForkWorktree.ps1 -Branch wp-130-debug-tools, forked fromorigin/scooby-engine @ 34d2c0dc80, the branch pushed at once. - Disc image Scooby Doo Phantom of the Knight.iso mounted, at
H:\scoobythis time (earlier runs had it atK:).
What the code has (read at 34d2c0dc80)
- Setters:
setGameFlag(),setGameInt(),setGameString()(terraglyph.h); a flag reads true only forYes, a number withatoi, sosetGameString()covers all three.giveClue()(clues.cpp) takes any name and gives a non-suspect a red herring, so the operation checks the name against the game’s clue table first.Inventory::addItem()takes any name; the operation checksobject.ini’sID=inventoryobjectfirst.showRoom()is the full entry; the run loop falls back to the room left if it fails, and the operation does the same. - The driver:
runTestScript()reads each step with"%15s %d %d". The new verbs read the rest of the step as text. - The hit walk:
Room::hitTest()changes no game state:getFrame()andgetPolygon()are const, andgetCel()only fills the block’s cel cache. The placement kind is inRoom’s private section; the enum moves to the public one, with agetKind()getter. - The draw:
drawRoom()draws the room into_roomand copies its visible 640×480 to the screen. The overlay goes on a copy, so_roomandRoom::draw()are unchanged, and the driver’sshotreads the screen with the overlay on it.
The overlay’s cost
Not measured before the code (measured in the run: 145 ms for a full pass,
so it samples every second point; see the packet’s Result). A full pass is 307,200 hitTest() calls,
each walking the draw list with a cel-cache lookup per sprite under the
point. It’s timed in the first run (the check line and the Debug: hits
pass line carry the milliseconds). It runs only when the room is drawn
with the overlay on, never with it off. If a pass is too slow for 36 ticks
a second, it samples every second pixel.
Scope lock
This repo: docs/work-packets/WP-130-debug-tools.md, this file,
WORK_INDEX.md.
Fork, engines/terraglyph/: debug_tools.{h,cpp},
debug_tools_check.cpp (new); console.{h,cpp}; room.h (the kind enum
public, getKind(), getHitType()); clues.cpp (isSuspect());
terraglyph.{h,cpp} (the operations’ declarations, the script verbs, the
overlay in drawRoom(), the check call); module.mk. Staged by name.
Risk review
| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Expectations shaped by the run. | med | high | Expected lines written from the setters’ code before the first run; say which were wrong. |
| The check changing what later checks see. | low | high | It runs last, after checkAllMovies(), and ends with newGameForCheck(). Compare the rest of the log with the WP-129 run. |
| The overlay too slow to play with. | med | low | Timed on the first run; fall back to sampling every second pixel. |
| A setter bypassing the engine’s path. | low | med | Exit criterion 3: a search of console.cpp and runTestScript() for direct setter calls. |
Verdict
- READY TO EXECUTE
- NOT READY
Prepared by: Claude (WP-130 session, drafting + execution in one) Date: 2026-11-30