Storm sphere, vkSAND, piece impact sounds and the object hit mark

Read in PDUWP.exe and checked on st02’s files (converter/matdump.py, a struct dump of material entries, test in tests/test_matdump.py). Confidence per block. Answers the three playtest items of 11-14: no dust on the Highway, no sounds on a collapse, stumble instead of knockdown under a falling piece.

The system model table’s stage half = the MD00 section (H)

Corrects the header table’s MD00 row (“pairs (model, blob index)”) and “Mark routine” (“the index mapping into the stage file was not traced”). The loader 0x1401d9210 fills the system model table (0x140530390, 16-byte {model, animation}) in two passes with one running entry number: pass 0 = the 24 fixed pairs of st00 (name table 0x1403ee490), pass 1 = the stage’s MD00 section (set up by 0x1401d9180 from header word 0xA0):

Part Layout
header, 16 bytes magic MD00, u32 size A, u32 size B, u32 pair count (80 in every stage, 16 in st09)
block A (size A) NUL-terminated build names of the model files, one per pair
block B (size B) the same for the animation files
pairs count × {i32 model, i32 animation}; −1 = none; (dust 11-15) straight after block B, not aligned (st02: 4-aligned by chance, st03 / st12 not)

System entry 24 + k = pair k: model = model k.model of the stage ALR, animation = record k.animation of the blob list at header 0x0F4. So the entries used by code map to pairs: 0x28 → 16, 0x40..0x42 (mark kinds 0–2) → 40..42, 0x45 → 45, 0x4A.. → 50.., 0x4D..0x4F → 53..55, 0x5E (storm sphere) → pair 70. Pairs present per stage were listed with the struct reader: st02 has 0, 1, 3, 16, 20–22, 35, 40–42, 45, 53–55, 70, 72, 73; st12 / st22 have no pair 70 (no sphere model), st03 none above 55.

The sphere object (pdvkSSphere) (H code and data, scale M)

Replaces “Sphere (pdvkSSphere)” in “Stage sprite sets”.

The vkSAND material and shader (H)

Only st02’s model 95 uses it (st12 / st22 have no vksand entry). Material entry (matdump.py): flags 0x10011, blend word 0x5400, textures 44 (slot 0) and 45 (slot 1), all eight s16 parameters 0. By “Render state comes from the material entry”: blending on, source alpha / inverse source alpha, add; no depth write; depth test and culling stay on.

Shader (vkSAND_vs.cso / _ps.cso, dxbc_dis.py):

Constant upload (0x140234170, the shader object’s apply slot; object 0x1404616d8, vtable 0x14048de20), with t = the boot tick counter 0x14057f398 (“The sand storm is on a clock that runs from boot”):

Register Value
c32 (t × r0.u, t × r0.v, t × r1.u, t × r1.v)
c33 (storm intensity A·B, 1.5 sin(0.04 t), 0, 0); only .x is read by the shader
c34 a constant, not read by the shader

The same routine writes the intensity to the storm object (+0xe8), as already decoded. The scroll rates r0, r1 come from the model, not from code: a parameter chunk (id 0x13, 136 bytes) that follows the material and buffer chunks of model 95; the upload reads floats at chunk + 0x08 / + 0x0c (r0) and + 0x18 / + 0x1c (r1) and writes its scratch values into the same chunk. st02: r0 = (0.015, 0.002), r1 = (0.005, −0.002) per tick, in normalised UV; after the × 8:

Layer Texture UV shift per tick per second
0 44 (0.12, 0.016) (3.6, 0.48)
1 45 (0.04, −0.016) (1.2, −0.48)

u is the pole-to-pole direction = the wind axis, so both layers stream along the wind at different speeds and drift opposite ways around it. Texture 44 (viewed privately): 256 × 256, sparse sand-coloured grains, low alpha (39 % of texels 0, the largest about 0.22). (dust 11-15) Texture 45 (viewed privately): 64 × 64, a soft sand-coloured haze of streaks along u, alpha everywhere above 0 (mean about 0.19, largest about 0.31). So layer 1 is the even dust veil and layer 0 the grains in it.

What it adds up to: a sphere of grain streaks 1 m around the camera, in front of everything farther than that, alpha-blended and fading in and out with the storm intensity; open (transparent) straight up- and downwind.

Piece impact sound: sound row word 2 (H code, M threshold source)

Corrects “Sound row value → cue” (“every other entry −1”): the table 0x1402dc640 also has values 36–39 → the cue pairs 191/192, 193/194, 195/196, 197/198 of the common bank.

The collapse model object (pdvkClpsModel2) is not the Palace bridge (M)

Corrects the stage cue table’s row (“at the model”). Its init 0x14021c210 loops over system entries 0x36 and 0x37 (MD00 pairs 30, 31), takes each model’s parameter chunk (id 0x13), files a debris request from it, and starts stage bank cues 1 and 2 without a position, volume and pitch 0x1000, once per entry. Pairs 30 / 31 exist only in the st04 family and st08 (st05 family: 30 only); st02 and st03 have neither, so no Highway or Palace collapse plays these cues. What creates the object (0x14021c13d) is not followed.

