//
// GJEffectManager::updateSpawnTriggers from 0x1000148ac to 0x100014aa0 (500 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::loadUpToPosition @ 0x1001fcdc0
// > GJBaseGameLayer::update @ 0x1001fe990
//
// 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
//
void __fastcall GJEffectManager::updateSpawnTriggers(GJEffectManager *a1, float a2)
{
std::vector *p_m_spawnTriggerActions; // x19
std::__vector_base::pointer end; // x22
std::__vector_base::pointer begin; // x21
__int64 v6; // x9
__int64 v7; // x8
unsigned int v8; // w22
unsigned __int64 v9; // x23
double v10; // d9
SpawnTriggerAction *v11; // x25
double m_duration; // d1
double v13; // d0
double v15; // d8
GameObject *m_gameObject; // x1
TriggerEffectDelegate *m_triggerEffectDelegate; // x0
char v18; // w21
char v19; // w9
_OWORD *p_m_finished; // x23
__int128 v21; // q0
__int128 v22; // q2
void *__p; // [xsp+8h] [xbp-68h] BYREF
void *v24; // [xsp+10h] [xbp-60h]
__int64 v25; // [xsp+18h] [xbp-58h]
p_m_spawnTriggerActions = &a1->m_spawnTriggerActions;
end = a1->m_spawnTriggerActions.__end_;
begin = a1->m_spawnTriggerActions.__begin_;
v6 = (char *)end - (char *)begin;
if ( end != begin )
{
v7 = 0;
v8 = 0;
v9 = 0x8E38E38E38E38E39LL * (v6 >> 3);
v10 = a2;
while ( 1 )
{
++v8;
while ( 1 )
{
v11 = &begin[v7];
if ( v11->m_finished
|| !v11->m_disabled
&& (m_duration = v11->m_duration,
v13 = v11->m_deltaTime + v10,
v11->m_deltaTime = v13,
v11->m_finished = v13 >= m_duration) )
{
if ( a1->m_triggerEffectDelegate )
break;
}
v7 = v8;
if ( v9 <= v8++ )
goto LABEL_20;
}
v15 = v11->m_deltaTime - v11->m_duration;
__p = nullptr;
v24 = nullptr;
v25 = 0;
sub_100017EB4(&__p);
m_gameObject = v11->m_gameObject;
m_triggerEffectDelegate = a1->m_triggerEffectDelegate;
if ( m_gameObject )
((void (__fastcall *)(TriggerEffectDelegate *, GameObject *, void **, double))m_triggerEffectDelegate->spawnObject)(
m_triggerEffectDelegate,
m_gameObject,
&__p,
v15);
else
((void (__fastcall *)(TriggerEffectDelegate *, _QWORD, bool, void **, _QWORD, _QWORD, double))m_triggerEffectDelegate->spawnGroup)(
m_triggerEffectDelegate,
(unsigned int)v11->m_targetGroupID,
v11->m_spawnOrdered,
&__p,
(unsigned int)v11->m_triggerUniqueID,
(unsigned int)v11->m_controlID,
v15);
v18 = ((__int64 (__fastcall *)(TriggerEffectDelegate *))a1->m_triggerEffectDelegate->checkSpawnAbuse)(a1->m_triggerEffectDelegate);
if ( __p )
{
v24 = __p;
operator delete(__p);
}
v7 = v8;
if ( v9 <= v8 )
v19 = 1;
else
v19 = v18;
begin = p_m_spawnTriggerActions->__begin_;
if ( (v19 & 1) != 0 )
{
LABEL_20:
end = a1->m_spawnTriggerActions.__end_;
goto LABEL_23;
}
}
}
while ( 1 )
{
LABEL_23:
if ( begin == end )
{
begin = end;
goto LABEL_25;
}
if ( begin->m_finished )
break;
++begin;
}
if ( begin != end )
{
p_m_finished = &begin[1].m_finished;
if ( &begin[1] != end )
{
do
{
if ( (*(_BYTE *)p_m_finished & 1) == 0 )
{
v21 = *p_m_finished;
v22 = p_m_finished[2];
*(_OWORD *)&begin->m_deltaTime = p_m_finished[1];
*(_OWORD *)&begin->m_controlID = v22;
*(_OWORD *)&begin->m_finished = v21;
sub_100017728(&begin->m_remapKeys, p_m_finished + 3);
++begin;
}
p_m_finished = (_OWORD *)((char *)p_m_finished + 72);
}
while ( p_m_finished != (_OWORD *)end );
end = a1->m_spawnTriggerActions.__end_;
}
}
LABEL_25:
sub_100014ABC(p_m_spawnTriggerActions, begin, end);
}