WP-094: Phantom’s Wizard’s Rule Room: the original’s game (Gen 1)

Status: ✅ Done (2026-11-27). Fork PR barefootbetters/scummvm#18 merged on 2026-11-28 (merge commit bfeaa1c7ba). Phase: 5 (a reconstruction found while searching packets for setup-only checks) Depends on: WP-083 ✅ (the room’s claim, entry and exit), WP-081 ✅ (the bedroom the room returns to) Companion EC: none (inline checklist under Exit criteria) Pre-flight: pre-flight-WP-094-2026-11-27. Required: the packet modifies engines/terraglyph/**. Targets generation(s): Gen 1, Phantom of the Knight only. Showdown has no such room. Estimated effort: Half a day


Goal

Replace the fork’s reconstructed Wizard’s Rule Room game (ROOM_P30_WFR, class 0x41BEA0) with the original’s, ported from the decompile, and prove it by playing it through the engine’s tick and live.

Background

WP-083 ported the room and wrote that “the contract (classes, clips, claims, music, exit) is what the self-test checks; the feel of the reconstructed loop is for live play”. Its live run watched the wizard dance and never clicked a bottle. Jeff asked for packets with notes like that to be searched after WP-090, WP-092 and WP-093 each found gaps behind them, and this room led the list.

The fork at 3960fdb (source):

Scope

In scope:

  1. Fork, wfr_rooms.{h,cpp}: the tick (0x41C3A0), entry (0x41C0C0), leave (0x41C350), claim (0x41CF50), the ways out (0x41BF30, through exitMovie()), the dancers (0x41BAC0–0x41BC80), and the whole table.
  2. Fork, wfr_check.cpp: the game played through the tick, with the song’s clock set directly, against text written from the trace.
  3. Docs: this packet, its pre-flight, the WFR section in scooby-exe, pointers in WP-083 and WP-087, and the index row.

Out of scope:

Exit criteria

  1. Self-test. The WFR lines match text written from the trace before the run. The rest of the self-test matches the 3960fdb baseline except the per-run random keys and a known-flaky arena line. No new warnings.
  2. Live (session). The beats follow the song. Clicking the beat’s bottles plays a phrase clean and earns a snack. A missed beat breaks a glass and costs a life.
  3. Process. The fork PR against scooby-engine is open (merged the next day), and each claim carries its evidence label.

Result

The bottles played by WP-133 (2026-12-01). The self-test now clicks them through the engine’s own event path, the mouse moved onto each and the button pressed. They match the original. The play found one bug: a phrase’s first beat danced the last phrase’s first dance (dance 0 on the song’s first beat, so the wizard vanished). It’s fixed.

Every claim is Gen 1, Phantom. Evidence labels: source (the decompile), self-test, log (the engine’s debug log of a live run), live — session (a scripted run this session drove). Nothing here is live — Jeff.

What the original does (source). It is written up in full in scooby-exe, from Scooby.exe (SHA-256 619EA687…AF807ED, Ghidra 12.1.4 headless):

The port (source). On wp-094-wfr-game (8bc6cf2994), the C++ table is generated from the Ghidra dump of 0x46C5B0, not typed. A first hand transcription miscounted, and the generator’s checks caught it. Two debug lines (level 2) log each beat with its bottle and each bottle’s box on screen.

Self-test (self-test). The text of each line was written from the trace before the run; the snack count, cels and sounds follow from rand(), pinned to 1. All seven match:

The first run printed movie 11 for “the song over” where the expectation said −1. The log showed the room’s exit never ran in that scenario: my check reused next from the previous scenario, so its loop never ticked. With next cleared, the second run matches.

The rest of the self-test matches the 3960fdb baseline, from C:\dev\scummvm, run alone. The only differences are:

The runtime warnings match, 18 each.

Build (log). Terraglyph only, in the fork worktree; no warnings in the changed files. A shadowed local in the first draft of the check was renamed.

Live (live — session, with log). The run used start_room=ROOM_P30_WFR and level 0.

Deviations:

Deliverables

Notes