WP-143: a “your turn” cue and forgiving timing in the Wizard’s Rule Room (Gen 1)

Status: ✅ Done (2026-12-03): fork PR barefootbetters/scummvm#70 merged into scooby-engine (38ec347633). The wizard turns to watch on the player’s turn (D1); the turn is judged by order, not by beat (D5, which replaced D2’s early window after live check 1); a click just before the turn is held for it (D6); a lost click lights its bottle with a click (D3); always on (D4). Jeff’s live check 2 passed: 8 of 12 turns clean. Pre-flight (done): pre-flight-WP-143-2026-12-03, verdict READY. Phase: 5 (polish) Depends on: WP-094 ✅ (the rhythm game), WP-133 ✅ (the bottles played through the event path), WP-141 ✅ (the finding; docs PR #374), fork PR barefootbetters/scummvm#69 (the wfr: a click on … line the live check reads), merged first Found by: WP-141, Jeff’s call of 2026-12-03 Companion EC: none (inline checklist under Exit criteria) Pre-flight: Required: the packet modifies engines/terraglyph/**. Targets generation(s): Gen 1, Phantom of the Knight only. Estimated effort: Half a day, plus Jeff’s live check


Goal

Make the Wizard’s Rule Room playable by a person at the real mouse: show when the player’s turn starts, count a click that lands a little early, and answer a click that doesn’t count.

Background

WP-141 found that the port plays the room exactly as the original does (0x41C3A0). In Jeff’s replay every click reached the room, and the one that landed on its beat counted. The rest were lost to the original’s rule. Four things make that rule read as “the bottles don’t take clicks”:

  1. The turn comes late and unmarked. The player repeats the wizard’s bottles eight beats after he lights them. After a three-bottle phrase that’s five silent beats, about 4.5 s after his last bottle. Only Scooby turning to dance marks the start of the turn.
  2. The miss is called almost at once. A missed beat breaks the glass on the player’s next beat, half a second into the turn.
  3. A lost click is silent. No light and no sound.
  4. The window opens on the beat. A click counts only in the beat’s first 0.49 (about 355 ms). Jeff’s PINK, about 100 ms early, was lost.

Jeff’s call (2026-12-03): “Cue + forgiving timing”: a cue when the player’s half starts, a window that opens a little before the beat, and a light or sound for a lost click. This is a deliberate departure from the original, as WP-140’s pointer was. Point 2, the miss called on the next beat, isn’t part of the call; see Out of scope.

What the game ships (source: the game data)

Read from tools\exes\phantom for this draft:

Decisions

Jeff took all four recommendations on 2026-12-03 (“Yes, all four”).

D1: the cue

Option What the player sees or hears Notes
A. The wizard turns to watch On beat 8 the wizard turns (…WIZARDTURN_WATCH) and watches (…WIZARDWATCH) through the player’s half, as Scooby does on his The game’s own art, never played. The two dancers trade places, which reads as “your turn” without words.
B. A tick on each of the player’s beats Sign_In.Click on beats 8–15 Also shows where the beats are, which is the timing problem. It’s a sound from another room, over the song.
C. The bottles flash on beat 8 All six bottles lit for a few ticks Lit bottles already mean “the wizard’s pattern”, so this could mislead.

Decided: A. It uses the room’s own art and keeps the song clean. If Jeff’s live check finds the beats still hard to place, B can be added on top in the same packet.

D2: how early a click may land

Today a click counts in [beat, beat + 0.49). The change opens the window early: a click in the last part of the beat before a player’s beat is held, and taken on that beat’s first tick, as if it had landed on it.

Option The window Early by
A. 0.15 of a beat [beat − 0.15, beat + 0.49) ~110 ms
B. 0.25 of a beat [beat − 0.25, beat + 0.49) ~180 ms
C. 0.35 of a beat [beat − 0.35, beat + 0.49) ~255 ms

