benilla-re systems structs docs

CheckCorpseRange

function · ui · primitive

Address
0x492130 · 138 bytes, up to 0x4921b9
Meaning
Compares the player's distance to the cached corpse with the range and updates the state
Confidence
verified, proof one
Finding
ui/deathui#corpse-range-events
Test
ui::glue_492_492130_sqdist_radius

Finding: Corpse range events in ui: death, the corpse run and resurrection

Each frame the world frame update calls 0x492130 (0x4818c5, in the unconditional tail of 0x481790). With a cached corpse and the active player it takes the squared 3D distance from the player to the cached position, summed as (dz² + dx²) + dy² (0x492188 to 0x492194), and compares it with 0xb4e2ac; inside or equal is range 1. 0x4920f0(state) signals only on a change: CORPSE_OUT_OF_RANGE for 0, and for 1 CORPSE_IN_RANGE when the cached map ids are equal, else CORPSE_IN_INSTANCE.

The derivation is in the doc.

Callers 1

Callees 3

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