benilla-re systems structs docs

PickSoundDefFile

function · sound · primitive

Address
0x45bb70 · 457 bytes, up to 0x45bd38
Meaning
Returns a definition's file: by index, the next in order, or a weighted random draw
Confidence
verified, proof one
Finding
sound/entries#picking-a-file

Finding: Picking a file in sound: sound entries and plays

0x45bb70(def, sequential, out, index) returns a file name. An index other than −1 takes min(index, count − 1). One file is always file 0. A sequential pick takes the file after the last. Otherwise it draws from the client's shared generator and takes the first file whose running sum of remaining weights exceeds MulHigh32(total, r); that file's remaining weight goes to 0, and when the total reaches 0 every weight is restored except that file's. The pick is stored as the last.

The derivation is in the doc.

Callers 10

Callees 2

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