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’s isBusy already covered the hanging. The hidesCursor override 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

  1. 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 0 on the tick after the use.
  2. The red ball and the Jester (0x4168D0). The ball is built only while it is not found and the Jester has been met: 0x40A930 looks the name up in the suspects met, game +0x174, which is the fork’s hasMetSuspect. A placement whose first ten characters are OBJ_JESTER is 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.
  3. 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.

  4. The snack box flash. 210B_ is started with +0xC2 as its done flag (0x40B400), so the snack box flashes on the tick after the line ends. The fork flashed it as the line started.
  5. The cursor. Every tick while the mirror is being hung hides it (0x435E80) as well as holding input. The fork only held input.
  6. The mirror room’s sprites (0x415060). HOTSPOT5 and OBJ_P08_TO_WIZARDS_SKULL are 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:

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

  1. 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.
  2. Fixed. All six.
  3. 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.
  4. 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.
  5. Process. The fork PR against scooby-engine is 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).

Deliverables