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”.
- Model: system entry 0x5E +
the object’s index (+0x50 = 0, set by the
storm’s setup 0x140242dc0) =
MD00pair 70 = st02.alr model 95: one mesh, 1040 vertices, 1280 triangles, vertex format 0x09, a sphere of radius about 10 units whose poles are on the model’s Z axis. Vertex colour white; vertex alpha 1 in the middle band (|z| ≤ 6.8), stepping 0.85, 0.70, 0.55, 0.40, 0.20 to 0 at both poles. UV: u runs pole to pole (about two wraps), v runs around the axis (−1..1). - Init 0x140244c70: matrix = identity with its three axis rows × 0.5; sets flag 0x2000 on every material entry of the model.
- Tick 0x140244d70: clock += 1/30; copies the storm’s wind (storm + 0x5c, the stage wind rescaled to strength × intensity + 0.01); rebuilds the matrix from identity as a look-at basis (0x14023ed50 → 0x14012e6f0): row Z = the normalised wind direction, X and Y completed from world up (from another axis when |dir.y| ≥ 0.99; a zero wind counts as (0, 0, 1)). The rebuild drops the init’s 0.5, so from the first tick the sphere is drawn at model size, radius 10 (M: the order init → tick → draw is read, not watched).
- Draw 0x140244dd0: only when stage % 10 == 2 and the effect draw switch 0x140532f44 is set; matrix translation = the eye position; then the model’s chunks through the chunk draw table 0x140410608. The sphere is drawn on every Highway variant that has the model; with intensity 0 its alpha is 0.
- The camera point 0x14023f020 is the eye (H; “Near papers” left its tail unread): it returns −(view rotation)ᵀ · (view translation) from the view matrix at 0x1405a5ca0, the camera’s world position, and optionally the view forward axis in a second pointer.
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):
- Vertex: position × the usual
world-view-projection (c20–c23). Colour out =
vertex colour, alpha × c33.x.
uv0 = (uv + c32.xy) × c_SCALES.z,uv1 = (uv + c32.zw) × c_SCALES.z. - Pixel:
c = clamp(colour, −1, 1);out = c × tex0(uv0) + c × tex1(uv1)(all four channels, so the alpha is vertex alpha × intensity × (a0 + a1)); discarded when alpha ≤misc_constant.x, or when a layer’s alpha is 0 and itsalphakillswitch is on; rgb saturated. No light, no fog.SV_TARGET1=blend_colouras in the other shaders. c_SCALES(vertex c12) is one constant for every shader: (0, 0, 8, 0.1923), written once at device setup (0x140292775 from 0x1402f8750). The s16 UVs arrive normalised (÷ 32767), and × 8 gives the ÷ 4096 that pdconv applies.
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 sound row (header 0x0F8, s16[8] per definition): word 0 hit, word 1 break (both known), word 2 = the sound value of the object’s flying pieces. Reader 0x1401fc710; the three piece makers (0x1401e8b18 pieces, 0x1401eccd3, 0x1401ed18c) store it in the piece at +0xa0 (the piece constructor’s default is “none”).
- Piece tick (0x1401f9932, at 0x1401f9d3c..0x1401f9eb4), after the box step: centre = the new box centre; v = centre − last centre (kept at +0xa4, the last one at +0xb0; v is also the attack body’s velocity). When |v_last|² > T and |v − v_last|² > T and the value ≥ 0, the value and the centre are queued in the stage sound queue (the same 64-entry queue as hit and break sounds: cooldown 30 passes, plays the first entry and later ones at least 500 units from those played, at most 5, cue = table[2 × value + random bit], common bank, at the position, volume and pitch 0x1000).
- T = 1.0, unless the stage parameter object
(0x140533308, EF00 type 0x14) exists and the
first float its + 0x90 points at is ≥ 1e-5 in
size, then that float. Every stage file’s type
0x14 entry has zero floats, so T = 1.0
(one unit per tick) everywhere
(M that
- 0x90 is the entry’s float block, as + 0x88 is its byte block).
- So a piece thuds when it was moving faster than 1 unit per tick and its velocity changed by more than 1 unit per tick within one tick: a landing or a hard bounce, not free fall and not the slow settling. A collapse of many pieces gives at most 5 thuds per 30 passes, spread at least 500 units apart.
- Data (word 2): st03 definitions 0–3 → 38 (cues 195 / 196), 21–23 → 37 (193 / 194); st02 definitions 9–14 and 33 → 36 (191 / 192), 24 → 38; every other definition of the two stages none.
- Not checked by ear: the playtest captures have music over the collapse.
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.
- Callback kind: the stage callbacks return
the word at + 0x0c (set through slot 0); the
shot’s object callback
(
pdStageColPtr_PlayerBullet, made by 0x1401631e0 with both words 0) returns its + 0x10 word’s high part when that word is ≥ 0xff, else + 0x0c. Who writes those words per skill is not followed; a plain shot reads 0 → the mark is made. - After the routine both methods play the object’s hit sound (word 0) and the state’s kind 1 / id 0xFF effects, as already decoded.
- It only matters for objects that take more than one hit (Palace: 34 placements).
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
- Converter: write the second texture of a
vksandmaterial (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; writeMD00pairs into the stage output so code can ask for “pair 70”. - 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). - Keep model 95 out of the ordinary stage draw (it is not stage geometry).
stage_object.gd: give each piece the definition’ssound_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.- The object hit mark: run the surface mark
routine from the object hit path (hits left
- with the contact shape’s attribute, unless the attacker’s callback kind is 1.
- No sound or effect is to be added to the stage attack hit itself.