WP-029: Each room’s own setup, and Town Center (Gen 1)
Status: ✅ Done (2026-11-14)
Phase: 3 (game logic: the story rooms)
Depends on: WP-024 ✅ (snacks), WP-026 ✅ (the profile), WP-027 ✅ (room classes), WP-028 ✅ (the story’s values: MoaningActive)
Companion EC: none (inline checklist under Exit criteria)
Estimated effort: Day
Pre-flight: pre-flight-WP-029-2026-11-14
Result (2026-11-14)
Exit criteria:
- Every room’s music and opening: ✅
- Town Center against the trace: ✅
- Live, Showdown: ✅
start_room=ROOM_P01_Town_Center, driven by the engine’stest_script, with real Escape key events (key 27):- The opening held input and started on tick 100; Escape skipped it.
- The exit gave
Town_Center.100A_, the toolbar came in, and the snack box flashed. - Scooby ate the snack.
- The hanging sign came down, and Scooby carried the sign into the toolbar.
- The exit then walked the gang to Street 3, whose opening
Street_3.320A_started on tick 100. - Nine frames were captured from the screen.
- Build and regressions: ✅
Deviations and gaps:
- The music never rotates on its own. Every music clip has the loop flag, so
0x409CB3’s “clip over” never comes. The rotation runs as traced; the check forces it by stopping the clip. - Follow-up fork commit
1f002172c4makes the Town Center check identical from run to run. The idle chatter and the snack-given line come fromrand(), so the check now reports what the trace fixes, not which line was drawn. The WP-001 session spotted it. - Not done: the game’s idle time restarting when Scooby takes the sign (
0x436810, game+0x34/+0x3C, not modelled). - Not traced: the music during scenes. Every scene start calls
0x434F10(90, 2)(0x40B400). Every scene end calls0x434F30(100, 4)(0x40C810), and the room load calls0x434F30(100, 3). These are probably the music fading down and back. The fork’s music stays level. Traced and modelled in WP-032: a fade one percent at a time. - Not traced: the idle line’s name (
+0x28,0x40CB50), and which of its two factory scenes the Credits room keeps as its opening. - Background music isn’t “the sound”. The fork’s log and the menu check follow the clip played last. Room music doesn’t become it, or the music restarting after a check stops every sound would hide the button’s sound.
- Walk-ins checked from Street 1 only. Velma’s (Street 2) and Shaggy’s (Street 3) are the same code with another character and direction.
- The other story rooms are next, a few rooms a packet: Showdown’s streets (
P03,P04,P11) first.
Goal
Give every room the setup its class gives it in the original, and play the first story room, Showdown’s Town Center, as its class has it. This is the groundwork every later story room builds on.
Background
Every room is an object the factory builds at startup (Showdown
0x42E0E0). Each class constructor passes two strings to the base
constructor (0x40B0F0), and its reset (vtable +0x08) can set a third
value:
- Music (
+0x68). A number picks a music group: entry (0x40B920→0x40AA10) playsGroup<g>_<n>.Music, and the next variantneach time the group changes (game+0x1E4), wrapping to 1 when the name is missing. A name plays that clip. Rooms without a class pass an empty string and keep the music that was playing. While a group is current, the game’s update picks the next variant when the clip ends (0x409CB3). - The opening scene (
+0x78). At entry (vtable+0x3C,0x40C7B0), if it isn’t played and a character here has its first line (0x40C6C0), input is held and the cursor fades. Otherwise it counts as played. The room’s tick (0x40B490) starts it, blocking, 100 ticks (+0x74) after the room was built, once no scene is playing and no exit is parked. Input slot 5 skips it (+0x28). Played (+0x10) is saved as the room’sOpeningPlayed. Entering any room fromROOM_Ghost_Spotmakes its opening one ofGlobal.Ghost_Spot[B|C]_, not yet played. - Snacks needed (
+0x24, 0 unless the reset sets it). Each snack eaten here counts (+0x88, saved asSnacksGiven). The snack-given line plays only once the count reaches the number needed. - Idle chatter (vtable
+0x34). Every 25–54 seconds with no scene and the opening played (or none), the tick calls it. The base class does nothing; Town Center’s plays one of its100Bscenes.
The setup of every room of both titles, from the trace, is in scooby-exe.
Town Center (0x42CFD0, vtable 0x45F300):
- Reset: one snack needed; the moan timer at 36 ticks.
- Entry from Street 1, Street 2 or Street 3: Fred walks
UL, VelmaU, or ShaggyUR(character state 1). - Placements: the sign (
OBJ_INV_SIGN) becomes a requires object in layer 1, unless it was ever taken, and stays hidden until the hanging sign (OBJ_P01_TC_HOTSPOT4, a clickable in layer 1) is clicked.OBJ_P01_TC_HOTSPOT2is a clickable in its own layer. - Events: the hanging sign sets
SignClicked(saved). The sign clicked with the arrow starts Scooby taking it. - Tick: with the story’s
MoaningActive, a moan every 5–14 seconds. When the hanging sign’s click is over, the sign shows and sceneTown_Center.307_plays. At step 7 ofANIM_P01_TC_HOTSPOT2C, Daphne, Scooby and Shaggy go to state 17. Scooby taking the sign: once he is idle and no scene plays, he hides behindANIM_SCOOBY_P01_TAKES_SIGN1withScooby_Takes_Sign, input held. When it ends, the sign is in the toolbar and sceneTown_Center.360C_plays. - Exit: until Scooby has eaten a snack here, an exit plays
Town_Center.100A_,100A2_,100A3_in turn and flashes the snack box instead of leaving. - Idle chatter: one of
Town_Center.100B_,100B2_,100B3_(withMoaningActive) or1100D_.
Scope
In scope (fork, engines/scooby/ only):
- A setup table for every room of Showdown and Phantom: music, opening scene, snacks needed.
- Music on entry and the variant rotation; the opening scene, its delay and
skip; snacks needed and given; the idle chatter timer;
OpeningPlayedandSnacksGivenin each room’s profile section. RoomClasshooks the story rooms need: reset, an object’s event, claiming a placement, the exit, idle chatter, and the room’s profile keys.- Town Center’s class.
- A
scriptlevel 3 check.
Out of scope: every other story room; the Credits room’s opening (its factory passes two scenes, not traced).
Exit criteria
- Every room of both titles: the music played on entry and the opening scene match a reference that reads the trace output and the sound files, not the engine’s table.
- Town Center from a new game, against the trace: the opening at tick
100; exits blocked, rotating scenes, until a snack; the snack-given
line; the hanging sign, the sign, Scooby taking it, the item and the
scenes;
SignClicked,OpeningPlayedandSnacksGivensaved and read back. - Live, in Showdown: Town Center’s opening, the blocked exit, feeding Scooby, and the sign into the toolbar.
- Scooby-only build: 0 errors and 0 warnings. The earlier checks pass.
The fork diff stays inside
engines/scooby/, staged by name.
Deliverables
- Fork commit on
scooby-engine. - scooby-exe: each room’s setup, and Town Center.
- WORK_INDEX row and findings line.