Stage destruction: support chains and the collapse family

Continues “Stage objects: other families”. Read from the executable (the link pass, the link tests of every component, the support-lost and break handlers, the collapse component) and computed over every versus stage file with converter/stageobj.py (ShapeHead, MeshShape, Triangle, Vertex on top of the structs already there). H = read in the code and checked against the stage data, M = read in the code only, L = skimmed. Nothing here was checked against footage. This section corrects the geometric test given under “Support links and chain collapse” above (it is a ray against the other’s triangles, not shifted triangles) and the class 2 / 53 note there.

Stage setup runs slot 63 (0x1401fc940) on every object S, in table order, against every other object X, in table order: when S.slot14(X) or else X.slot15(S) is true, slot 11 (0x1401fc850) links them with S as the supporter and X as the dependant: S goes into X’s supporter list (+0x140, 4 entries), X into S’s dependant list (+0x160, 16 entries), and X is marked resting (+0x100 = 1, +0x108 = 0). The link is dropped when either list is full. Slot 12 (0x1401fc900) takes an object out of its supporters’ dependant lists.

So slot 14 asks “do I carry X?” and slot 15 “do I stand on S?”. Both are a flag predicate on the other object followed by a geometric test.

Flags. Each component’s constructor ORs one bit into the object’s flag word (+0x50):

Bit Component Classes (table 2)
0x01 ceiling variant (ARollF / ACrmF of the “Ceil” classes) 12, 13 (not on versus stages)
0x02 AWall 7, 8
0x04 faller (ARollF / ACrmF of the “Rep” classes, and class 26) 22, 23, 26, 42, 43
0x08 ATchR 17, 18
0x10 APl 27, 28
0x20 APl2 29, 30
0x40 AOn 1–6, 37, 38
0x80 AHri 17
0x100 AVer, 0x200 AVerU, 0x400 ATch, 0x1000 AHit, 0x2000 AHitif, 0x8000 + 0x80000 ACol, 0x10000 ARoll, 0x20000 ACrm

Tests per class family (slot 14 / slot 15 routine; predicate = mask on the other’s flags):

Family Classes “I carry X” (slot 14) “I stand on S” (slot 15)
AVer + AOn 2 / 1–6 X & 0x40, ray up (0x1401da7e0) S & 0x75, ray down (0x1401da920)
AVer + AWall 2 / 7, 8 X & 0x0F, ray up S & 0x06, ray down
faller 2 / 22, 23, 26 X & 0x7A, ray up S & 0x32, ray down
AVerU + APl 2 / 27, 28 X & 0x5D, ray up S & 0x15, ray both ways (0x1401dad10)
ATch + ATchR 2 / 17, 18 never S & 0x77, touch (0x1401dd130)
none 2 / 48, 53, 54, 58, 1 / 4, 1 / 15, 4 / 16 never never

The ray test (0x1401fe590; arguments: own body list, a direction, the other’s body list, a one-way flag, a length factor that is always 1.0). For every mesh shape (type 3) of the caller’s current-state collision list and every mesh shape of the other’s: the segment from the caller mesh’s bounding sphere centre to centre + d̂ · radius (both-ways: from centre − d̂ · radius) is tested against the other’s bounding sphere and then against each of its triangles (0x1401d2620: the two ends lie on different sides of the triangle’s plane, or on it, and the crossing point is inside the triangle; two-sided). d̂ is the caller’s own Y axis (row 1 of its matrix): + for “up”, − for “down”. The shapes are the world-space copies the object built at setup, so the centre and the triangles are already placed.

The touch test (0x1401fe490 → the sphere / mesh pair routine 0x1401d7fd0): the bounding sphere of a mesh of the touch object against the triangles of the other: the spheres overlap, the triangle’s plane is nearer than the radius, and either the centre’s projection lies in the triangle or one of its edges passes through the sphere. It is generous: a railing links to whatever deck its 8–12 unit sphere reaches.

The faller classes’ link pass (slot 63 override 0x1401eafe0) first does two more both-ways ray tests against the arena’s own collision list (0x1405322c0) and against the objects of a second list (0x140531c10, filled only by the class 2 / 17 constructor), recording up to four “neighbours” (0x1401eaf40; the arena as the value 1). No reader of that record was found and no listed object passes its predicate on the versus stages (L: looks like an unused anchor rule).

Losing support (M)

The break attack sphere (M code, H data)

