//
// RandTriggerGameObject::getRandomGroupID from 0x762dd4 to 0x762e64 (144 bytes)
//
// 2 xrefs:
// > RandTriggerGameObject::triggerObject @ 0x7705b0
// > ??> @ 0xb9df0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int RandTriggerGameObject::getRandomGroupID(RandTriggerGameObject *a1)
{
float v2; // s0
ChanceObject *m_start; // x4
ChanceObject *m_finish; // x5
signed int v5; // w3
signed int m_chance; // w1
ChanceObject *v7; // x0
int v8; // w2
int TotalChance; // [xsp+28h] [xbp+28h]
TotalChance = RandTriggerGameObject::getTotalChance(a1);
v2 = GameToolbox::fast_rand_0_1();
m_start = a1->m_chanceObjects.m_start;
m_finish = a1->m_chanceObjects.m_finish;
v5 = llroundf(v2 * (float)TotalChance);
if ( m_finish == m_start )
return 0;
m_chance = m_start->m_chance;
v7 = m_start + 1;
if ( v5 > m_chance )
{
while ( 1 )
{
m_start = v7;
if ( m_finish == v7 )
break;
v8 = v7->m_chance;
++v7;
m_chance += v8;
if ( v5 <= m_chance )
return m_start->m_groupID;
}
return 0;
}
return m_start->m_groupID;
}