//
// GJBaseGameLayer::spawnGroup from 0x1001ec120 to 0x1001ec298 (376 bytes)
//
// 4 xrefs:
// > sub_1001EC3F0 @ 0x1001ec3f4
// > ??> @ 0x10078fd60
// > ??> @ 0x1007c0b78
// > ??> @ 0x1007f42d8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall GJBaseGameLayer::spawnGroup(
GJBaseGameLayer *a1,
int a2,
bool a3,
double a4,
std::vector *const a5,
int a6,
int a7)
{
__int64 v8; // x22
_BOOL4 v11; // w23
int *end; // x8
int v15; // w8
__int64 v16; // x9
int m_spawnCount; // w8
cocos2d::CCArray *Group; // x0
cocos2d::ccArray *data; // x8
__int64 num; // x9
cocos2d::CCObject **arr; // x8
unsigned __int64 v22; // x21
unsigned __int64 v23; // x22
__int64 v24; // x1
bool v25; // cc
__int64 v26; // [xsp+0h] [xbp-60h] BYREF
int v27; // [xsp+8h] [xbp-58h]
v8 = *(_QWORD *)&a6;
v11 = a3;
if ( GJEffectManager::isGroupEnabled(a1->m_effectManager, a2) && !a1->m_spawnAbuse )
{
end = a5->__end_;
if ( a5->__begin_ == end )
v15 = 0;
else
v15 = -*(end - 1);
if ( a1->m_enable22Changes )
v16 = v8 << 32;
else
v16 = 0;
v26 = v16 | (unsigned int)a2;
v27 = v15;
if ( sub_10020C3BC(&a1->m_spawnTuples, &v26) )
{
m_spawnCount = a1->m_spawnCount;
a1->m_spawnCount = m_spawnCount + 1;
if ( m_spawnCount >= 1000 )
a1->m_spawnAbuse = 1;
}
else
{
sub_10020C444(&a1->m_spawnTuples, &v26, &v26);
Group = GJBaseGameLayer::getGroup(a1, a2);
if ( v11 )
{
GJBaseGameLayer::spawnObjectsInOrder(a1, Group, a4, a5, v8, a7);
}
else if ( Group )
{
data = Group->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
v22 = (unsigned __int64)&arr[num - 1];
v23 = (unsigned __int64)(arr + 1);
do
{
v24 = *(_QWORD *)(v23 - 8);
if ( !v24 )
break;
((void (__fastcall *)(GJBaseGameLayer *, __int64, std::vector *const, double))a1->spawnObject)(
a1,
v24,
a5,
a4);
if ( a1->m_spawnAbuse )
break;
v25 = v23 > v22;
v23 += 8LL;
}
while ( !v25 );
}
}
}
}
}