Pre-Flight — WP-077 — 2026-11-19
Filled-in copy of docs/reference/pre-flight for WP-077. Verdict at the bottom.
Nothing on main, in the fork or in an open PR touches
ROOM_Wizards_SkullorROOM_P25_Wizards_Library(checked 2026-11-19: noWP-077packet, nowp-077branch local or onorigin, only the WP-011 docs PR #130 open; the fork’sscooby-engineis ata709d6d94fwith WP-076 and the well-fix merged).
Header
- WP:
WP-077 - Title: Phantom’s wizard’s skull and library — the first 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-077. Not implementing, not editing engine code, not annotating Ghidra. Verdict only.
Dependency check
The first room of the Phantom audit’s group 8, Upstairs — the first sub-bullet pairs the wizard’s skull (the Skull Puzzle room) with the wizard’s library (the spell-book shelf that reveals the skull combo). Its one geography dependency, the magic mirror room / royal gallery, landed in WP-072.
| Prereq | Status in WORK_INDEX |
Locked on | Notes |
|---|---|---|---|
| WP-018 | ✅ Done | 2026-11-14 | Hotspots and exits: the library’s hotspots and the ways between the rooms. |
| WP-021 | ✅ Done | 2026-11-14 | Clickables: the four rotating skulls and the library shelf answer a click. |
| WP-023 | ✅ Done | 2026-11-14 | The inventory: OBJ_INV_SPELL_BOOK. |
| WP-031 | ✅ Done | 2026-11-14 | Big Head — ROOM_Big_Head, the library’s spell-book reveal of the skull combo (startBigHead). |
| WP-057 | ✅ Done | 2026-11-16 | Phantom’s new game and first room — sets the fixed flags and SkullCombo0-3. |
| WP-072 | ✅ Done | 2026-11-18 | The magic mirror room — the skull’s exit target (ROOM_P08_Magic_Mirror_Room) and the OBJ_P08_TO_WIZARDS_SKULL way in. |
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, onmainafter the execution worktree is cut from a fresh fetch. - Fork base checkout (
C:\dev\scummvm) onscooby-engineata709d6d94f(WP-076 + well-fix merged), clean, in sync withorigin/scooby-engine. - Dedicated fork worktree — the claim.
tools/New-ForkWorktree.ps1 -Branch claude/wp-077-wizards-skull, forked from a freshly fetchedorigin/scooby-engine @ a709d6d94f, base checkout left clean onscooby-engine. 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 … -readOnly), because the committedghidra/scooby.gprholds Showdown (the WP-076 lesson). The two classes areROOM_Wizards_Skull(0x42D7B0, vtable0x45F4C4, 463 lines) andROOM_P25_Wizards_Library(0x42D1F0, vtable0x45F484, 202 lines), per the audit’s group-8 table.
Scope lock
Allowed paths (this repo):
docs/formats/scooby-exe.md (the wizard's skull and library)
docs/work-packets/WP-077-wizards-skull.md
docs/work-packets/WORK_INDEX.md
docs/reference/pre-flight-WP-077-2026-11-19.md
Fork: engines/scooby/**, staged by name. New files wizards_rooms.{h,cpp} and wizards_check.cpp; a factory line, the module entries, the check’s declaration and its call. No edit to a sibling room expected: WP-072’s magic mirror room already builds OBJ_P08_TO_WIZARDS_SKULL and is the skull’s exit target, and ROOM_Big_Head (WP-031) already exists. 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 | Read the string bytes (StrAt) and probe the disc’s sound index; probe the numbered/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 Skull* flag block is not the Scooby.ini / kPhantomFixed list order (the WP-076 trap). |
med | high | Anchor each flag by the function that touches it: SkullPuzzle (0x257) set by the solve-tick; SkullMovie (0x258) by the hand-demo entry; SkullPuzzleAttempted (0x259) by the attempt entry. Never infer offset→name from the list. The second trace is handed raw addresses, not this map. |
| The skull puzzle is the largest class of the group (463 lines): the wizard hand-demo tick is an easing state machine. | med | medium | Port the tick state machine faithfully (5 px/tick toward each skull, the HANDLIFT/HANDTURN/HANDRETURN loop, the solve check against SkullCombo0-3). The demo is not on the check surface; the check verifies classes/clips/claims/save-keys/movies/exits. |
| Shared misreading (reference and engine encode the same wrong trace). | low | medium | Two sessions trace both classes independently (the WP-073/074/075/076 move) and agree before the check is trusted, on top of the engine == reference match and the disc sound-index probe. The second trace is given raw addresses only. |
| 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-077 session, drafting + execution in one) Date: 2026-11-19
After execution — lessons learned
- The strcmp polarity, not the flag names, was the trap this time. The
room-name compare
0x433360returns true on equal; the first trace read it asstrcmp(0 on equal) and so reversed the skull’senterbranches (which flag is set, and whether the hand demo runs on arriving from vs. leaving to the mirror room). The independent second trace — given the raw addresses, not a resolved map (the WP-076 lesson, applied) — read the branches the other way, and the library’s own code (its taunt onfrom == ROOM_Wizards_Skull, its shelf/hotspot dispatch) settled it. Lesson: pin a strcmp helper’s polarity from an unambiguous caller before trusting a branch, and keep the two traces on raw addresses so a polarity flip can’t be shared. - The
Skull*flags were anchored correctly by the functions that touch them (SkullPuzzleset by the solve-tick,SkullMovieby the hand-demo entry,SkullPuzzleAttemptedby the attempt entry) — not thekPhantomFixedlist order. Both traces agreed on the names; only the branch mapping had to be fixed. SkullCombo0-3are randomised at new game (0x42E880), not loaded from a fixed key; the fork persists them to the profile, sogetGameIntis the read.- 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.