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 📝 on main (cf1c706), no WP-142 branch in either repository, and no open PR naming WP-142. Both claim branches were pushed before anything else.


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

Source read

On 168ae21c7d:

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.

  1. 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 with tip_pre:
    • tip_a03 to tip_a24 and tip_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_c12 to tip_c24 and tip_c_rest: the window dark again. The screen surface the shots read (lockScreen()) is the one drawRoom() copies the room to, and every one of the cavern’s ticks draws (source read above).
  2. 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.
  3. 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.
  4. 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.
  5. 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_a03 and ruby_a14 show the window lit, ruby_b12 and ruby_b25 the bat, ruby_c_rest the 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.
  6. When Jeff reported it: before HOTSPOT2 was clicked. WP-087’s session transcript and run1.log were 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

Prepared by: Claude (WP-142 execution session) Date: 2026-12-03

Lessons learned