WP-116: Phantom’s Knights of the Snack Table, played (Gen 1)
Status: ✅ Done (2026-11-29). Fork PR barefootbetters/scummvm#41 merged on 2026-11-29 (merge commit 0c4c18ec59).
Phase: 5 (rooms played)
Depends on: WP-073 ✅ (the room’s claim and entry), WP-090 ✅ (the serving game), WP-115 ✅ (the cursor through a scene’s hold)
Companion EC: none (inline checklist under Exit criteria)
Pre-flight: pre-flight-WP-116-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 Knights of the Snack Table (ROOM_P31_KST, 0x419700, vtable
0x45EDEC) through the engine’s own event path, against the decompile, and
fix what differs.
WP-090 ported the serving game, and its check plays it through the engine’s tick. But it set the mouse’s position and button fields directly, never through the events the run loop takes. It’s the room after the five Phantom groups whose checks never clicked (WP-110–112, WP-114, WP-115).
What the decompile says
- The claim (
0x41A970) takesOBJ_KST_SHAGGY,OBJ_KST_KNIGHT1,OBJ_KST_OVERLAY1–3,OBJ_KST_MUGand the counter digits. Everything else falls to the default path,OBJ_KST_EXITincluded: an exit (depth −1000) to the dining room, withANIM_CURSORERas its rollover. - The room has no event or click handler of its own (vtable
+0x14is the base’s empty0x404440). Its exit handler is the default0x40C1E0. - Shaggy (
0x419370) reads the mouse’s y (game+0x1E) and whether the button is held (game+0x20bit 1). Both are set each frame from the mouse (0x4359C0). - The cursor. Every tick, after the base tick and before anything else,
0x419E40sets it from the cursor’s y: shown at once at y ≤ 100 (0x435EF0with 0), else hidden at once (0x435E80with 0). Nothing gates this on a scene or the opening. So it wins over the fade of a blocking scene and of the opening’s hold (0x40B400,0x40C7B0), which happen earlier in the same tick.
What differed
The room class matched the decompile. WP-090’s port holds.
One gap was in the engine, and WP-115 made it. WP-115 hid the cursor whenever the room’s script held input. That’s right for most rooms, but the KST’s tick shows it again in the top 100 rows every tick. With WP-115’s change the cursor was hidden there through the opening. Now:
- a room class can say it sets the cursor every tick
(
RoomClass::setsCursor()); - for such a class, the run loop and a mouse move keep following the mouse
while input is held (
terraglyph.cpp); - the KST says so (
kst_rooms.h).
The fork still has no fade. Which cursor the original draws during the hold (the arrow, or a rollover) isn’t traced. The fork shows what the hover gives, so the arrow away from the exit.
A refactor with no change in behaviour. The run loop’s handling of one
host event (the mouse, the button, the skip keys) is now
TerraglyphEngine::handleEvent(), so the check feeds the path a real mouse
does.
Scope
In scope:
- Fork:
kst_check.cpp(the played section),room_class.h,kst_rooms.h,terraglyph.{h,cpp}. - Docs: this packet, its pre-flight, the corrections in scooby-exe, pointers in WP-073 and WP-090, 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 slip corrected (below). The rest matches the WP-115 run except for the per-run random keys; WP-090’s KST lines are unchanged. No new warnings.
- Live. A scripted run shows the cursor through the opening by its row, serves a mug with the button, and leaves by the exit.
- 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-116-kst(3a0b86642e):room_class.h,kst_rooms.h,terraglyph.{h,cpp}, and a section at the end ofcheckKST. - Self-test (log). The events go through
handleEvent(), andrand()is pinned to 1.- Entry from the dining room, level 0:
- the opening
Knights_of_the_Snack_Table.350X_held, and the narrator holding; - through it, the cursor at y 50 is the arrow, and at y 300 there’s none;
- a press on the top row meanwhile leaves Shaggy free;
- the hold is over 92 ticks later, with the scene skipped as it starts. Then the same: the arrow at y 50, none at y 300.
- the opening
- The hovers:
OBJ_KST_EXITat (609, 6) showsANIM_CURSORER;- the counter’s row shows the arrow;
- Shaggy can’t be hit.
- Shaggy after the mouse: to the bottom bench with
ANIM_KST_SHAGGYWALK_FORWARD(19 ticks), back to the top withANIM_KST_SHAGGYWALK_AWAY(19 ticks). - A round served with the button down at the top row and up once full:
- the mug slid at tick 14 and taken at 73;
- the knight at the door at 219, and the empty caught at 319;
- served at 319: 1 snack, 5 mugs, no scene, no room change, and
Correct2_NARRATORheard.
These are WP-090’s ticks less one: in this run the tick that ends the hold also starts the round.
- The way out: a click on
OBJ_KST_EXITplays no scene and goes toROOM_P12_Dining_Roomwith movie −1, 5 mugs left.
The rest matches the WP-115 run (
484cb947c5), except for the per-run random keys (the drawbridge, Ewan’s question, the screams in the gardener’s house and the armory). WP-090’s KST lines are unchanged. 18 warnings in both runs, and no build warnings inengines/terraglyph. - Entry from the dining room, level 0:
- What I got wrong first.
- The cursor through the opening. I expected the fork to hide it in the top rows, because of WP-115, and it did. That’s the gap above.
- A check slip. The first run’s harness ended only the narrator’s hold, not the opening. The script still held input, so the hovers read no cursor and the click on the exit was ignored. The harness now runs the hold out the way the game does.
- Live (session). Started in the KST:
- through the opening, the arrow at the top and no cursor at y 300 (the screenshots agree);
- with the mouse on the top row, a press and release about a second into the game: Shaggy slides a mug. The knight takes it at x 194.5 and drinks back to the door, and Shaggy catches the empty;
- that knight then walked again from the door instead of leaving (the
original’s 1 in 3;
rand()isn’t pinned live) and reached the tap. The log has a mug lost and no new knight walking in; ANIM_CURSORERover the exit, the shield in the top right corner (the screenshot shows the pointing hand on it), and a click goes to the dining room.
A first live run pressed just as the first knight reached the tap. The miss paused the room, so the press did nothing. The script was too slow, not the engine.
Found on the way
- WP-073’s “no clickable way out” was wrong. The exit is in the room and answers the mouse at any time. A pointer in WP-073 now says so.
- Other rooms may set the cursor every tick, too. Brad’s game shows and
hides it (
0x435EF0/0x435E80). If its tick does that every tick, it should saysetsCursor()as well. That’s for when Brad’s room is played.
Deliverables
- Fork:
wp-116-kst, PR barefootbetters/scummvm#41 (3a0b86642e), merged on 2026-11-29 as0c4c18ec59; the fork worktree is removed, andC:\dev\scummvmwas rebuilt from it. Staged by name:kst_check.cpp,kst_rooms.h,room_class.h,terraglyph.h,terraglyph.cpp. - Docs: this packet, its pre-flight, the corrections in scooby-exe (the KST’s cursor rule over a hold, and its exit), the pointers in WP-073 and WP-090, and the index row.
- Local only: the self-test and live logs, the screenshots, and the expected text.