benilla-re systems structs docs

SplitLightColor

function · terrain · primitive

Address
0x6a77e0 · 467 bytes, up to 0x6a79b2
Signature
uint32_t __thiscall (void *this, const float *color, float scale, uint32_t a, uint32_t b, uint32_t c)
Meaning
Makes a colour raised to a floor brightness and the same colour lowered to a cap brightness
Confidence
verified, proof one
Finding
terrain/lights#light-colour-packing
Test
terrain::wmo_mocv_normalize_alpha_difftest

Finding: Light colour packing in terrain: map lights

0x6a77e0 returns two colours from one. With M the largest channel byte (at least 1), the first output is the source, and when M is below the floor its HSV value is multiplied by floor / M and converted back to bytes (alpha 0xff); the second is the source, and when M is above the cap each channel c becomes (c × s + 0xff) >> 8 with s = round(cap × 255 / M − 0.5).

The derivation is in the doc.

Callers 3

Callees 2

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