Decided: B. It covers Jeff’s PINK (0.14 early) with room to spare, and still leaves a gap between beats so a late click on one beat can’t count for the next. The late end stays 0.49, the original’s.

Replaced by D5 after Jeff’s first live check (below).

D5: the turn judged by order (added 2026-12-03, after live check 1)

Jeff’s first live check (live1.log, on fork 5fc9c15e0f) clicked the right bottles in the right order in both phrases: RED, GREEN, BLUE at beats 8.91, 10.67 and 12.29, then PINK, YELLOW, RED at 24.69, 26.31 and 28.30. Every click landed 0.3–0.9 of a beat after its beat and drifted later through the phrase, so all six were lost. The 8.91 RED was even held by D2 for beat 9 and judged against GREEN. A wider window would still lose the second and third click of each phrase.

Option  
A. Order, not beat On the player’s turn (beats 8–15) each click must be the next of the wizard’s bottles, at any time in the turn. A wrong bottle, or a turn not played out by its end, is a miss.
B. A wider window only A click counts until a full beat after its beat. By live1.log it still loses the 2nd and 3rd click.
C. Order, plus a clearer cue A, and a lost click lit 12 ticks, not 4.

Decided: A (Jeff, 2026-12-03). Both of his live phrases pass under it. It replaces D2: no click is held, and the beat window no longer applies on the player’s turn. The wizard’s half keeps the original’s rules. It goes further from the original than D2 did: the turn becomes a memory game in the song’s time, not a rhythm game.

D6: a click just before the turn (added 2026-12-03, after live check 2)

In live check 2 Jeff clicked PINK, the turn’s first bottle, at beat 23.58. That is late in the wizard’s last beat, so D5 lost it. His next click, YELLOW, was then judged against PINK and the turn was missed: a right turn that read as a failure.

Decided (Jeff, 2026-12-03, “Yes, count it”): a click in the last part of the beat before the turn (beat 7 of a phrase, from 0.49 of it) is held and judged as the turn’s first click. Earlier in beat 7 the click is still the wizard’s and lost. That keeps D5’s rule that the wizard’s half follows the original’s rules for every click it judges.

D3: the answer to a lost click

Option A lost click A counted click (unchanged)
A. A short light and a click the bottle lit 4 ticks, Sign_In.Click lit 12 ticks, WFR.Potion_<n>, the colour called
B. A short light only the bottle lit 4 ticks, silent same
C. The potion sound only WFR.Potion_<n>, no light, no colour same

Decided: A. The light says the click was taken, the click says it didn’t score, and only a counted click calls the colour. Option C borrows a counted click’s sound, so a lost click would sound like a hit.

D4: always on, or a game option

Option  
A. Always on As WP-140’s pointer. One way to play.
B. A game option, on by default A ScummVM game option (“Original rhythm timing”) brings back the retail rules. More code and a check per mode.

Decided: A, as WP-140. The original’s rules stay in the history and in WP-094.

Scope

