//
// LevelEditorLayer::spawnGroupPreview from 0x66d7e4 to 0x66dad8 (756 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::activateTriggerEffect @ 0x66d7d4
// > LevelEditorLayer::updateGameObjects @ 0x67bbcc
// > ??> @ 0x9d728
//
// 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)
{
_BOOL4 v9; // w21
_BOOL4 v10; // w22
float *m_start; // x2
unsigned __int64 v19; // x23
cocos2d::CCArray *TriggerGroup; // x0
__int64 v21; // x19
cocos2d::CCArray *v22; // x24
cocos2d::ccArray *v23; // x1
EffectGameObject **v24; // x19
EffectGameObject **v25; // x24
EffectGameObject *v26; // x21
float x; // s13
int v28; // w23
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
bool v30; // w2
cocos2d::ccArray *data; // x1
EffectGameObject **arr; // x21
EffectGameObject **v33; // x23
EffectGameObject *v34; // x19
int i; // w24
bool v36; // w2
double v37; // d1
double v38; // d0
float v39; // s0
v9 = a8;
v10 = a9;
if ( a2 <= 0 )
return;
if ( !GJEffectManager::isGroupEnabled(a1->m_effectManager, a2) )
return;
if ( a4 > a6 )
return;
m_start = a1->m_spawnGroupDelays.m_start;
if ( a4 <= m_start[a2] )
return;
m_start[a2] = a4;
v19 = (unsigned __int64)a2 >> 6;
TriggerGroup = LevelEditorLayer::getTriggerGroup(a1, a2);
v21 = 1LL << (a2 & 0x3F);
v22 = TriggerGroup;
if ( (v21 & a1->m_sortedGroups.m_start.m_bitptr[v19]) != 0 )
{
if ( v9 )
goto LABEL_8;
LABEL_25:
if ( v22 )
{
data = v22->data;
if ( data->num )
{
arr = (EffectGameObject **)data->arr;
v33 = &arr[data->num - 1];
if ( arr <= v33 )
{
v34 = *arr;
for ( i = 0; *arr; v34 = *arr )
{
if ( v34->m_isTrigger && v34->m_isSpawnTriggered )
{
v36 = 0;
if ( v34->m_isMultiTriggered || !v34->m_activatedByPlayer1 )
{
v34->m_spawnOrder = i++;
v34->m_spawnTriggerDelay = a4;
if ( v10 )
v36 = a4 > a1->m_drawGridLayer->m_oldPlaybackTime;
LevelEditorLayer::activateTriggerEffect(a1, v34, a5, a6, a7, v36);
v34->triggerActivated(v34, a3);
}
}
if ( v33 < ++arr )
break;
}
}
}
}
return;
}
if ( (unsigned int)cocos2d::CCArray::count(TriggerGroup) > 1 )
qsort(v22->data->arr, v22->data->num, 8u, (int (*)(const void *, const void *))xCompReal);
a1->m_sortedGroups.m_start.m_bitptr[v19] |= v21;
if ( !v9 )
goto LABEL_25;
LABEL_8:
if ( v22 )
{
v23 = v22->data;
if ( v23->num )
{
v24 = (EffectGameObject **)v23->arr;
v25 = &v24[v23->num - 1];
if ( v24 <= v25 )
{
v26 = *v24;
if ( *v24 )
{
x = 0.0;
v28 = 0;
while ( 1 )
{
if ( v26->m_isTrigger && v26->m_isSpawnTriggered && (v26->m_isMultiTriggered || !v26->m_activatedByPlayer1) )
{
getPosition = v26->getPosition;
if ( v28 )
{
v37 = (float)((float)(getPosition(v26)->x - x) / 311.58);
if ( v37 != 0.0 )
{
v38 = v37 + a4;
if ( v38 <= a6 )
{
v39 = v38;
LevelEditorLayer::addDelayedSpawn(a1, v26, v39);
}
goto LABEL_22;
}
}
else
{
x = getPosition(v26)->x;
}
v26->m_spawnOrder = 0;
v30 = 0;
v26->m_spawnTriggerDelay = a4;
if ( v10 )
v30 = a4 > a1->m_drawGridLayer->m_oldPlaybackTime;
v28 = 1;
LevelEditorLayer::activateTriggerEffect(a1, v26, a5, a6, a7, v30);
v26->triggerActivated(v26, a3);
}
LABEL_22:
if ( v25 >= ++v24 )
{
v26 = *v24;
if ( *v24 )
continue;
}
return;
}
}
}
}
}
}