//
// LevelEditorLayer::spawnGroupPreview from 0x1000eef00 to 0x1000ef362 (1122 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::updateGameObjects @ 0x1000de295
// > LevelEditorLayer::activateTriggerEffect @ 0x1000ef952
//
// 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 LevelEditorLayer::spawnGroupPreview(
LevelEditorLayer *a1,
int a2,
float a3,
float a4,
float a5,
float a6,
float a7,
bool a8,
bool a9)
{
GJEffectManager *m_effectManager; // rdi
bool isGroupEnabled; // al
std::__vector_base::pointer begin; // rax
cocos2d::CCArray *v15; // r12
std::__vector_base::pointer v16; // rax
__int64 v17; // rbx
__int64 v18; // rax
bool v19; // r13
LevelEditorLayer *v20; // rbx
cocos2d::ccArray *v21; // rax
EffectGameObject **v22; // r12
unsigned __int64 v23; // rcx
char v24; // al
cocos2d::ccArray *data; // rax
EffectGameObject **arr; // r15
unsigned __int64 v27; // r12
int v28; // r13d
EffectGameObject *v29; // r14
bool v30; // al
EffectGameObject *v31; // r15
LevelEditorLayer *v32; // r14
char v33; // bl
float v34; // xmm0_4
float v35; // xmm0_4
float v36; // xmm1_4
double v37; // xmm0_8
float v38; // xmm0_4
DelayedSpawnNode *DelayedSpawnNode; // rax
int v40; // r13d
EffectGameObject *v41; // r14
double v42; // [rsp+8h] [rbp-68h]
LevelEditorLayer *v43; // [rsp+20h] [rbp-50h]
unsigned __int64 v44; // [rsp+28h] [rbp-48h]
float v45; // [rsp+30h] [rbp-40h]
float v48; // [rsp+44h] [rbp-2Ch]
if ( a2 <= 0 )
return;
m_effectManager = a1->m_effectManager;
v48 = a4;
isGroupEnabled = GJEffectManager::isGroupEnabled(m_effectManager, a2);
if ( a4 > a6 )
return;
if ( !isGroupEnabled )
return;
begin = a1->m_spawnGroupDelays.__begin_;
if ( begin[a2] >= a4 )
return;
begin[a2] = a4;
v15 = a1->m_triggerGroups.__begin_[a2];
if ( !v15 )
{
v15 = (cocos2d::CCArray *)sub_10071F9E0(m_effectManager, *(_QWORD *)&a2);
a1->m_triggerGroups.__begin_[a2] = v15;
cocos2d::CCDictionary::setObject(a1->m_triggerGroupsDict, v15, (unsigned int)a2);
}
v43 = a1;
v16 = a1->m_sortedGroups.__begin_;
v17 = (unsigned int)a2 >> 6;
v18 = *(_QWORD *)&v16[8 * v17];
if ( _bittest64(&v18, (unsigned int)a2) )
{
v19 = a9;
if ( a8 )
goto LABEL_9;
LABEL_15:
if ( v15 )
{
data = v15->data;
if ( data->num )
{
arr = (EffectGameObject **)data->arr;
v27 = (unsigned __int64)&arr[data->num - 1];
if ( v19 )
{
v28 = 0;
do
{
v29 = *arr;
if ( !*arr )
break;
if ( v29->m_isTrigger && v29->m_isSpawnTriggered && (v29->m_isMultiTriggered || !v29->m_activatedByPlayer1) )
{
v29->m_spawnTriggerDelay = a4;
v29->m_spawnOrder = v28++;
LevelEditorLayer::activateTriggerEffect(
v43,
v29,
a5,
a6,
a7,
a4 > v43->m_drawGridLayer->m_oldPlaybackTime);
((void (__fastcall *)(EffectGameObject *, float))v29->triggerActivated)(v29, a3);
a4 = v48;
}
++arr;
}
while ( (unsigned __int64)arr <= v27 );
}
else
{
v40 = 0;
do
{
v41 = *arr;
if ( !*arr )
break;
if ( v41->m_isTrigger && v41->m_isSpawnTriggered && (v41->m_isMultiTriggered || !v41->m_activatedByPlayer1) )
{
v41->m_spawnTriggerDelay = a4;
v41->m_spawnOrder = v40++;
LevelEditorLayer::activateTriggerEffect(v43, v41, a5, a6, a7, 0);
((void (__fastcall *)(EffectGameObject *, float))v41->triggerActivated)(v41, a3);
a4 = v48;
}
++arr;
}
while ( (unsigned __int64)arr <= v27 );
}
}
}
return;
}
if ( (unsigned int)sub_100720070(v15) >= 2 )
qsort(v15->data->arr, v15->data->num, 8u, (int (__cdecl *)(const void *, const void *))sub_1000DA420);
*(_QWORD *)&v43->m_sortedGroups.__begin_[8 * v17] |= 1LL << a2;
v19 = a9;
if ( !a8 )
goto LABEL_15;
LABEL_9:
v20 = v43;
if ( v15 )
{
v21 = v15->data;
if ( v21->num )
{
v22 = (EffectGameObject **)v21->arr;
v23 = (unsigned __int64)&v22[v21->num - 1];
v42 = a4;
v24 = 0;
v45 = 0.0;
v44 = v23;
while ( 1 )
{
v31 = *v22;
if ( !*v22 )
return;
if ( v31->m_isTrigger && v31->m_isSpawnTriggered && (v31->m_isMultiTriggered || !v31->m_activatedByPlayer1) )
break;
LABEL_31:
if ( (unsigned __int64)++v22 > v23 )
return;
}
v32 = v20;
v33 = v24;
v34 = *(float *)((__int64 (__fastcall *)(EffectGameObject *))v31->getPosition)(*v22);
if ( (v33 & 1) != 0 )
{
v35 = (float)(v34 - v45) / 311.58011;
v36 = v48;
v20 = v32;
if ( v35 != 0.0 )
{
v37 = v35 + v42;
v24 = 1;
if ( a6 < v37 )
goto LABEL_30;
v38 = v37;
DelayedSpawnNode = LevelEditorLayer::getDelayedSpawnNode(v32);
DelayedSpawnNode->m_gameObject = v31;
DelayedSpawnNode->m_spawnDelay = v38;
if ( (std::__vector_base::pointer)((char *)v32->m_delayedSpawnNodes.__end_
- (char *)v32->m_delayedSpawnNodes.__begin_) >= (std::__vector_base::pointer)9 )
v32->m_sortSpawnNodes = 1;
LABEL_29:
v24 = 1;
LABEL_30:
v23 = v44;
goto LABEL_31;
}
}
else
{
v45 = v34;
v36 = v48;
v20 = v32;
}
v31->m_spawnTriggerDelay = v36;
v31->m_spawnOrder = 0;
v30 = v19 && v36 > v20->m_drawGridLayer->m_oldPlaybackTime;
LevelEditorLayer::activateTriggerEffect(v20, v31, a5, a6, a7, v30);
((void (__fastcall *)(EffectGameObject *, float))v31->triggerActivated)(v31, a3);
goto LABEL_29;
}
}
}