//
// LevelEditorLayer::spawnGroupPreview from 0x1402ddf40 to 0x1402de33a (1018 bytes)
//
// 6 xrefs:
// > LevelEditorLayer::updateGameObjects @ 0x1402dcba3
// > LevelEditorLayer::activateTriggerEffect @ 0x1402dd420
// > ??> @ 0x14068ea3c
// > ??> @ 0x14068ead8
// > ??> @ 0x14068eb08
// > ??> @ 0x1406d338c
//
// 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 LevelEditorLayer::spawnGroupPreview(
LevelEditorLayer *a1,
int a2,
float a3,
float a4,
float a5,
float a6,
float a7,
bool a8,
bool a9)
{
unsigned __int64 v9; // r9
int v10; // eax
std::_Vector_val>::pointer Myfirst; // rdx
unsigned int v13; // ecx
std::_Simple_types::value_type v14; // eax
std::_Vector_val>::pointer v15; // rax
unsigned __int64 v16; // rdi
cocos2d::CCArray *TriggerGroup; // rax
unsigned __int64 v18; // rsi
char v19; // di
unsigned __int64 v20; // rsi
cocos2d::CCArray *v21; // r14
char v22; // r15
float v23; // xmm7_4
cocos2d::ccArray *data; // rdi
__int64 num; // rax
EffectGameObject **arr; // rdi
EffectGameObject **i; // r14
EffectGameObject *v28; // rbx
float *v29; // rax
double v30; // xmm2_8
bool v31; // al
double v32; // xmm1_8
int v33; // esi
cocos2d::ccArray *v34; // rdi
__int64 v35; // rax
EffectGameObject **v36; // rdi
EffectGameObject **j; // r14
EffectGameObject *v38; // rbx
bool v39; // al
if ( a2 > 0 )
{
v9 = a2;
v10 = 9999;
if ( a2 <= 9999 )
v10 = a2;
Myfirst = a1->m_effectManager->m_unkVector438._Myvec._Mypair._Myval2._Myfirst;
v13 = v10 & 0x1F;
v14 = Myfirst[(unsigned __int64)v10 >> 5];
if ( _bittest((const int *)&v14, v13) )
{
if ( a4 <= a6 )
{
v15 = a1->m_spawnGroupDelays._Mypair._Myval2._Myfirst;
v16 = v9;
if ( v15[v9] < a4 )
{
v15[v9] = a4;
TriggerGroup = LevelEditorLayer::getTriggerGroup(a1, v9);
v18 = v16;
v19 = v16 & 0x1F;
v20 = v18 >> 5;
v21 = TriggerGroup;
if ( ((1 << v19) & a1->m_sortedGroups._Myvec._Mypair._Myval2._Myfirst[v20]) == 0 )
{
if ( cocos2d::CCArray::count(TriggerGroup) > 1 )
qsort(v21->data->arr, v21->data->num, 8u, (_CoreCrtNonSecureSearchSortCompareFunction)sub_1402052D0);
a1->m_sortedGroups._Myvec._Mypair._Myval2._Myfirst[v20] |= 1 << v19;
}
if ( a8 )
{
v22 = 0;
v23 = 0.0;
if ( v21 )
{
data = v21->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (EffectGameObject **)data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v28 = *arr;
if ( !*arr )
return;
if ( v28->m_isTrigger
&& v28->m_isSpawnTriggered
&& (v28->m_isMultiTriggered || !v28->m_activatedByPlayer1) )
{
v29 = (float *)v28->getPosition_0(*arr);
if ( v22 )
{
v30 = (float)((float)(*v29 - v23) / 311.58011);
if ( v30 != 0.0 )
{
v32 = a4 + v30;
if ( a6 >= v32 )
LevelEditorLayer::addDelayedSpawn(a1, v28, v32);
continue;
}
}
else
{
v23 = *v29;
v22 = 1;
}
v28->m_spawnTriggerDelay = a4;
v28->m_spawnOrder = 0;
v31 = a9 && a4 > a1->m_drawGridLayer->m_oldPlaybackTime;
LevelEditorLayer::activateTriggerEffect(a1, v28, a5, a6, a7, v31);
((void (__fastcall *)(EffectGameObject *))v28->triggerActivated)(v28);
}
}
}
}
}
else
{
v33 = 0;
if ( v21 )
{
v34 = v21->data;
v35 = v34->num;
if ( (_DWORD)v35 )
{
v36 = (EffectGameObject **)v34->arr;
for ( j = &v36[v35 - 1]; v36 <= j; ++v36 )
{
v38 = *v36;
if ( !*v36 )
break;
if ( v38->m_isTrigger
&& v38->m_isSpawnTriggered
&& (v38->m_isMultiTriggered || !v38->m_activatedByPlayer1) )
{
v38->m_spawnOrder = v33++;
v38->m_spawnTriggerDelay = a4;
v39 = a9 && a4 > a1->m_drawGridLayer->m_oldPlaybackTime;
LevelEditorLayer::activateTriggerEffect(a1, v38, a5, a6, a7, v39);
((void (__fastcall *)(EffectGameObject *))v38->triggerActivated)(v38);
}
}
}
}
}
}
}
}
}
}