benilla-re systems structs docs

s_yardsPerCell

global · terrain

Address
0x810678 · 4 bytes, up to 0x81067b
Type
float
Meaning
Holds 4.1666665, the width of a grid cell: read by the placement snap, the segment trace and map light placement
Confidence
verified, proof one
Finding
terrain/doodads#placement-anchor-snap

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.