WP-133: Phantom’s Wizard’s Rule Room bottles, played (Gen 1)
Status: ✅ Done (2026-12-01). Fork PR barefootbetters/scummvm#60 merged on 2026-12-01 (merge commit 1b5db3fc40).
Phase: 5 (rooms played)
Depends on: WP-083 ✅ (the port of the room), WP-094 ✅ (the game played through the engine’s tick), WP-116 ✅ (handleEvent())
Companion EC: none (inline checklist under Exit criteria)
Pre-flight: pre-flight-WP-133-2026-12-01. Required: the packet modifies engines/terraglyph/**.
Targets generation(s): Gen 1, Phantom of the Knight only.
Estimated effort: Two hours
Goal
Play the Wizard’s Rule Room’s bottles (ROOM_P30_WFR, tick 0x41C3A0)
through the engine’s own event path, against the decompile, and fix what
differs.
WP-094 played the game through the engine’s tick. Its
check still clicked a bottle by calling the room class’s click(), never
through the mouse (wfr_check.cpp:195). It’s the last of the 11 checks that
click through a class or script function, the one the
WP-087 pre-flight left open.
Jeff picked the bottles over the wizard’s skull (2026-12-01). The bottles’
parent and hit test changed the same day (fork PR
barefootbetters/scummvm#58),
so a played check covers that change too.
What the decompile says
- The cursor (
0x41C3A0, at the top): with the mouse below row 240 (DAT_00474d60 +0x1E > 0xF0), the open hand when any bottle is under the mouse (+0x08), else the default cursor (vtable+0x0C). - A click (
0x41C3A0): the player’s beat lights its bottle only when that bottle is under the mouse (+0x08) and the button went down this tick (inputDAT_00474d9c +0x20, bit value 4). The beat is then done with: the light for 12 ticks (+0x134), the potion and the colour. - A wizard’s beat and a gap don’t read the click. Late in a beat (past 0.49 of it) the tick returns before reading it, so a press there is lost.
- The dances (
0x41C3A0): a phrase’s first beat draws its eight dances (rand() % 6 + 1into+0xC0) at the top of the beat, and only then reads the beat’s dance for the wizard and Scooby.
What differed
The bottles: nothing. Played with the mouse, they match the decompile, and nothing in the engine needed a change for them.
The dances: one bug, found by the live run. The port read the beat’s dance
before a phrase’s first beat drew them. So on each phrase’s first beat the
wizard (and Scooby, on the player’s half) danced the previous phrase’s first
dance. On the song’s first beat that’s dance 0. ANIM_WFR_WIZARDDANCE0
doesn’t exist, so the wizard vanished for that dance. The live log said so:
OBJ_WFR_WIZARD has no ANIM ANIM_WFR_WIZARDDANCE0; it shows nothing. The
read now comes after the draw, as in the original (wfr_rooms.cpp). A new
line checks it.
Scope
In scope:
- Fork:
wfr_check.cpp(a played section at the end ofcheckWizardsRule, with events fed throughhandleEvent()), andwfr_rooms.{h,cpp}for the dance fix the play found. - Docs: this packet, its pre-flight, a note in scooby-exe, a pointer in WP-094, and the index row.
Out of scope: the wizard’s skull (wizards_check.cpp:174), which also
calls its class directly; the song’s clock, which the check still sets.
Exit criteria
- Expectations first. The new lines were written from the decompile
before the run (
460faa9). The first-dance line was added after the first run, before the second. - Self-test. The new lines match the decompile. The rest matches the
last run on
scooby-engineexcept for the per-run random keys. No new warnings. - Live. A scripted run shows the open hand on a bottle and a bottle lit by a click.
- Process. The fork PR against
scooby-engineis open: barefootbetters/scummvm#60 (merged on 2026-12-01).
Expectations (written before the run)
Level 0, the room’s random draws forced to 1, the clock set as the direct lines set it.
- Hover: a point found on each of the 6 bottles by their polygons; the open hand on all 6; off them below row 240, the default cursor.
- Clean: the same as the direct
cleanline: RED, GREEN and BLUE lit on beats 0–2 and 8–10, a snack on beat 11, Potions 1–3 with their colours andCorrect2. - Wrong bottle (GREEN on beat 8, which wants RED): beat 8 not lit; on beat 9 a glass breaks, a life goes, and GREEN lights; no snack on beat 11.
- Late press (RED on beat 8 at 0.7 of it): beat 8 not lit; beat 9 missed, as for the wrong bottle.
- The wizard’s beats pressed (beats 0–2): his bottles lit, and no potion.
- A gap pressed (beat 11): nothing lit, and the snack still given.
- The first dance (added after the first run, before the second, for the dance fix): on beats 0 and 16, the wizard set to dance the phrase’s first dance, just drawn.
Result
Evidence labels: log (a self-test’s debug log), live (session) (a scripted run this session drove and read, with screenshots).
- The change (source). On
wp-133-wfr-bottles-played:e3bf85e185: the played section at the end ofcheckWizardsRule;f9d83f0e93: the dance read after the draw, agetDance()getter, and the first-dance line.
- Self-test (log). The second run, on
f9d83f0e93. Level 0, the room’s random draws forced to 1 except in the first-dance line.- Hover:
- a point found on all 6 bottles by their polygons: RED 330,318, GREEN 339,345, BLUE 189,333, PINK 387,348, YELLOW 486,297, BROWN 132,345;
ANIM_CURSOROPENon each;- off them at 620,470 (layer 0):
ANIM_CURSORARROW.
- Clean: the same as the direct
cleanline, character for character:- RED, GREEN and BLUE lit on beats 0–2 and 8–10;
- a snack on beat 11;
- dark late in each beat;
WFR.Potion_1to_3with their colours, andCorrect2.
- First dance (the room’s own random): beat 0 dances 1, the phrase’s first 1; beat 16 dances 4, the phrase’s first 4.
- Wrong bottle (GREEN on beat 8) and late press (RED on beat 8 at 0.7
of it) give the same line:
- beat 8 not lit;
- beat 9 lit GREEN, with the miss, life 4 of 5 hidden, and Scooby idle;
- beat 10 lit BLUE;
- no snack on beat 11;
- heard from beat 8:
Knights.Glass_Breaks.1, an Incorrect line, then Potions 2 and 3 with their colours.
- Not the player’s:
- beats 0–2 pressed: lit RED GREEN BLUE (the wizard’s own), and nothing heard;
- the gap on 11 pressed: not lit, the snack given, and no miss.
The rest matches the 2026-11-30 run on
scooby-enginebefore #59, except for:- the per-run random keys: the drawbridge flags and their points, the screaming lines, Maria’s items, Ewan’s pages;
- #59’s own claim lines for the fountain exit and the well rope;
- the debug tools’ timing.
WFR’s direct lines are unchanged. Both runs log 18 warnings in the self-test. The baseline log’s 19th,
BK.011, came from the game left running after the self-test. The build has no warnings inengines/terraglyph. - Hover:
- What I got wrong first. Nothing in the bottles’ lines. The dance bug wasn’t in the expectations: the first run’s lines didn’t show it, because the dances are read through the dancers’ modes. The live log showed it.
- Live (session). Two scripted runs from
start_room=ROOM_P30_WFRon the real song clock, with the mouse on the red bottle’s neck (330,318). The first run’s clicks all came before beat 8. It also loggedOBJ_WFR_WIZARD has no ANIM ANIM_WFR_WIZARDDANCE0on beat 0: that’s the bug. On the fixed build:- beat 0: the wizard drawn dancing, the red bottle lit by him, and no
DANCE0warning; - the hover:
ANIM_CURSOROPEN, and the screenshot shows the open hand on the bottle’s neck; - beat 8 (5809 ms): a click lights the red bottle. The next shot shows it lit and Scooby dancing along.
- beat 9 (green) wasn’t clicked, and beat 10 logs “a beat missed, a glass breaks”.
The red bottle’s lit cel doesn’t cover 330,318. Once lit, the hover there reads layer 0 and the arrow until the bottle goes dark again.
- beat 0: the wizard drawn dancing, the red bottle lit by him, and no
Deliverables
- Fork:
wp-133-wfr-bottles-played, PR barefootbetters/scummvm#60 (f9d83f0e93), merged on 2026-12-01 as1b5db3fc40; the fork worktree and branch are removed. Staged by name:wfr_check.cpp,wfr_rooms.{h,cpp}. - Docs: this packet, its pre-flight, the note in scooby-exe, the pointer in WP-094, and the index row.
- Local only: the self-test and live logs, the screenshots, and the expected text.