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”:
- 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.
- 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.
- A lost click is silent. No light and no sound.
- 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:
- No “your turn” line. The room’s voice clips are
Wizards_Rule.Correct1–5_1_NARRATOR,Incorrect,Incorrect2andIncorrect3_1_NARRATORand the six colour calls (Wizards_Rule.Red…Brown), all inSFX.DAT, plusWFR.Potion_1–6. The song isWizards_Rule.Music(VOICE.DAT). - The wizard’s watch animations aren’t used.
TGIFILE.ARThasANIM_WFR_WIZARDTURN_WATCHandANIM_WFR_WIZARDWATCHbeside Scooby’s pair. The dancer class plays them by mode (setMode(), modes 2 and 4), but the tick only ever turns Scooby to watch (wfr_rooms.cpp,turnWatch(_scooby)). On the player’s beats the wizard dances on. - Short UI sounds from other rooms:
Sign_In.Click,Gardeners_House.Button_Click. No chime or bell.
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
- 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. Thewfr: a click on …line (fork #69) gets a verdict for a held early click, for exampleearly, held for beat 8. - Fork,
wfr_check.cpp: a check line for each change, plus aplay early pressline: a press at beat 7.85 (inside a 0.25 window) counts for beat 8, and a press at 7.70 doesn’t. Every existingwizard's rule room checkline keeps its format. A line that changes on purpose is named in the pre-flight before the first run. -
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.
- D5 (added after live check 1): the turn judged by order in
wfr_rooms.{h,cpp}, and aplay ordercheck line in place ofplay early press. - D6 (added after live check 2): the held click in
wfr_rooms.{h,cpp}, and threeplay ordercases in place ofbefore the turn.
Out of scope
- The miss called on the next beat (point 2 above). It isn’t part of Jeff’s call. If his live check still finds it harsh, it’s a new decision and a new line here, not a silent extra. D5 changes it anyway: a wrong bottle is called at once, and a turn not played out at the turn’s end.
- The song’s clock, the beat rate, the late end of the window, the phrase table and the lives (WP-094).
- Any other room.
Exit criteria
- 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. - The original’s rules otherwise hold. The
play clean,play wrong bottle,play late pressandplay not the player'slines 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. - Live — Jeff. With the real mouse, Jeff plays a clean phrase
(
wfr: a phrase played cleanin his--debuglevel=2log), 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 andwfr: a phrase played clean8 times (§Live check 2). He didn’t say separately whether the cue or the lost-click answer reads. - Process. The fork PR against
scooby-engineis opened from its own worktree (tools/New-ForkWorktree.ps1); Jeff merges. Opened: #70, fromC:\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.
- D1, the cue. On the player’s dance beats, the wizard now turns to watch where he used to dance. With the bar’s idle, he turns on beat 8 and again on 12, as Scooby does on 0 and 4.
- D2, the early window. In the late part of a beat, a click at 0.75 or
later is held when the next beat is the player’s and has a bottle. It’s
taken on that beat’s first tick in its window.
[0.49, 0.75)still loses the click. - D3, a lost click. Every exit that drops a click lights its bottle for
4 ticks and plays
Sign_In.Click(inSFX.DAT, found). It runs on its own timer, which leaves a bottle the room lit itself alone. - The click line gains
early, held for beat <n>and…, taken on beat <n>: <verdict>.
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.”
- The clicks (live). The build was WP-143’s: the log has
early, held for beat 9. Jeff clicked the wizard’s bottles in order in both phrases, every click 0.3–0.9 of a beat after its beat, and lost all six: the 8.91 RED held by D2 for beat 9 and judged against GREEN, thenlate in the beat,a gapandnot the beat's bottle. The timing rule, not the window’s width, was the problem. That led to D5. - The cue not seen (source). On a player’s beat the tick ran the dancers’ beat logic on every tick until a click counted. On beats 8 and 12, the bar’s first beats, that idled both dancers and turned them again each tick, so their turn anims restarted 36 times a second through the beat’s first 0.49. The wizard’s turn started half a beat late, at about the moment the click window closed. D5’s tick runs the beat logic once a beat.
- The lost-click light is 4 ticks (about 110 ms), and in live check 1 it came with the glass breaking. D3 is unchanged; live check 2 says whether it reads.
D5, the turn judged by order
The change (source). Fork 31a4c93fcd, wfr_rooms.{h,cpp}:
- On the player’s turn (beats 8–15) a click counts if it’s the next of the
turn’s bottles, at any part of any beat. Counted, it lights its bottle 12
ticks, plays
WFR.Potion_<n>and calls the colour, as before. The light runs its 12 ticks: the turn doesn’t darken the bottles at 0.49 of the beat or at a new beat. - A wrong bottle is a miss at once (
missTurn): Scooby stops, the glass breaks, a life goes, an Incorrect line. A turn not played out is the same miss at the next phrase’s first beat. The next phrase counts it, as before. - The turn played out:
wfr: the turn played out, and the snack on the next beat. - A click after the turn is over is lost, with D3’s light and click.
- The early window and the held click are gone. The wizard’s half keeps the original’s rules.
- The click line’s verdicts on the turn are
bottle <n> of <m>, counted,not the next bottle (<COLOUR>), the turn missed,the turn played out, lostandthe turn missed, lost.
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.”
- The turns (live). 12 turns: 8 played out, each followed by
wfr: a phrase played clean(snacks 2 to 9), and 4 missed. The clicks that counted came anywhere from 0.01 to 0.98 of a beat, so the timing that failed live check 1 no longer matters. - The misses (live). Three were a wrong bottle partway through a turn:
- at beat 89, GREEN when RED was next;
- at beat 107, GREEN, which isn’t in that turn;
- at beat 122, BLUE before RED.
Each time, the right bottles came on the next clicks. The log can’t tell whether these were the order misremembered or a click that landed on the next bottle over.
- A click just before the turn (live). The fourth miss: PINK, the
turn’s first bottle, clicked at beat 23.58. That is late in the wizard’s
last beat, so it was lost (
late in the beat, lost). Then YELLOW at 25.50 was judged against PINK, and the turn was missed. D5 starts the turn at beat 8 exactly, so a click 0.42 of a beat early still loses it. Counting a click in the late part of beat 7 as the turn’s first would be a new decision. - The cue (live).
--debuglevel=2doesn’t log the dancers’ anims, and Jeff didn’t say whether the wizard’s turn to watch reads. The source and the self-test (clean,play clean) show it on beat 8.
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.