//
// RandTriggerGameObject::triggerObject from 0x1404b41e0 to 0x1404b43af (463 bytes)
//
// 2 xrefs:
// > ??> @ 0x140618f38
// > ??> @ 0x1406dcb60
//
// 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
//
// Hidden C++ exception states: #wind=2
void RandTriggerGameObject::triggerObject(
RandTriggerGameObject *a1,
GJBaseGameLayer *a2,
int a3,
std::vector *const a4)
{
int v7; // ecx
std::_Vector_val>::pointer Mylast; // rdx
std::_Vector_val>::pointer i; // rax
int v10; // r8d
int v11; // ecx
std::_Vector_val>::pointer Myfirst; // rax
std::_Vector_val>::pointer v13; // rdx
unsigned int m_groupID; // esi
char v15; // bl
_BYTE *v16; // rcx
_BYTE *Block; // [rsp+40h] [rbp-38h]
__int64 v18; // [rsp+50h] [rbp-28h]
_QWORD v19[3]; // [rsp+58h] [rbp-20h] BYREF
if ( a1->m_objectID == 2068 )
{
v7 = 0;
Mylast = a1->m_chanceObjects._Mypair._Myval2._Mylast;
for ( i = a1->m_chanceObjects._Mypair._Myval2._Myfirst; i != Mylast; ++i )
v7 += i->m_chance;
qword_1406C2E90 = 214013 * qword_1406C2E90 + 2531011;
v10 = (int)roundf((float)((float)(((unsigned __int64)qword_1406C2E90 >> 16) & 0x7FFF) / 32767.0) * (float)v7);
v11 = 0;
Myfirst = a1->m_chanceObjects._Mypair._Myval2._Myfirst;
v13 = a1->m_chanceObjects._Mypair._Myval2._Mylast;
if ( Myfirst == v13 )
{
LABEL_8:
m_groupID = 0;
}
else
{
while ( 1 )
{
v11 += Myfirst->m_chance;
if ( v11 >= v10 )
break;
if ( ++Myfirst == v13 )
goto LABEL_8;
}
m_groupID = Myfirst->m_groupID;
}
if ( a4 )
{
sub_14024B270(v19, (__int64)a4);
v15 = 1;
}
else
{
Block = nullptr;
v18 = 0;
v15 = 2;
}
((void (__fastcall *)(TriggerEffectDelegate *, _QWORD, _QWORD))a2->spawnGroup)(
&a2->TriggerEffectDelegate,
m_groupID,
0);
if ( (v15 & 2) != 0 )
{
v15 &= ~2u;
v16 = Block;
if ( Block )
{
if ( (unsigned __int64)(4 * ((v18 - (__int64)Block) >> 2)) >= 0x1000 )
{
v16 = *((_BYTE **)Block - 1);
if ( (unsigned __int64)(Block - v16 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
}
if ( (v15 & 1) != 0 )
sub_14005E430((__int64)v19);
}
else
{
EffectGameObject::triggerObject(a1, a2, a3, a4);
}
}