benilla-re systems structs docs

CGWorldFrame::ClassifyHoveredUnit

function · ui · primitive

Address
0x482200 · 1241 bytes, up to 0x4826d8
Signature
void __thiscall (CGWorldFrame *this, CGUnit_C *unit)
Meaning
Sets the cursor mode for a hovered unit from its flags, state and distance
Confidence
verified, proof one
Finding
ui/worldcursor#units-charm-and-interaction
Test
ui::textglue_482_normalize3, ui::textglue_482_sq_len3_482200, ui::textglue_482_square_cmp

Finding: Units: charm and interaction in ui: the pointer picture

With the player's charm latch (bit 0 of +0x1c70) set, a hovered unit that is alive gets Attack (4) when the possessed unit (objectlayer/interaction#far-sight) exists, is neither dead nor mounted, and may attack it; anything else gets the base mode. There is no range test. Otherwise the unit's squared centre distance to the player is compared with 30.864 (5.5556 squared; equal counts as in range). If the unit can be interacted with (objectlayer/reaction#interacting-now), its NPC flags pick the mode, lowest bit first, and the unable form (+20) is used beyond that distance.

The derivation is in the doc.

Callers 1

Callees 16

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