Entry 393
Mutation's Shop Keeper stands at his marker: an event's entry 4 is the Administrator's ccMerchan, and every town NPC entry is made by its row's class
Documented in Entering The World - Kite in Mac Anu.
Linked from Mutation's walking PCs: the later class, its SEARCH PCs and the Flag Race's hiding, and the Event NPC.
Files14 in 9 directories
lib.rsevent.rsnpc.rsmerchant.rsfield_npcs.rscrates/piney-world/tests/world.rscrates/piney-world/examples/world_probe.rscrates/piney-game/src/session.rscrates/piney-game/src/session/tests/shop_keeper.rstools/test_world_rs.pydocs/engine/field-game.mddocs/README.mdUNKNOWNS.mdBUGS.mdMentioned inBUGS.md:160
Issue #60 (Mutation, build 4cce396): when the Shop Keeper trades Kite's
Book of Law for the Book of Absolute, his lines play but no one stands
by the gate. The port's console said events: entry 4 29 at marker 6 not placed.
The event
Event 101 (M201), the new game's, in Dun Loireag (town 1, town02):
- Block 24 ends Chosen Hopeless Nothingness's dungeon:
status_set 0 1, thenscene 0 1. - Block 25 (
in_town 1, phase 0,eventStatus[0] == 1) registersentry 4 29 6 0:npcTblrow 29, at marker 6. - Block 27 (phase 4) turns BlackRose, Kite and him to face each other,
puts the camera on him (
camera 2 29) and has him say three lines ("Shop Keeper" is the messages' speaker).item_del 15 60,item_add 15 69trade the books, andnpc_act 29 5sends him off.
Row 29 is "Administrator" on every volume: flags 0x10, CTR1.CCS,
ccEntryRtownMerchant. It is the Administrator's ccMerchan.
What the game does
ccEntryEventMng (MUT main 0x001cb990, INF 0x001b62e0), for each
registered entry:
- The bit
1 << type, 0x18, takes types 3 and 4. 0x10 (type 4) callsccSetMerchant(code)(MUT gcmn 0x00520910). In any area, a non-zero code makes only 29 or 158 (setMerchant, 0x005205c0: no dummy, the origin). - 0x08 (type 3) calls
ccSetRtownPC(code, -1)(0x00521cf0).$a1still holds the loop'sli $a1, -1(MUT 0x001cb9dc, INF 0x001b6318). That answers 65's and 132's question. - Both are an
entryObjectof type 2, which callsnpcTbl[code].entry.func. So the row picks the class:entry 3 29(Outbreak's event 209, in Fort Ouph and outside) is accMerchantoo. - If an object was made, its
pos(+0x40) anddirc(+0x60) are overwritten. A marker below 0 givesvf0for both. In a town, marker N givesmarkerEvTbl[N]'s dummy: its position and its whole rotation (w 0). Outside a town, the event position. - From Mutation on, a type 3 with
param-1 goes to a new set-up instead (0x00521e50, the SEARCH events' PCs). It is not moved to a marker. ccRegisterEventMng(MUT 0x001cc480) adds 1 toregistNpcNumfor every type 3 or 4 entry, made or not.ccRegisterRandomNpcthen makes 16 minus Kite, the party and those.
ccMerchan::main changed in Mutation (MUT gcmn 0x005210b0; Outbreak and
Quarantine are the same):
- Only the Grunt Shops (
breederAct), 29 and 158 (sysopeAct) and the new rows 175-179 (0x00521a00) act and runCollisionDetection. - The other shops do neither. Infection runs
breederActand the collision for all of them.
Cause
World::entry_npc accepted only type 3 of a row with the PC flag (0x08).
Every entry 4 in a town was refused, and so was a type 3 of a
merchant's row. The fields' event NPCs (FieldNpcs::make) chose the
class by the type, so entry 3 29 outside a town tried to build a PC
from CTR1.CCS.
Fix
- The class.
NpcRow::event_class(ty)givesEventClass::PcorMerchantfrom the row'sentry.func, or None. Type 4 makes something only for 29 and 158 (merchant::SYSOPE, now also documented asccSetMerchant's codes). The town and the fields both use it. - The town.
World::entry_npcqueues anEventEntry(class, code, marker) and counts every type 3/4 entry inregist_npc_num.place_entriesmakes them first, then extendsmerchantswithccSetMerchant(0)'s. The Administrator is first on the NPC list, as in the game. - The marker.
event::event_marker_inreturnsvf0below 0, elsemarker_dummy_in: the dummy's position and whole rotation.marker_in(the z heading) is built on it. Event PCs now take the whole rotation too, as the game copies it. - The merchant.
merchant::event_merchantisccSetMerchant(29)followed by the marker.Worldandworld_probeboth use it. - Mutation's main.
Merchant::mainrunsbreederActand the collision for every merchant on Infection only. From Mutation on it does so for the breeders and 29/158 alone.
Checked
- Reproduced and fixed.
mutations_shop_keeper_stands_at_marker_6(piney-game). It brings event 101 to the end of block 24 and logs Kite and BlackRose in to Dun Loireag. The Administrator must be first on the NPC list, at marker 6's dummy (rotation x, y, w copied; z then turned to Kite by block 27'snpc_face), withANM_ctr1nut0, and drawn while he speaks.- Before the fix it fails with
entry 4 29 not placed.
- Shots (
shop_keeper_shot, ignored):/mnt/data/claude/scratch/i60/before/mut-shop-keeper.png: Kite and BlackRose by the gate, no one else. This is the report's picture./mnt/data/claude/scratch/i60/mut-shop-keeper.png: the Shop Keeper left of Kite by the gate, as in the PS2 video, at "You are the player that won the Power Up Campaign, right?".
- Every entry.
every_event_npc_entry_makes_a_classwalks everyentry 3|4in every volume's scripts (649; each disc carries every volume's events). The area of each comes from the scene tags kept from block to block.- With the old rules, 12 a volume were not placed: 8 in towns, 4 outside.
- In towns those are
entry 4 29in events 101, 106, 107, 113, 301, 309 and 313, and Outbreak'sentry 3 29in event 209. Outside, event 209's other two and events 216 and 218. - The ones each disc plays: Mutation 4 (101, 106, 107, 113), Outbreak 6 (209 three times, 216, 218), Quarantine 3 (301, 309, 313).
- With the new rules none are refused.
- Against the game's own code (tools/test_world_rs.py,
MerchantsAgainstGame, eemu):- The new
test_event_merchantruns the game'sccEntryEventMngon aneventMngholdingentry 4 29 6, in town 1. The gate, the dogs, the Grunties and the walking PCs are left out. The port's side isworld_probe merchstartwith the town and the entries. - The two lists match: ids 29 then 5-10, positions,
posP, headings,defaultDirc, clips andhit_sw. So do 600 frames ofroutineandccMerchan::main(withsysopeAct, a talk, a farewell and a turn). - It passes on Mutation and Infection.
- The harness's entry control now has the town as its
areaNum(initObjectcompares it). Town 0 had hidden this. test_merchantsnow also passes on Mutation. Before the main fix it differed at frame 0 inactProcessand the collision offset. Its "touching" and talk-clip coverage is Infection's only.- Outbreak's harness module does not load
(
__vt__10ROOTTOWN01has no carry), as before.
- The new
the_entry_controls_set_up(piney-world) now registers the Administrator at marker 5 and anentry 4 40that makes nothing. The merchants are 29, 0-4. The walking PCs are 13: the event PC and 12 chosen with all three entries counted.- piney-game's suite (four threads), piney-world's tests, clippy on
piney-world and piney-game, fmt,
cairns checkandtools/docs.py checkpass.
two later-volume pieces this work turned up. Both are in the repo's reach but are features of their own.
- Mutation's
ccRtownPC(MUT gcmn 0x00522040, 740 bytes longer than Infection's;mainandnormalModediffer too) is not ported. The differences:- the walking PCs' body kind is 8 (Infection 2);
rtpcCcsNamehas 50 names;- rows 159 and up have texture tables of their own;
- the SEARCH PCs'
entry 3 CODE MARKER -1set-up (0x00521e50: a landmark or a dummy, from tables 0x0061c890 and 0x0061c8c0, bysaveData+0x6483+row, thenparam1 and the state) is not ported. The port stands them at their marker. The SEARCH chain plays on Outbreak.
- From Mutation on,
ccSetMerchant(0)also makes row 175 + town ("Event NPC", flags 0x10000000) whensaveData+0x652cis set. It has its own act (0x00521a00) and affect (0x00521990). The port makes none, and what sets the byte is not traced.