Pre-Flight — WP-078 — 2026-11-19
Filled-in copy of docs/reference/pre-flight for WP-078. Verdict at the bottom.
Nothing on main, in the fork or in an open PR touches
ROOM_P29_Princess_BedroomorROOM_P21_Mermaids_Cavern(checked 2026-11-19: noWP-078packet, nowp-078branch local or onoriginbefore the claim; the fork’sscooby-engineis at43f1989815with WP-077 / PR #3 merged).
Header
- WP:
WP-078 - Title: Phantom’s Princess’s bedroom and Mermaid’s cavern — the second group-8 (Upstairs) packet (Gen 1)
- Pre-flight date:
2026-11-19 - Targets generation(s): 1
- Targets disc(s): Phantom (Showdown has neither room)
Pre-flight intent
Validating readiness for
WP-078. Not implementing, not editing engine code, not annotating Ghidra. Verdict only.
Dependency check
The second sub-bullet of the Phantom audit’s group 8, Upstairs pairs the Princess’s bedroom (which yields OBJ_INV_SPELL_BOOK, the spell book the wizard’s library consumes) with the Mermaid’s cavern (a single event override). Neither depends on a sibling Upstairs room’s code: the library that consumes the spell book (WP-077) is already merged, but the bedroom yields the book regardless of the library.
| Prereq | Status in WORK_INDEX |
Locked on | Notes |
|---|---|---|---|
| WP-018 | ✅ Done | 2026-11-14 | Hotspots and exits: the bedroom’s and cavern’s hotspots. |
| WP-021 | ✅ Done | 2026-11-14 | Clickables: the bedroom’s hotspot and the placed spell book answer a click. |
| WP-023 | ✅ Done | 2026-11-14 | The inventory: OBJ_INV_SPELL_BOOK (addItem / hasItem). |
| WP-057 | ✅ Done | 2026-11-16 | Phantom’s new game and first room — the fixed-flag block these rooms read. |
Rule check: every prereq is ✅ Done. Phase ordering holds — this is a Phase 4 (game-logic) room port on top of the resource and front-end lanes already closed.
Repo + disc state
- Docs repo (
C:\dev\scooby-engine) clean; the execution worktree (C:\claude-worktrees\scooby-engine\wp-077-upstairs-318968, branchclaude/wp-078-bedroom-cavern) is cut from a fresh fetch. - Fork base checkout (
C:\dev\scummvm) onscooby-engine;origin/scooby-enginefetched to43f1989815(WP-077 / PR #3 merged), base checkout left clean. - Dedicated fork worktree — the claim.
tools/New-ForkWorktree.ps1 -Branch wp-078-bedroom-cavern, forked from a freshly fetchedorigin/scooby-engine @ 43f1989815→C:\claude-worktrees\scummvm-wp-078-bedroom-cavern. The branch name is the claim:New-ForkWorktree.ps1refused if it existed; it did not (the WP-075 collision lesson). - Phantom. Imported
Scooby.exe(md5c5fdb9a0c8f26dfec98f0148ecf505fa, imagebase0x400000) into a throwaway scratchpad Ghidra project (analyzeHeadless -import …), because the committedghidra/scooby.gprholds Showdown (the WP-076 lesson). The two classes areROOM_P29_Princess_Bedroom(0x415350, vtable0x45EA5C) andROOM_P21_Mermaids_Cavern(0x415280, vtable0x45EA1C), per the audit’s group-8 table. The vtable diff against the base room vtable (0x45E5FC) confirms the audit’s override set (bedroom: tick/enter/leave/event/claim; cavern: event only).
Scope lock
Allowed paths (this repo):
docs/formats/scooby-exe.md (the Princess's bedroom and Mermaid's cavern)
docs/work-packets/WP-078-princess-bedroom.md
docs/work-packets/WORK_INDEX.md
docs/reference/pre-flight-WP-078-2026-11-19.md
Fork: engines/scooby/**, staged by name. New files for the packet’s room group and its check; a factory line and include in room_class.cpp, the two module.mk entries, and the check’s declaration (scooby.h) and call (chase_check.cpp). No edit to a sibling room expected: WP-077’s library already consumes OBJ_INV_SPELL_BOOK. Both rooms already have their room_setup entry (music + opening) — no room_setup edit. If the trace surfaces a one-line hook into a sibling class, it is staged by name and called out at execution, not silently widened.
Forbidden: game data from the discs (copyright — never commit); engines/scooby/** beyond the files above; ScummVM upstream paths outside engines/scooby/.
Risk review
| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Ghidra’s underscored labels mask the dotted clip names (the WP-074/075 trap). | med | medium | Probe the voice lines by prefix (Sound::hasClipPrefix), keep exact findClip for flat sfx ids. A found 0 on a name that is right is the tell. The bedroom’s clips are Princess_Bedroom.280_ / 280A_ / 280XA_ / Daphne_Takes_Book; the cavern’s opening is Mermaids_Cavern.340_. |
The spell-book “take” guard (bedroom event reads a game-struct field and a virtual call before queuing the take). |
med | medium | Resolve the compared field and the virtual by decompiling; reproduce the guard faithfully, or state it as always-true in-room and note the simplification. Anchor any game flag on the function that touches it, not list order (the WP-076 trap). |
The Mermaid cavern’s event sets a bare character mode (0x11) with no voice line. |
low | low | Reproduce the three-character mode set faithfully; the check verifies the class builds, its hotspot name, and the character-mode effect — not a clip that does not exist. Do not invent a line. |
| Shared misreading (reference and engine encode the same wrong trace). | low | medium | Two sessions trace both classes independently (the WP-073–077 move) and agree before the check is trusted. The second trace is given raw addresses only, not a resolved flag/offset map. |
| Generation / disc conflation. | low | medium | Every claim is Gen 1 Phantom; Showdown has neither room and the check asserts it prints so. |
Verdict
- READY TO EXECUTE — dependency, scope and risk gates all pass.
- NOT READY
Prepared by: Claude (WP-078 session, drafting + execution in one) Date: 2026-11-19
After execution — lessons learned
- The two traces agreed with no correction this packet. Both reads — mine and the independent second, handed raw addresses — matched on every slot, clip, flag and gate. The dual trace earned its keep anyway on the one non-obvious fact: the echo flag.
- The echo flag (
room+0x29) was anchored on its reader, not the flag list. The second trace’s instruction-scan found its only reader (the wrong-item line selector0x4098B0): in an echo room the characters’_Echo_lines play and Fred, who has none, is passed over. The fork already carried a comment anticipating this (“no room of the default class sets it”), so the room is the first to need it; wired asRoomHooks::isEchowith one reader ininventory.cpp— a sibling hook staged by name, no change for any other room. This is the WP-076 flag-naming discipline applied: never infer a flag’s meaning from its offset; decompile its reader. - The
0x408C80vs0x408DC0builders map to different claim kinds. The spell book is built by0x408C80→ a requires object (the arrow answers); the hotspot by0x408DC0→ a clickable. Reading the builder address, not guessing from the object’s role, kept the claim kinds right. - One interpretive call, flagged: the spell-book
eventguards on the cursor being the settled default (0x433300of the cached cursor against the live one); ported as a plain-click guard (Inventory::isDefaultCursor), which is the condition under which the requires object’s event fires anyway. - The Ghidra “warm project holds Showdown” hazard (WP-076) held again: Phantom was imported into a throwaway scratchpad, read-only; the committed project was left untouched.
- Headless-run note (tooling, not the WP): the graceful
taskkill //IM scummvm.exe //Tthe run-check recipe uses was blocked by the sandbox classifier this session. ScummVM routesdebugCthroughlogMessage, whichfflushes to stdout per line, so the check output is captured live without a close; the run is launched as a background task’s main process (viaexec) and torn down with the harness’s task-stop. Worth adding to the run-check recipe as the fallback whentaskkillis unavailable.