//
// LevelEditorLayer::spawnGroupPreview from 0x100360a9c to 0x100360db4 (792 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::updateGameObjects @ 0x100358c24
// > LevelEditorLayer::activateTriggerEffect @ 0x1003612a4
//
// 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 LevelEditorLayer::spawnGroupPreview(
LevelEditorLayer *a1,
int a2,
float a3,
float a4,
float a5,
float a6,
float a7,
bool a8,
bool a9)
{
_BOOL4 v9; // w19
_BOOL4 v10; // w21
_BOOL4 isGroupEnabled; // w0
std::__vector_base::pointer begin; // x8
unsigned __int64 v21; // x24
cocos2d::CCArray *TriggerGroup; // x0
cocos2d::CCArray *v23; // x22
unsigned __int64 v24; // x23
__int64 v25; // x24
cocos2d::ccArray *v26; // x9
__int64 v27; // x8
char v28; // w25
EffectGameObject **v29; // x22
unsigned __int64 v30; // x23
double v31; // d14
float v32; // s15
EffectGameObject *v33; // x21
float *v34; // x0
float v35; // s0
double v36; // d0
float v37; // s14
DelayedSpawnNode *DelayedSpawnNode; // x0
bool v39; // w2
cocos2d::ccArray *data; // x9
__int64 num; // x8
int v42; // w22
EffectGameObject **arr; // x23
unsigned __int64 v44; // x24
EffectGameObject *v45; // x21
bool v46; // w2
double v47; // [xsp+0h] [xbp-A0h]
if ( a2 < 1 )
return;
v9 = a9;
v10 = a8;
isGroupEnabled = GJEffectManager::isGroupEnabled(a1->m_effectManager, a2);
if ( a4 > a6 || !isGroupEnabled )
return;
begin = a1->m_spawnGroupDelays.__begin_;
if ( begin[a2] >= a4 )
return;
v21 = (unsigned int)a2;
begin[a2] = a4;
TriggerGroup = LevelEditorLayer::getTriggerGroup(a1, a2);
v23 = TriggerGroup;
v24 = v21 >> 6;
v25 = 1LL << v21;
if ( (*(_QWORD *)&a1->m_sortedGroups.__begin_[8 * v24] & v25) != 0 )
{
if ( v10 )
goto LABEL_9;
LABEL_33:
if ( v23 )
{
data = v23->data;
num = data->num;
if ( (_DWORD)num )
{
v42 = 0;
arr = (EffectGameObject **)data->arr;
v44 = (unsigned __int64)&arr[num - 1];
do
{
v45 = *arr;
if ( !*arr )
break;
if ( v45->m_isTrigger && v45->m_isSpawnTriggered && (v45->m_isMultiTriggered || !v45->m_activatedByPlayer1) )
{
v45->m_spawnTriggerDelay = a4;
v45->m_spawnOrder = v42;
v46 = v9 && a1->m_drawGridLayer->m_oldPlaybackTime < a4;
++v42;
LevelEditorLayer::activateTriggerEffect(a1, v45, a5, a6, a7, v46);
((void (__fastcall *)(EffectGameObject *, float))v45->triggerActivated)(v45, a3);
}
++arr;
}
while ( (unsigned __int64)arr <= v44 );
}
}
return;
}
if ( (unsigned int)sub_10024A36C((__int64)TriggerGroup) >= 2 )
qsort(v23->data->arr, v23->data->num, 8u, (int (__cdecl *)(const void *, const void *))sub_1003565D4);
*(_QWORD *)&a1->m_sortedGroups.__begin_[8 * v24] |= v25;
if ( !v10 )
goto LABEL_33;
LABEL_9:
if ( v23 )
{
v26 = v23->data;
v27 = v26->num;
if ( (_DWORD)v27 )
{
v28 = 0;
v29 = (EffectGameObject **)v26->arr;
v30 = (unsigned __int64)&v29[v27 - 1];
v31 = a4;
v32 = 0.0;
while ( 1 )
{
v33 = *v29;
if ( !*v29 )
return;
if ( v33->m_isTrigger && v33->m_isSpawnTriggered && (v33->m_isMultiTriggered || !v33->m_activatedByPlayer1) )
break;
LABEL_28:
if ( (unsigned __int64)++v29 > v30 )
return;
}
v34 = (float *)((__int64 (__fastcall *)(EffectGameObject *))v33->getPosition)(*v29);
if ( (v28 & 1) != 0 )
{
v35 = (float)(*v34 - v32) / 311.58;
if ( v35 != 0.0 )
{
v36 = v31 + v35;
if ( v36 <= a6 )
{
v47 = v31;
v37 = v36;
DelayedSpawnNode = LevelEditorLayer::getDelayedSpawnNode(a1);
DelayedSpawnNode->m_gameObject = v33;
DelayedSpawnNode->m_spawnDelay = v37;
v28 = 1;
if ( (std::__vector_base::pointer)((char *)a1->m_delayedSpawnNodes.__end_
- (char *)a1->m_delayedSpawnNodes.__begin_) >= (std::__vector_base::pointer)9 )
a1->m_sortSpawnNodes = 1;
v31 = v47;
goto LABEL_28;
}
goto LABEL_27;
}
}
else
{
v32 = *v34;
}
v39 = 0;
v33->m_spawnTriggerDelay = a4;
v33->m_spawnOrder = 0;
if ( v9 )
v39 = a1->m_drawGridLayer->m_oldPlaybackTime < a4;
LevelEditorLayer::activateTriggerEffect(a1, v33, a5, a6, a7, v39);
((void (__fastcall *)(EffectGameObject *, float))v33->triggerActivated)(v33, a3);
LABEL_27:
v28 = 1;
goto LABEL_28;
}
}
}