WP-110: Phantom’s royal gallery and magic mirror room, played (Gen 1)
Status: ✅ Done (2026-11-28). Fork PR barefootbetters/scummvm#34 merged on 2026-11-28 (merge commit 077cae1d1b).
Phase: 5 (rooms checked only by sending events, played)
Depends on: WP-072 ✅ (the port of both rooms), WP-099 ✅ and WP-109 ✅ (the same ball-and-Jester pattern)
Companion EC: none (inline checklist under Exit criteria)
Pre-flight: pre-flight-WP-110-2026-11-28. Required: the packet modifies engines/terraglyph/**.
Targets generation(s): Gen 1, Phantom of the Knight only.
Estimated effort: Two to three hours
Corrected 2026-11-28 (found in WP-112). Difference 5 below, the cursor, was not one. The engine hides the cursor whenever a room class is busy or hides it (
isBusy() || hidesCursor(),terraglyph.cpp), and the gallery’sisBusyalready covered the hanging. ThehidesCursoroverride is a harmless duplicate. The other five differences stand.
Goal
Play the royal gallery (ROOM_P07_Royal_Gallery, class 0x416240, vtable
0x45EADC) and the magic mirror room (ROOM_P08_Magic_Mirror_Room,
0x414EC0, vtable 0x45E9DC) through the engine’s mouse and tick, against
the decompile, and fix what differs.
WP-072 ported both rooms. Their check sent events
straight to the rooms with sendEvent, so it never ran the hit test, the
cursor or the tick timing. After WP-109, a search of the Phantom checks found
17 that never go through the engine’s mouse. The gallery came first: it is the
red ball’s room, the third in the family whose other two rooms (the well and
the balcony’s door) both had differences.
What differed
- The mirror was hung at once (
0x416610). The tick starts Shaggy’s put (OBJ_SHAGGY_P07_PUT_MIRROR) once he is idle. In the same tick, it then tests again whether he is idle, to finish the hang. The original reads his state again for that second test, and the put has just taken him out of idle. The fork reused the value it had read before starting the put. So the mirror was hung,210B_started and input came back on the same tick, cutting his put short. The first self-test run showed it:busy 0on the tick after the use. - The red ball and the Jester (
0x4168D0). The ball is built only while it is not found and the Jester has been met:0x40A930looks the name up in the suspects met, game+0x174, which is the fork’shasMetSuspect. A placement whose first ten characters areOBJ_JESTERis claimed and not built until the ball is found, so he appears only to take it, as at the well (WP-109) and the balcony’s door (WP-099). The fork built both always. - The mirror’s claim. It is a requires object (
0x402D90) under the first layer at depth 1:- bare: hit by its polygon (
+0x04 = 2) and stopped; - hung: never hit (
+0x04 = 0), and the tick sets that again when it is hung.
The fork left it to the default path and kept the hung mirror clickable. Clicking the hung mirror played the bare mirror’s
210A_lines. - bare: hit by its polygon (
- The snack box flash.
210B_is started with+0xC2as its done flag (0x40B400), so the snack box flashes on the tick after the line ends. The fork flashed it as the line started. - The cursor. Every tick while the mirror is being hung hides it
(
0x435E80) as well as holding input. The fork only held input. - The mirror room’s sprites (
0x415060).HOTSPOT5andOBJ_P08_TO_WIZARDS_SKULLare sprites that are never hit. The fork’s sprites were hit 1.
One misreading in the format doc came up too. The mirror’s use sets the game
cursor (+0x238) back to the default; the doc had read it as the room’s name
written to a pending-opening string. That makes no difference to behaviour,
since the engine’s click puts the cursor back after the event. The rest
matched:
- the entry (Velma or Shaggy walks in, the snacks needed);
- the red ball’s movie 3;
- the bare mirror’s three lines;
- the way-on gate (
0x4162F0); - the shimmer;
- the mirror room’s entry, hotspot lines and cameras.
Scope
In scope: fork gallery_rooms.{h,cpp} (the fixes) and
gallery_check.cpp (the played section); this packet, its pre-flight, a
pointer in WP-072, the corrections in scooby-exe.md, and the index row.
Exit criteria
- Expectations first. The new lines and differences 2 to 6 were written from the decompile before the run; difference 1 came from the first run.
- Fixed. All six.
- Self-test. The new lines match the expectations. The rest matches the WP-109 run except for the per-run random keys. No new warnings.
- Live. Scripted runs play the red ball through to the Jester’s take,
and the mirror through Shaggy’s put to
210B_and the flash. - Process. The fork PR against
scooby-engineis open (merged later the same day).
Result
Evidence labels: log (a self-test’s debug log), live (session) (a scripted run this session drove and read).
- The fix (source). On
wp-110-royal-gallery(554ce7b57c). - Self-test (log). The new lines:
- Entry:
opening Royal_Gallery.210_; red ball 0; Jester present 0; mirror requires 1 depth 1 hit 2 step 0 mode 0; TO_P08 hidden 1. - The red ball, with the Jester met: it is there and he isn’t. Clicked,
the gallery again through
movie 3, withRedBallFound 1. Entered again, the ball is gone and the Jester is present withANIM_JESTER_ATAKES_RED;RedBallTaken 1. - The bare mirror:
210A_,210A1_,210A2_,210A_. - The mirror hung:
- the next tick: the mirror in no slot (still held), the cursor the arrow, busy 1 and the cursor hidden;
- Shaggy’s
ANIM_SHAGGY_P07_PUT_MIRROR1from tick 1; - hung at tick 153: the mirror looping and hit 0, the way on shown, busy 0, no flash yet;
210B_skipped; the flash on the next tick.
- The hung mirror clicked at the point the bare one was hit: nothing.
- The way on: with 0 snacks given,
210C_and a flash, and no room change. With 2 given,ROOM_P08_Magic_Mirror_Room. - The mirror room:
- opening
310_,HOTSPOT5hit 0, the skull hit 0, and the hum; HOTSPOT2:310X1_,310X2_,310X1_;HOTSPOT3:HOTSPOT3_(held);HOTSPOT4:310X2_,310XA2_,310XA3_,310X2_;CAM1to the mirror room throughmovie 32,CAM4toROOM_Wizards_Skullthroughmovie 30.
- opening
The rest matches the WP-109 run (
72eb819) except for the per-run random keys. 18 warnings in both, and no build warnings in the engine. The older gallery lines are unchanged: they never timed the hang, which is how it went unseen. - Entry:
- What I got wrong first. The check waited for
210B_to end without skipping it. A line runs on the clock, so it never ended in a check’s fast ticks. The check now skips it once it has seen no flash while it plays. - Live (session). A start profile with the Jester met (
Suspect0=JESTER). The first hover sweep missed the small ball: its 1,200 moves all landed in one second, so the hover was sampled once per frame. A second sweep waited after each move and placed the ball at (462, 414).- The red ball: the log has
royal gallery: the red ball found, the ball claimed and not built on re-entry, andANIM_JESTER_ATAKES_RED. The screenshots show the ball and no Jester before, and the Jester and no ball after. - The mirror: picked from the toolbar and used on the mirror. The log
has
Shaggy hangs the mirror, and about 3.5 seconds laterthe mirror hungand210B_. The snack box flashes after210B_ends at tick 1238. The screenshots show Shaggy at the mirror putting it up, and then the mirror hung.
- The red ball: the log has
Deliverables
- Fork:
wp-110-royal-gallery, PR barefootbetters/scummvm#34 (554ce7b57c), merged on 2026-11-28 as077cae1d1b; the fork worktree is removed, andC:\dev\scummvmwas rebuilt from it. Staged by name:gallery_rooms.h,gallery_rooms.cpp,gallery_check.cpp. - Docs: this packet, its pre-flight, the pointer in WP-072, the corrections in
scooby-exe.md, and the index row. - Local only: the self-test and live logs, the screenshots, the start profile, and the expected text.