benilla-re systems structs docs

s_areaCellsPerYard

global · terrain

Address
0x8102a0 · 4 bytes, up to 0x8102a3
Type
float
Meaning
Holds 0.24, cells per yard, for the area index of the liquid search
Confidence
verified, proof one
Finding
terrain/liquidpass#nearest-liquid-cells

Finding: Nearest liquid cells in terrain: liquid passes

0x68af10 finds, for a point, the nearest liquid cell of each type among the areas near it, and 0x68b0d0 does it inside one area. The point maps to an area index (((17066.666 − p) × 0.24 − 0.5) rounded, >> 7, 64 × 64 areas); the search takes the 3 × 3 areas around it, skipping empty ones and those whose box misses the radius sphere. In an area it takes ceil(radius × 0.24) chunks either side (clamped to 16 × 16) and keeps, per type, the cell of the chunks' four slots (flag nibble not 0xf) nearest the point, at its corner and the slot's middle height, as an offset.

The derivation is in the doc.