In scope

  1. Fork, wfr_rooms.{h,cpp}: the cue (D1), the early window (D2) and the lost-click answer (D3), each with a comment that names the original’s behaviour, says the port departs from it by Jeff’s decision, and gives this WP’s number. The wfr: a click on … line (fork #69) gets a verdict for a held early click, for example early, held for beat 8.
  2. Fork, wfr_check.cpp: a check line for each change, plus a play early press line: a press at beat 7.85 (inside a 0.25 window) counts for beat 8, and a press at 7.70 doesn’t. Every existing wizard's rule room check line keeps its format. A line that changes on purpose is named in the pre-flight before the first run.
  3. Docs: this packet, its pre-flight, the index row, a pointer from WP-141 §Result, and a “Departs from the original” note in the WFR section of scooby-exe.

  4. D5 (added after live check 1): the turn judged by order in wfr_rooms.{h,cpp}, and a play order check line in place of play early press.
  5. D6 (added after live check 2): the held click in wfr_rooms.{h,cpp}, and three play order cases in place of before the turn.

Out of scope

Exit criteria

  1. Self-test. The new lines match text written from the source and committed to the pre-flight before the first run. Seeded (random_seed), with the baseline run twice for the noise floor, the rest of the self-test matches but for the lines named as changing on purpose. The three new lines match the pre-flight (9085f73) character for character. Every other difference is named in §Result.
  2. The original’s rules otherwise hold. The play clean, play wrong bottle, play late press and play not the player's lines match the baseline. Where D1 changes the wizard’s anim on beat 8, the changed text is named in the pre-flight first. Met with one gap in the wording: D3 also changes three of these lines, because a lost click now lights its bottle and plays a click. The changed text was named in the pre-flight first. What each line says about the rules is the baseline’s: which beat counts, the miss, the life, the snacks.
  3. Live — Jeff. With the real mouse, Jeff plays a clean phrase (wfr: a phrase played clean in his --debuglevel=2 log), and says in his own words whether the cue and the lost-click answer read. Carried over from WP-141’s exit criterion 2. Live check 1 failed (Jeff: “Still can’t click the potions at the required time and don’t see any changes you made”); see §Live check 1. Met by live check 2 on D5’s build: Jeff, “It works now, I could play a clean turn.” His log has 8 turns played out and wfr: a phrase played clean 8 times (§Live check 2). He didn’t say separately whether the cue or the lost-click answer reads.
  4. Process. The fork PR against scooby-engine is opened from its own worktree (tools/New-ForkWorktree.ps1); Jeff merges. Opened: #70, from C:\claude-worktrees\scummvm-wp-143-wfr-turn-cue-timing, stacked on #69. Merged by Jeff, 2026-12-03 (38ec347633).

Result

Every claim is Gen 1, Phantom. Evidence labels: source, self-test. Live is Jeff’s play, read from his logs (§Live check 1, §Live check 2).

The change (source). Fork 5fc9c15e0f, wfr_rooms.{h,cpp}. Each change is marked in a comment as not the original’s, with this packet’s number.

Self-test (self-test). random_seed=140 against WP-141’s seeded-wp141.log on e5cbe578a3, this branch’s base. Logs are in C:\pcloud\scooby-engine\verification\wp-143-2026-12-03\.

Lines Result
play cue, play early press, play lost click (new) identical to the pre-flight’s text
clean, play clean the wizard’s anim on beat 8 is ANIM_WFR_WIZARDTURN_WATCH, as predicted; the rest unchanged
play wrong bottle, play late press, play not the player's the lost-click light and Sign_In.Click, as predicted; the misses, lives and snacks unchanged
the other 11 wizard's rule room check lines unchanged
a second run (seeded-wp143-run2.log) every WFR line and every clue line identical to the first
the debug-tools check’s clue (EWAN_BELLOWS → EWAN_K) from the new checks. A control build with the three new blocks skipped (seeded-control-no-new-checks.log) gives the baseline’s clues back. The new checks’ room entries advance the engine’s random stream before that draw.
a room-walk visit’s wfr: beat 0 at … ms 0 ms in every earlier run and in the control; 13 and 12 ms in the two WP-143 runs. The value is the mixer’s position on the real clock, read before any code this packet changes.
other the build stamp, two FRED lip-sync lines, the debug-tools milliseconds, and the order of the audio rate-converter lines: WP-140’s noise floor

The click line’s counts in the run: counted 32, the 7.85 press among them as taken on beat 8; early, held for beat 8 1; the wizard's beat, lost 5; late in the beat, lost 4; not the beat's bottle (RED), lost 1; a gap, lost 1.

The cue’s timing. The wizard turns on beat 8, the player’s first beat, the same moment Scooby turns to dance. That marks the player’s half rather than announcing it. If the live check finds the first beat still hard to catch, turning him on beat 7 is a one-line change, and a new decision.

Live check 1

On fork 5fc9c15e0f, 2026-12-03, live1.log. Jeff: “Still can’t click the potions at the required time and don’t see any changes you made.”

D5, the turn judged by order

The change (source). Fork 31a4c93fcd, wfr_rooms.{h,cpp}:

Self-test (self-test). seeded-wp143-order.log against seeded-wp143.log, random_seed=140. These expectations were not written down before the run. Each changed line was read against the change above.

Line Change Why
play order (new, replaces play early press) off the beat: 8.91 RED 10.67 GREEN 12.29 BLUE; snacks 1, phrases missed 0; wrong first: 8.30 GREEN; … phrases missed 1, life 4 hidden; not played out: 8.50 RED 9.50 GREEN; … phrases missed 1; before the turn: 7.85 RED 8.20 RED 9.20 GREEN 10.20 BLUE; snacks 1, with Sign_In.Click for the 7.85 press D5. The first case is Jeff’s own live clicks.
clean, play clean beats 11–15 read BLUE, late in each beat dark 0 The check ticks twice a beat, so the 12-tick light outlasts the turn. In real time it’s about a third of a second. Snacks, misses and sounds are unchanged.
missed heard ends at the Incorrect line, without WFR.Potion_3 Wizards_Rule.Blue Beat 10’s BLUE is now the wrong next bottle, and the miss.
lives hidden at beat 16 32 48 (was 9 25 41) A turn not played out is missed at its end. Three missed is still beat 48.
play wrong bottle beat 8 lit -, heard Knights.Glass_Breaks.1 Wizards_Rule.Incorrect2_1_NARRATOR Sign_In.Click The wrong bottle misses the turn at once; the presses after it are lost.
play late press missed 0, beat 11 snacks 1 RED at 8.7 now counts.
play not the player's gap 11 pressed lit RED+BLUE BLUE’s 12-tick light is still on (the check’s two ticks a beat).
every other WFR line, and all 140 clue lines unchanged from the first WP-143 run  
a second run (seeded-wp143-order-run2.log) all 159 WFR and clue lines identical to the first  

For Jeff’s live check 2. Build: C:\claude-worktrees\scummvm-wp-143-wfr-turn-cue-timing\build-tg\scummvm.exe (fork 31a4c93fcd). Config wp143-live.ini opens straight into the room (start_room=ROOM_P30_WFR). The log goes to live2.log. A clean turn logs wfr: the turn played out, then wfr: a phrase played clean.

Live check 2

On fork 31a4c93fcd, 2026-12-03, live2.log. Jeff: “It works now, I could play a clean turn.”

D6, a click held for the turn

The change (source). Fork 495a4a35de, wfr_rooms.{h,cpp}. A click late in beat 7 of a phrase (from 0.49 of the beat) is held, not lost, and logged before the turn, held for it. The turn’s first tick judges it as the turn’s first click, before that tick’s own click. If it’s the first bottle it counts, and if not the turn is missed. One click is held; a second one late in beat 7 is lost. A click earlier in beat 7 is still the wizard’s and is lost, with D3’s light and click.

Self-test (self-test). seeded-wp143-d6.log against seeded-wp143-order.log, random_seed=140. The expected line was written to expected-d6.txt before the first build, and the run matches it character for character:

Line Change
play order before the turn is replaced by held for the turn: 7.85 RED 9.20 GREEN 10.20 BLUE; snacks 1, phrases missed 0, heard without Sign_In.Click; the wrong one held: 7.85 GREEN; snacks 0, phrases missed 1, life 4 hidden; too early: 7.30 RED 8.20 RED 9.20 GREEN 10.20 BLUE; snacks 1, with Sign_In.Click for the 7.30 press
every other WFR line, and all 140 clue lines unchanged
a second run (seeded-wp143-d6-run2.log) all 159 lines identical to the first

No live check is asked for D6 on its own: it changes only a click in the last part of beat 7, and live check 2’s miss at beat 23.58 is its case.