FindNearestLiquidInAreas
function · terrain · primitive
- Address
0x68af10· 445 bytes, up to0x68b0cc- Signature
uint8_t __fastcall (const float *point, void *out, float radius, uint32_t arg4, uint32_t arg5)- Meaning
- Searches the 3 x 3 areas around a point for the nearest liquid cell of each type
- Confidence
- verified, proof one
- Finding
- terrain/liquidpass#nearest-liquid-cells
- Test
terrain::area_coord_conversion_difftest
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.
Callers 1
- FindNearestLiquid terrain
Callees 2
- FindNearestChunkLiquid terrain
- ClassifyCircleAgainstBox cmath
Calls and jumps by a bare address, from tables/calls.tsv.