Pre-Flight — WP-142 — 2026-12-03
Filled-in copy of docs/reference/pre-flight for WP-142. Verdict at the bottom.
Written by the execution session, from the session prompt
docs/sessions/session-WP-142-2026-12-03.md(merged in #381). Checked at claim time: WP-142 is 📝 onmain(cf1c706), noWP-142branch in either repository, and no open PR naming WP-142. Both claim branches were pushed before anything else.
Header
- WP:
WP-142 - Title: The Mermaid’s Cavern hotspot’s animation doesn’t show (Gen 1)
- Pre-flight date:
2026-12-03 - Targets generation(s): 1
- Targets disc(s): Phantom
Dependency check
| Prereq | Status in WORK_INDEX |
Notes |
|---|---|---|
| WP-078 | ✅ Done (2026-11-19) | The room, MermaidsCavernRoom. |
| WP-100 | ✅ Done (2026-11-28) | The cavern played through the engine’s mouse and tick; the princess check play lines. |
Rule check: every prereq is ✅ Done.
Repo + disc state
- Docs repo: branch
docs/wp-142-cavern-hotspot-animationcut fromorigin/main @ cf1c706, pushed at once. - Fork worktree, the claim:
tools/New-ForkWorktree.ps1 -Branch wp-142-cavern-hotspot-animation→C:\claude-worktrees\scummvm-wp-142-cavern-hotspot-animation, forked fromorigin/scooby-engine @ 168ae21c7d(the merge of fork PR #69, WP-141), pushed at once. - No draw-path file changed since WP-087’s live build:
git diff --stat c1f2825762 168ae21c7dtouches none ofroom.cpp,cel.cpp,room_script.cpp,princess_rooms.cpporterraglyph.cpp. The tip draws the cavern as Jeff’s run did. - Build: MSYS2 UCRT64,
../configure --disable-all-engines --enable-engine=terraglyphthenmake, out of tree in the worktree’sbuild-tg/. - Game files:
C:\dev\scooby-engine\tools\exes\phantom(local, gitignored). - Logs, configs and shots:
C:\pcloud\scooby-engine\verification\wp-142-2026-12-03\.
Source read
On 168ae21c7d:
princess_rooms.h:74–90:MermaidsCavernRoomoverridesevent()andisEcho()only, noclaimPlacement(). pre-flight-WP-078 diffed vtable0x45EA1Cagainst the base room’s0x45E5FC: the cavern overrides event only. HOTSPOT2 is built by the default path.room.cpp:355–360,getPlacementKind(): aclickableobjectgoes underlayer=(0 when missing) atpriority=(−1 when missing).OBJECT.INIgives[OBJ_P21_MERMAID_HOTSPOT2]onlyID=clickableobject, so it sits under layer 0 at depth −1. The self-test’s order puts it behind the five characters and the hidden ghost, in front of the ruby, the exit and layer 0.room_script.cpp:402–445,tickClickable(): the click starts the state’s sequence once at 3 ticks a step, plays its sound and moves the state on. When the sprite stops, the clickable rests on step 0 of the next state.room.cpp:861–877,Room::draw(): back to front, skipping a hidden sprite or one without a block.cel.cpp:214–232,Cel::draw(): mask A opaque, mask B blended as ARGB4444, the rest skipped.terraglyph.cpp:249–316, the run loop: a room with a class setschangedon every tick it owes, so the room is drawn and copied to the screen every frame that owes a tick. The cavern has a class.
The art: what each state plays
Read from TGIFILE.ART (object 239 at 0x2d65000: 3 sequences, 24 frames, 24 cels; one cel per frame). The click lines name the state, and the step counts (A 6, B 18, C 6) match the sequences:
| State | Steps | Cels, in order, at (x, y) | What it is |
|---|---|---|---|
| A | 6 | 0 → 5 at (546–547, 26–29) | The window at the top right lights up (cels 0–5, about 16×71). |
| B | 18 | 6 at (6, 29); 7 → 22 from (543, 29) to (1, 29); 23 at (4, 29) | A bat leaves the lit window and crosses the top of the cavern to the left edge. Cels 6 and 23 (556×448, 558×448) are transparent but for the lit window and a mark a few pixels wide at the bottom left; inside rows 0–149 they draw the same pixels. |
| C | 6 | 5 → 0 | The window goes dark. |
The rests follow from tickClickable(): after A, B’s step 0 (cel 6, the window lit); after B, C’s step 0 (cel 5, lit); after C, A’s step 0 (cel 0, dark). Every cel of every state lies in rows 26–143, but for the bottom-left mark of cels 6 and 23.
OBJ_P21_MERMAID_HOTSPOT3 (object 240, 196 bytes): cel table count 0, three one-step sequences on one frame with no cel entry, and one 14-point hit polygon. It’s a sound-only spot on the disc.
Scope lock
fork: engines/terraglyph/princess_rooms.cpp
engines/terraglyph/princess_rooms.h
engines/terraglyph/princess_check.cpp
engines/terraglyph/room.cpp, room.h (only if the cause is in the draw)
engines/terraglyph/terraglyph.cpp (only for the self-test frame line)
docs: docs/reference/pre-flight-WP-142-2026-12-03.md
docs/work-packets/WP-142-cavern-hotspot-animation.md
docs/work-packets/WORK_INDEX.md
Staged by name; git diff --cached --name-only checked against this list before each commit. Forbidden: game data, logs, BMPs or captures in any repo; a change to another room’s claims or draw order; moving HOTSPOT2 anywhere the decompile doesn’t put it.
Risk review
| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| A self-test that can’t see pixels. | high (it was so) | high | The new line draws the real cavern, with its class and characters, through Room::draw() on every tick, and hashes the rows HOTSPOT2’s cels occupy. |
| Fixing what isn’t broken. | med | high | The capture came first (below). It shows the animation drawn, so nothing in the draw changes; the finding and the live re-check go to Jeff. |
| The cursor or the characters in the hashed band. | low | med | The check moves the mouse to (320, 300) after each click. The band is rows 0–149; the characters stand below row 280 and the ghost is hidden. |
| A shared cause. | — | — | None found: the draw path is the one every room uses, and it draws this object. |
Diagnosis
Captured on the unchanged tip 168ae21c7d, start_room=ROOM_P21_Mermaids_Cavern, --debugflags=script,input,graphics --debuglevel=2. The click point came from the hit test: a sweep of scripted moves (sweep.log) logs hover 9 OBJ_P21_MERMAID_HOTSPOT2 from x 548 to 563 on rows 30–90, so every click is at (552, 60). Shots every 30 ms. All of it is live — session.
- The frame (lead 3): the animation reaches the screen.
capture-tip.log: the clicks at ticks 475, 531 and 638 play A, B and C (steps 6,18,6) and rest on B, C and A. The shots, compared withtip_pre:tip_a03totip_a24andtip_a_rest: the window at (547–562, 30–98) lit yellow.tip_b08,tip_b12,tip_b20,tip_b25,tip_b29,tip_b33,tip_b34: the bat at the window, then at x 417, 214, 111, 52, 36 and 11 along rows 30–135.tip_c12totip_c24andtip_c_rest: the window dark again. The screen surface the shots read (lockScreen()) is the onedrawRoom()copies the room to, and every one of the cavern’s ticks draws (source read above).
- Draw order (lead 1): ruled out. Nothing drawn in front of HOTSPOT2 reaches its rows: the characters stand below row 280, the ghost is hidden, HOTSPOT3 has no cel, and HOTSPOT1 draws nothing at rest (step 0 of each of its three sequences is a frame with no cel). The shots show the window and the bat whole, over layer 0.
- Its place (lead 2): ruled out. The cels land at (1–563, 26–143), inside the 640×480 room and far above the toolbar. The art table above gives each step’s position.
- The pixels (lead 4): ruled out. The cels draw as opaque yellow and a dark bat. Cels 6 and 23, the only large ones, are transparent but for the window and a small mark, so nothing large draws invisibly.
- Jeff’s order of play, repeated: the same.
capture-ruby.log,shots-ruby: the ruby picked up first (the cavern entered again, the toolbar open), HOTSPOT3 clicked twice, then HOTSPOT2 for A, B and C.ruby_a03andruby_a14show the window lit,ruby_b12andruby_b25the bat,ruby_c_restthe window dark. With the pointer left on the spot (capture-stay.log), it covers the middle of the window and the rest still shows (stay_a03,stay_a14). That run’s third click brought the ghost (the ghost appears at tick 639, the 1-in-30 draw), not C. - When Jeff reported it: before HOTSPOT2 was clicked. WP-087’s session transcript and
run1.logwere stamped by the same machine’s clock. Jeff’s message “animations don’t show with clicks”, with a screenshot of the cavern, was sent at 20:38:00. The log’s clickable lines before that moment are the two on HOTSPOT3 (20:37:26, 20:37:27). The first HOTSPOT2 click is at 20:38:03. His screenshot (Screenshot 2026-12-02 203744.png, 20:37:44) shows the window dark, as HOTSPOT2’s resting step 0 draws it before any click. His answer at 20:40:33, “only this cavern, the one that should animate”, came after the three HOTSPOT2 clicks. It answered “which spot did you click” and doesn’t say whether he saw the window or the bat.
My reading: the report most likely came from HOTSPOT3. That spot plays a sound and shows nothing, because the disc gives it no cel. HOTSPOT2’s animation is small: a 16-pixel window lit at the top right and a dark bat crossing the cavern’s top. The port draws it, and in Jeff’s order of play too. Whether he saw it when he clicked it at 20:38:03 isn’t on record; that’s the live check below.
The new self-test line
The self-test never drew this room: checkAllClickables() runs on a standalone Room with no draw(). A new line in princess_check.cpp plays HOTSPOT2 through the engine’s mouse and tick in the real cavern, with its class and characters, as the princess check play lines do. It draws the room through Room::draw() after every tick, and hashes rows 0–149 of the frame: every HOTSPOT2 cel lies there, and nothing else in the room moves there.
Format, and why: per state, the step count, the ticks until it rests and the state it rests on, the number of distinct frames of the band from the frame before the click to the rest, and whether the rest differs from the frame before the click. If the cels didn’t reach the room’s pixels (hidden, covered, off the band, invisible), every state would read 1 distinct frames and the rest 0. Counts, not hashes, so the line reads plainly and doesn’t move when a cel’s colour does.
Predicted, written from the art and the source before the first run:
princess check play cavern hotspot2: from ANIM_P21_MERMAID_HOTSPOT2A; A 6 steps, rests after 18 ticks on ANIM_P21_MERMAID_HOTSPOT2B, 7 distinct frames of rows 0-149, the rest 1; B 18 steps, rests after 54 ticks on ANIM_P21_MERMAID_HOTSPOT2C, 18 distinct frames of rows 0-149, the rest 1; C 6 steps, rests after 18 ticks on ANIM_P21_MERMAID_HOTSPOT2A, 6 distinct frames of rows 0-149, the rest 1
A: cels 0–5 and the rest’s cel 6, 7 frames. B: cels 6–22 (23 draws as 6) and the rest’s cel 5, 18 frames. C: cels 5–0, the rest cel 0, 6 frames. Ticks are 3 a step, as the existing click … rest 18 and rest 54 lines show.
Other lines: every existing self-test line is predicted unchanged, since no behaviour changes. The new check adds the input and script lines its own play writes (click at, clickable … clicked, rests on, the cavern’s draw order and drawn lines), all after princess check play cavern. It draws no random number: the ghost’s chance is off for the princess checks and the idles have no source during the checks.
It can’t fail on the unfixed tree: the tip isn’t broken. To show the line would catch a missing animation, it’s also run once on a scratch build with HOTSPOT2 hidden, which isn’t committed; there every state should read 1 distinct frames … the rest 0.
Verdict
- READY with a named fix
- FINDING: the port draws HOTSPOT2’s animation, in all three states and in Jeff’s order of play. No engine change; the fork PR adds the self-test line only. Jeff’s live re-check (exit criterion 2) decides the close. See WP-142 §Result.
Prepared by: Claude (WP-142 execution session) Date: 2026-12-03
Lessons learned
- Check when the report was made against the log. Jeff’s words were read as about HOTSPOT2 because it was the spot with cels. Their timestamp, next to the log’s, put the report three seconds before HOTSPOT2 was first clicked and after two clicks on a spot with no picture. When a live symptom is quoted, line the message’s time up with the log before choosing the object to diagnose.
- One prediction was wrong. I predicted the check drew no random number.
Entering a room draws its idle delay from the game’s random source
(
RoomScript::restartIdle()), so the new check’s room entry moved the WFR’sfirst danceline in the first seeded run. The check now saves the source’s seed and restores it, and every other check line matches. A check that enters a room shifts every later random draw unless it puts the source back. - A check that can’t fail on the tip needs a control. With no defect to
fix, “fails before, passes after” can’t be shown. A scratch build that hides
the sprite (not committed) shows the line reads
1 distinct frames … the rest 0when an animation plays by the log but isn’t drawn. - The predicted line held. All three states read exactly as written from the art: 7, 18 and 6 distinct frames, with cels 6 and 23 drawing the same pixels in the band.