Stage sprite sets (SP00) and the sand storm’s sprites
converter/spritesets.py reads
this section and writes
sprites.json plus the sheets
(through pdconv --textures). Layout
H (parsed on st02 / st12 /
st22, sheet viewed); draw states
M.
SP00
section (stNN.dat header word
0x9C)
| Part | Layout |
|---|---|
| header | magic SP00, u32 set count, u32
version (1) |
| per set | u32 frame count, then per frame 8 × f32: quad x0, y0, x1, y1 (all −5..5 in the data) and texture rectangle u0, v0, u1, v1 |
| slot table header | u32 length of the name list in bytes, u32 slot count (50) |
| name list | NUL-terminated texture file names, not padded |
| per slot, 20 bytes | i32 name index (−1 unused), u32 sprite set, u32 capacity (most sprites at once; 0 = not loaded), u32 frame count, u32 mode |
- The loader 0x140205790 loads a global table first (3 slots), then the stage’s: sprite id = 3 + stage slot index. Runtime record 24 bytes at 0x140532730 + id × 24.
- Texture: the slot’s name without its extension, looked up by name in the stage ALR’s texture list (chunk 0x15). The drop and smoke sprites resolve the same way.
- Mode → draw state (callback table 0x1402dc7c0):
| Mode | State |
|---|---|
| 0 | no blending; alpha test “greater than 254”; no depth write (cut-out) |
| 1 | source alpha / inverse source alpha |
| 2 | one / one (additive) |
| 3 | zero / inverse source alpha |
| 4 | inverse destination colour / inverse source colour |
| 5 | destination colour / one |
| 6 | not read |
- Draw request 0x140205d60(id, record, frame, flag): culled behind the camera; flag ≠ 0 files it in the list flushed by 0x140205f20, else the one flushed by 0x140206060.
Highway (st02) sprites
- Far papers: sprite id 45 = slot 42: set 0 (64 frames, the whole sheet as an 8 × 8 grid), mode 0 cut-out, capacity 256. Two variants of 32 frames (rows 0–3 and 4–7). Tint = the global light colour (0x1405a86b0, three floats) × 255, alpha 255. Scale 0.8, no rotation.
- Near papers: sprite id 46 = slot 43: set 2 (64 frames, cells of 1/16 in the top-right quarter of the shared effect sheet, u 0.5–1, v 0–0.5), mode 1 alpha blend.
- st12 / st22 carry the same section (their storm never spawns: intensity 0).
Near
papers (pdvkSPaperNear, 10)
(M)
Init 0x140243fc0, tick 0x1402440d0, draw 0x140244a60. r = a fresh rand15/32767 each use.
- Init: each paper waits 10r s. Tick: clock += 1/30; wind and intensity I copied from the storm; the storm’s sound 1 is started once and its volume follows the storm every tick.
- Spawn an inactive paper when I ≥ 0.15 and the papers already active earlier in this tick’s loop ≤ int(clamp(I, 0, 1) × 10): life 2 s, phase = clock, age 0, variant = rand bit, scale 0.1 + 0.1r, position local to the camera = −40·u, velocity = u′ × (1 + r), turn = u″ × (0.001 + 0.002r); u, u′, u″ = the wind direction spun 0..360° about itself and tilted by ±45°, ±15° and 50..90°, as for the far papers.
- Update: waiting → wait −= 1/30. Else life ≤ 0 → inactive. Else life −= 1/30, age += 1, phase += 1, v = normalize(v + turn) × |v|, v.y ≥ −0.1, position += v, then position += v × 0.05 sin(phase°) and y += 0.04 sin(4·phase°).
- Draw: position = local position + the camera point from 0x14023f020 (read as the eye; the tail of that routine not read), frame = variant × 32 + age mod 32, the paper’s own scale, tint as the far papers, second draw list.
Sphere
(pdvkSSphere) (M /
L)
Init 0x140244c70 halves its matrix scale and
sets material flag 0x2000 on its model; tick
0x140244d70 builds a matrix from the wind
direction; draw 0x140244dd0 (stage % 10 == 2
only) moves it to the same camera point and
draws the model’s chunks. It is a camera-centred
dome turned to the wind, the carrier of the
vkSAND look. (stagefx
11-15) Model, matrix and shader are decoded
in “Storm sphere, vkSAND, piece
impact sounds and the object hit mark” (the 0.5
scale of the init does not survive the first
tick).
Implementation notes for the rebuild
- Load
sprites.json; draw far papers with slot 42 (cut-out, alpha > 254/255, no depth write), frame = variant × 32 + age mod 32, tinted by the stage light colour. - Add the 10 near papers with slot 43 (alpha blend) from the numbers above, positions relative to the eye.
- Other stage sprites (drops, smoke) can take their sheet and frames from the same file: id − 3 = slot. The drop’s and the smoke’s ids still have to be read at their draw calls.
- Sphere: see the notes of “Storm sphere,
vkSAND, piece impact sounds and the object hit mark” (stagefx 11-15).