What sounds a Palace bridge collapse has, in all: the pillar’s break sound (word 1 → 22: cue 22 or 177) at the contact; each released dependant’s break sound through the same queue (so mostly dropped by the cooldown); then the piece thuds above (pillars: value 38). Nothing else: no stage bank cue, no shake cue (as “Stage destruction” found).

The mark routine on a stage object hit (H gate, L which shots)

The object classes’ hit reaction method (vtable slot +0xe8: 0x1401eaa20 and 0x1401eac80, reached through thunks) is called by the base hit handler (0x1401fd6e0, at 0x1401fd9cb) on the “hits left > 1” path only, with a flag = the attacking body’s callback kind (callback slot 1; 0 when the body has no callback). The method passes the contact’s material byte (contact + 1) to the mark routine 0x14021d3f0, plus 0x21 when the flag is 1, which puts it outside the routine’s 1..32 range: no mark, no debris, no sound. With any other flag the routine runs as for a surface (“Mark routine”): debris always; crater models, dust, the material’s sound and the destroy sphere when the mark is accepted.

The stage piece’s hit on a character: nothing of its own (H)

Aligned with the playfix run (“Repeats and the knockdown”): the two stage records carry no hit effect and no sound; the reaction is the ordinary action row (46 / 2 / 3 by the running sum, 0x1b in the air), so a standing character is staggered by the first tick and thrown by the second. Whatever is heard or seen is the action row’s own (voice group at row + 8; “Hurt voice and hit sound of a reaction”) plus the piece’s thud above. In the Rebirth capture private recording 1 (collapse 2, 346.5–348 s) nobody stands under the bridge, so the knockdown itself is not on film there.

Built (dust 11-15). converter/systemmodels.py (structs for the ALR header, the 0x13 parameter chunk and MD00; synthetic test tests/test_systemmodels.py) feeds stagefx.json md00_pairs and vksand ({model, material, textures, scroll per tick}); pdconv writes the second texture as pd_layer1. Godot: PdSandSphere (pd_sand_sphere.gd). Checked on the files: pair 70 has a model in st02 (95), st04 (142), st08 (113) and st24 (95), but the sphere object is only made by the storm (stage % 10 == 2), so only st02 draws one; st12 / st22 have no pair 70 model and no vksand material. The converted model’s triangles all face inward (after pdconv’s winding flip), so the game’s culling leaves the inside visible: culled back faces in Godot.

How strong the decoded veil is (dust r2, measured on the converted st02 files). The vertex colour is white; its alpha is 1.0 from the wind equator to ±45° latitude, 0.70–0.85 at 60°, 0.20–0.55 at 75° and 0 at the poles (the wind axis). Texture 45 (64², the haze layer): mean alpha 0.19, max 0.31, 96 % of texels above 0.1, mean colour about (0.39, 0.35, 0.26). Texture 44 (256², the grain layer): mean alpha 0.008, max 0.22, only 0.5 % of texels above 0.1: sparse specks. With alpha = vertex alpha × intensity × (tex0.a + tex1.a), the decoded look at full storm, looking across the wind, is a brownish haze of about 19 % coverage with faint specks of up to about 40 % in total; looking along the wind it fades out completely. The storm is also off for half of its 209 s cycle (boot clock, above), and then neither the sphere nor the papers show.

st12 (thunderstorm) has no dust. Its stage-wide EF00 list holds two sound emitters, the stage parameters and one model entry (type 0x0D, at the origin, first parameter byte 10). st12’s MD00 pair 10 is model 83 + animation 4, which st02 does not have; model 83 is nine large vkblink quads 2 000–4 000 units out, at sky height (probably the lightning bolts; the link from the entry’s byte to the pair is not traced). There is no pair 70 model and no vkSAND material, so the storm intensity stays 0 and no sphere or papers draw there.

Implementation notes for the rebuild

  1. Converter: write the second texture of a vksand material (pd_layer1, as for the cloud shaders) and the two scroll pairs from the model’s 0x13 chunk (floats at + 8, + 12 and + 24, + 28; through a struct) into the material extras; write MD00 pairs into the stage output so code can ask for “pair 70”.
  2. Godot, st02 only (the model exists only there): draw model 95 at the camera’s eye every frame, unscaled, basis Z = the storm’s wind direction; no depth write, depth test on, alpha blend, unshaded, no fog. Shader: (tex0(uv + 8·t·r0) + tex1(uv + 8·t·r1)) × colour, alpha × the storm intensity; t = the boot tick counter (PdClock).
  3. Keep model 95 out of the ordinary stage draw (it is not stage geometry).
  4. stage_object.gd: give each piece the definition’s sound_row[0] (file word 2); at the end of a piece tick queue it at the piece centre when the last velocity² > 1 and the velocity change² > 1 (units per tick). Add values 36–39 to the cue table.
  5. The object hit mark: run the surface mark routine from the object hit path (hits left
    1. with the contact shape’s attribute, unless the attacker’s callback kind is 1.
  6. No sound or effect is to be added to the stage attack hit itself.