//
// RandTriggerGameObject::getRandomGroupID from 0x10038994c to 0x1003899ec (160 bytes)
//
// 1 xrefs:
// > RandTriggerGameObject::triggerObject @ 0x100389a1c
//
// 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 __fastcall RandTriggerGameObject::getRandomGroupID(RandTriggerGameObject *a1)
{
std::__vector_base::pointer begin; // x8
std::__vector_base::pointer end; // x9
int v4; // w10
float v5; // s8
float v6; // s0
std::__vector_base::pointer v7; // x8
std::__vector_base::pointer v8; // x9
signed int v9; // w10
signed int v10; // w11
begin = a1->m_chanceObjects.__begin_;
end = a1->m_chanceObjects.__end_;
if ( begin == end )
{
v5 = 0.0;
}
else
{
v4 = 0;
do
{
v4 += begin->m_chance;
++begin;
}
while ( begin != end );
v5 = (float)v4;
}
v6 = GameToolbox::fast_rand_0_1();
v7 = a1->m_chanceObjects.__begin_;
v8 = a1->m_chanceObjects.__end_;
if ( v7 == v8 )
return 0;
v9 = 0;
v10 = llroundf(v6 * v5);
while ( 1 )
{
v9 += v7->m_chance;
if ( v9 >= v10 )
break;
if ( ++v7 == v8 )
return 0;
}
return v7->m_groupID;
}