benilla-re systems structs docs

CGUnit_C::UpdateSwimState

function · objectlayer · primitive

Address
0x6030c0 · 321 bytes, up to 0x603200
Signature
void __thiscall (CGUnit_C *this, uint32_t time, uint32_t inLiquid, float depth, uint32_t force)
Meaning
Starts or stops swimming from the liquid depth, the collision height and the unit flags with a 1/36 band
Confidence
verified, proof one
Finding
objectlayer/swim#swim-decision
Test
objectlayer::move_event_pitch_rate, objectlayer::move_event_pitch_thresh

Finding: Swim decision in objectlayer: swimming

0x6030c0(time, inLiquid, depth, force) decides the unit's swim state from the liquid depth over its feet, h being the collision height +0xa5c (CMovement+0xb4). While 0x400 is set in the movement flags it does nothing. A unit not swimming starts when depth > 0.75·h, a field-flags bit of the gate below is set and the re-entry guard 0x7c5de0 is false. A swimming unit stops when it is not in liquid, or depth < 0.75·h − 1/36, or none of the gate bits is set; at a depth equal to the threshold it stays. The two thresholds differ by 1/36 yard (0.0277778), so between them a unit keeps its state.

The derivation is in the doc.

Callers 1

Callees 5

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