Every break and every support-lost handler calls 0x1401e7300. When float 0 of the first joint of the object’s state 0 model is non-zero it creates a short-lived attack body (collision category 0x400, the same category as a flying piece’s) at the object’s position: a sphere of radius 0.7 × the length of the model’s bounding box diagonal, attack value = that float as a byte. This is the “float 0 on the state 0 model (one stage only)” of the joint parameter table. Only st06 definition 16 carries it (value 3; class 2 / 3, 10 placed): those objects hurt what stands next to them when they go. What the 0x400 body does to a character is still not followed.

No camera shake, rumble or sound cue is started by the break, support-lost or collapse handlers themselves: they spawn the state’s effect records, the attack sphere and the row’s break sound, nothing else. Any shake on a collapse therefore comes from an effect record type (the EF00 constructor table, left to the effects decode).

The collapse family (2 / 6, 2 / 26; M)

The ACol component (constructor flags 0x8000 | 0x80000; init 0x1401eb3e0, tick 0x1401eb610, draw 0x1401eb6e0, break 0x1401e7cd0, support lost 0x1401e7aa0, hooks 0x1401f3020 / 0x1401f3120 / 0x1401f31a0 for 2 / 6 and 0x1401f3230 / 0x1401f3350 / 0x1401f33c0 for 2 / 26). It is an animated collapse, not pieces:

The special object 1 / 15 (L)

st02 ×1 (definition 23: 6 joints intact, 24 in the pieces state). A crumble breakable with no link test whose pre-update (slot 65, 0x1401e77b0) re-poses the joints named 0x4B085FC0 (the “stays in place” joints) of its pieces model each tick; 0x1401eb800 belongs to it. Not followed further.

Class 2 / 53 (correction)

It has neither a hit component nor a link test, and its flag word has none of the bits a link predicate asks for, so on st05 it is never linked (0 links on that stage) and shots cannot break it. The earlier “breaks only when its support goes” is wrong; what, if anything, breaks it (its class update is the floating props’ 0x1401f3c40) was not followed.

stageobj.py runs the link pass above on each placement list and writes it as support_links (pairs supporter, dependant; placement indices). Links per stage, list 0 / list 2: st02 28 / 10, st03 78 / 31, st04 61 / 13, st06 2 / 2, st05, st07, st08, st24 none.

The Palace (st03), list 0. The upper bridge is four deck sections (class 2 / 23) on four pillars (class 2 / 28), with railings (class 2 / 18) on the deck. Deck top at y = 109, pillars y 50–100, game units.

Placement What Hits Supporter Dependants
0 deck, x 94..200 (definition 0) 2 pillar 4 pillar 4; railings 140, 141, 142, 147, 148, 161, 171, 172, 173, 174
1 deck, x 20..95 (definition 1) 3 pillar 5 pillar 5; railings 138, 139, 140, 143, 165, 167, 171
2 deck, x −105..−37 (definition 2) 3 pillar 6 pillar 6; railings 136, 137, 160, 163, 164, 168, 169, 170
3 deck, x −200..−94 (definition 0) 2 pillar 7 pillar 7; railings 136, 144, 149, 150, 160, 162, 168, 170, 176, 177
4, 5, 6, 7 pillars at x = 140, 50, −50, −140 (z = −50; definition 3) 1 its deck its deck

st04 has the same construction: 7 class 2 / 23 sections, 4 of them on class 2 / 28 supports (mutual, as on the Palace), carrying 17 class 2 / 3 and 12 class 2 / 1 objects; the longest chain is 8 objects.

Implementation notes for the rebuild

Built (collapse, 11-13). The Godot side follows these notes (stage_objects.gd link / release_dependants, stage_object.gd lose_support); the per-stage results of the links, computed by tests/test_collapse_stages.gd on the converted stages (list 0; the +10 / +20 variants give the same numbers as their base stage):

Stage Objects placed Links Objects that carry others Longest chain (objects, intact stage) Collapse family Attack spheres
st02 216 28 15 5 9 (placements 0–8) 0
st03 179 78 36 12 0 0
st04 158 61 33 9 0 0
st05 62 0 0 — 0 0
st06 266 2 2 2 1 (placement 16) 10
st07, st17 4 / 0 0 0 — 0 0
st08 49 0 0 — 0 0
st24 0 in list 0 0 0 — 0 0

stageobj.py writes a non-finite float as null (st02 has effect records whose parameter 0 holds a NaN bit pattern, so that word is not a float for that record type).