benilla-re systems structs docs

AnchorPlacement

function · terrain · primitive

Address
0x698110 · 593 bytes, up to 0x698360
Signature
void __fastcall (void *entity, float *position, float facing)
Meaning
Rotates an entity's centred model box and snaps its x and y to the cell grid
Confidence
verified, proof one
Finding
terrain/doodads#placement-anchor-snap
Test
terrain::ground_anchor_difftest

Finding: Placement anchor snap in terrain: doodad defs

0x698110(entity, position, facing) moves a position in x and y so that the turned box's maximum corner sits on a grid line of 4.1666665-unit cells. It takes the entity's box (a map object def's root box, else the model's bounding box), centres it on its own middle, turns it about z by the facing and adds the turned box's maximum corner m to the position, giving v. For x and y it takes n = round((v + 4.1666665)·0.24 − 0.5) and stores position − (v − n·4.1666665). z is unchanged.

The derivation is in the doc.

Callers 2

Callees 6

Calls and jumps by a bare address, from tables/calls.tsv.