WP-122: Phantom’s Maria game, played (Gen 1)
Status: ✅ Done (2026-11-29). Fork PR barefootbetters/scummvm#47 merged on 2026-11-29 (merge commit 900e4aa6b3).
Phase: 5 (rooms played)
Depends on: WP-064 ✅ (the port of the game), WP-116 ✅ (handleEvent())
Companion EC: none (inline checklist under Exit criteria)
Pre-flight: pre-flight-WP-122-2026-11-29. Required: the packet modifies engines/terraglyph/**.
Targets generation(s): Gen 1, Phantom of the Knight only.
Estimated effort: Two hours
Goal
Play Maria’s game (ROOM_Maria, 0x428770, vtable 0x45F2C0) through the
engine’s own event path, against the decompile, and fix what differs.
WP-064 ported the game. Its check set the mouse’s
position and called the room class’s click() directly. It’s the fifth of the
11 checks that click through a class or script function, after the drawbridge,
the room of doors, the throne room and the dining room (WP-117, WP-119–121).
What the decompile says
- The input object (
DAT_00474d9c):+0x1Cand+0x1Ethe mouse, and+0x20its flags. Bit 1 is the button held, bit 2 went down this frame, bit 4 came up this frame. - An item’s update (
0x427CD0):- Resting and not carried: it’s taken when it’s under the mouse
(
+0x08), the button came up this frame (bit 4), and it may be taken (0x4292D0). Taken, the cursor hides at once (0x435E80with 0). - Carried: it follows the mouse. It’s let go when the button came up
this frame, anywhere, and the cursor shows at once (
0x435EF0with 0). Above its floor, it falls into the tray under it or is thrown at 0.2 × the last frame’s move. - So a click is a release. A press and release on one spot takes an item, and the next one lets it go. A drag that ends off the item takes nothing: on the release, the item isn’t under the mouse.
- Resting and not carried: it’s taken when it’s under the mouse
(
What differed
One thing, in the engine and the class. The fork took and let go on the
press: the room class’s click(), which the engine calls when the button
goes down. WP-064 listed this as a deviation. A click on one spot played the
same, but a drag didn’t. Down on a cup, moved away, up: the fork carried the
cup, where the original takes nothing. Now:
- a room class can take the button coming up over a sprite
(
RoomClass::release()); - the engine calls it from the run loop’s button-up event
(
TerraglyphEngine::handleRelease()), unless input is held; - the test script’s
click, which is the press and the release on one spot, calls it too; - Maria’s class takes and lets go in
release(). Itsclick()still takes the press on an item, or anywhere while one is carried, so nothing else answers it; - WP-064’s check calls
release()where it calledclick(), and its lines are unchanged.
Scope
In scope:
- Fork:
room_class.h,terraglyph.{h,cpp}(the release),maria_rooms.{h,cpp}(the items on the release),maria_check.cpp(the played section, and WP-064’s calls). - Docs: this packet, its pre-flight, the note in scooby-exe, a pointer in WP-064, and the index row.
Exit criteria
- Expectations first. The new lines were written from the decompile before the run.
- Self-test. The new lines match the decompile, with the check slips corrected (below). The rest matches the WP-121 run except for the per-run random keys; WP-064’s Maria lines are unchanged. No new warnings.
- Live. A scripted run takes a cup on the release, throws it, drags another without taking it, and drops one into a tray.
- Process. The fork PR against
scooby-engineis open (merged on 2026-11-29).
Result
Evidence labels: log (a self-test’s debug log), live (session) (a scripted run this session drove and read, with screenshots).
- The fix (source). On
wp-122-maria-game(5d2ff3781e):room_class.h,terraglyph.{h,cpp},maria_rooms.{h,cpp},maria_check.cpp. - Self-test (log). The events go through
handleEvent().- Entry from the dining room: Maria
HAPPYon step 2; the open hand on an item,ANIM_CURSORELon the way out, and the arrow on Maria. - The first run, before the fix, showed the gap: down on a cup, moved off it, up, and the cup was still carried.
- After the fix:
- a press on a cup: nothing carried;
- the release: carried, with no cursor;
- carried up and left, and let go in the tick of the last move: thrown
at (−4, −3),
SPIN,Maria.Throw, and the arrow back; - a drag (down on a cup, two moves off it, up): nothing carried, the cup where it lay;
- a cup carried over the first tray and let go: in pan 1 at tick 22,
and Maria
EXCITEDon step 1.
The rest matches the WP-121 run (
6a6f12487e), except for the per-run random keys (the drawbridge’s states and flag points, Ewan’s question, the room of doors’ ways, the screams in the gardener’s house and the armory). WP-064’s ten Maria lines are unchanged. 18 warnings in both runs, and no build warnings inengines/terraglyph. - Entry from the dining room: Maria
- What I got wrong first. Nothing in the expectations; the drag gap was
expected. Two slips in the check:
- The cursor while carrying was read without a mouse move after the tick, so it showed the cursor from before. The check now moves the mouse first.
- The throw was let go a tick after the last move, so it had no speed. A throw needs the move and the release in the same frame, as in the original.
- Live (session). With
random_seed=12345, so the items lie in known places; entered from the dining room:- the open hand over a cup;
- a press on it: the screenshot shows the cup still on the floor and the cursor drawn;
- the release: “MARIAGAME_RB taken”, and no cursor;
- carried, then a press and a release with a move in the same frame: let go at (470, 308) with speed (−7.07, −7.07), the 10 cap, and the screenshot shows it in the air;
- a drag off another cup: nothing taken, the cup on the floor;
- a cup carried to the left tray and let go: “pan 1”, and Maria tilts to steps 1 and 0. The screenshot shows it in the tray.
A first live run let go a tick after the last move (no speed) and aimed the tray without the item’s offset (it missed). Both were the script.
Deliverables
- Fork:
wp-122-maria-game, PR barefootbetters/scummvm#47 (5d2ff3781e), merged on 2026-11-29 as900e4aa6b3; the fork worktree is removed, andC:\dev\scummvmwas rebuilt from it. Staged by name:room_class.h,terraglyph.h,terraglyph.cpp,maria_rooms.h,maria_rooms.cpp,maria_check.cpp. - Docs: this packet, its pre-flight, the note in scooby-exe (the click is the release), the pointer in WP-064, and the index row.
- Local only: the self-test and live logs, the screenshots, the profile, and the expected text.