//
// GJBaseGameLayer::checkSpawnObjects from 0x1001ebe3c to 0x1001ec08c (592 bytes)
//
// 6 xrefs:
// > PlayLayer::setupHasCompleted @ 0x100117310
// > PlayLayer::resetLevel @ 0x10012220c
// > GJBaseGameLayer::loadUpToPosition @ 0x1001fce34
// > GJBaseGameLayer::loadUpToPosition @ 0x1001fce44
// > GJBaseGameLayer::update @ 0x1001fed0c
// > LevelEditorLayer::onPlaytest @ 0x100362e98
//
// 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 GJBaseGameLayer::checkSpawnObjects(GJBaseGameLayer *a1)
{
bool *p_m_isPlatformer; // x23
PlayerObject *m_player1; // x0
float m_levelTime; // s0
__int64 *v5; // x0
cocos2d::CCArray *ActiveOrderSpawnObjects; // x21
__int64 v7; // x22
char v8; // w25
__int64 v9; // x0
SpawnTriggerGameObject *v10; // x21
float v11; // s0
float v12; // s1
float v13; // s0
float v14; // s1
_QWORD *v15; // x0
std::vector __p; // [xsp+0h] [xbp-70h] BYREF
__int64 v17; // [xsp+1Ch] [xbp-54h] BYREF
int m_currentChannel; // [xsp+24h] [xbp-4Ch] BYREF
__int64 v19; // [xsp+28h] [xbp-48h] BYREF
p_m_isPlatformer = &a1->m_isPlatformer;
m_player1 = a1->m_player1;
if ( m_player1->m_isPlatformer )
{
m_levelTime = a1->m_gameState.m_levelTime;
((void (__fastcall *)(__int64 *__return_ptr, GJBaseGameLayer *, float))a1->posForTime)(&v19, a1, m_levelTime);
}
else
{
v5 = (__int64 *)((__int64 (__fastcall *)(PlayerObject *))m_player1->getPosition)(m_player1);
sub_1000229B8(&v19, v5);
}
do
{
ActiveOrderSpawnObjects = GJBaseGameLayer::getActiveOrderSpawnObjects(a1);
m_currentChannel = a1->m_gameState.m_currentChannel;
__p.__begin_ = &m_currentChannel;
v7 = *((unsigned int *)sub_10001D150(
(unsigned __int64)&a1->m_gameState.m_spawnChannelRelated0,
&m_currentChannel,
(__int64)&unk_10063A31C,
&__p.__begin_)
+ 5);
__p.__begin_ = &m_currentChannel;
v8 = *((_BYTE *)sub_100018B20(
(float *)&a1->m_gameState.m_spawnChannelRelated1,
&m_currentChannel,
(__int64)&unk_10063A31C,
&__p.__begin_)
+ 20);
if ( (unsigned int)sub_10024A36C(ActiveOrderSpawnObjects) <= (unsigned int)v7 )
break;
v9 = sub_10024A388(ActiveOrderSpawnObjects, v7);
v10 = (SpawnTriggerGameObject *)v9;
if ( (*(_BYTE *)(v9 + 1472) & 1) != 0 )
{
if ( (*(_BYTE *)(v9 + 1443) & 1) == 0 )
break;
goto LABEL_23;
}
if ( *p_m_isPlatformer )
goto LABEL_9;
if ( !a1->m_player1->m_isSideways )
{
if ( (v8 & 1) != 0 )
{
sub_1000229B8(&v17, (__int64 *)(v9 + 1784));
v13 = *(float *)&v17;
v14 = *(float *)&v19;
LABEL_17:
if ( v13 < v14 )
break;
goto LABEL_18;
}
LABEL_9:
sub_1000229B8((__int64 *)&__p, (__int64 *)(v9 + 1784));
v11 = *(float *)&__p.__begin_;
v12 = *(float *)&v19;
goto LABEL_10;
}
if ( (v8 & 1) != 0 )
{
sub_1000229B8(&v17, (__int64 *)(v9 + 1784));
v13 = *((float *)&v17 + 1);
v14 = *((float *)&v19 + 1);
goto LABEL_17;
}
sub_1000229B8((__int64 *)&__p, (__int64 *)(v9 + 1784));
v11 = *((float *)&__p.__begin_ + 1);
v12 = *((float *)&v19 + 1);
LABEL_10:
if ( v11 > v12 )
break;
LABEL_18:
if ( !v10->m_isGroupDisabled )
{
if ( v10->m_objectID == 1268 )
{
memset(&__p, 0, sizeof(__p));
SpawnTriggerGameObject::updateRemapKeys(v10, &__p);
if ( __p.__begin_ )
{
__p.__end_ = __p.__begin_;
operator delete(__p.__begin_);
}
}
((void (__fastcall *)(SpawnTriggerGameObject *, GJBaseGameLayer *, _QWORD, _QWORD))v10->triggerObject)(
v10,
a1,
0,
0);
}
LABEL_23:
__p.__begin_ = &m_currentChannel;
v15 = sub_10001D150(
(unsigned __int64)&a1->m_gameState.m_spawnChannelRelated0,
&m_currentChannel,
(__int64)&unk_10063A31C,
&__p.__begin_);
++*((_DWORD *)v15 + 5);
}
while ( !p_m_isPlatformer[826] );
((void (__fastcall *)(GJBaseGameLayer *, float))a1->applyTimeWarp)(a1, a1->m_gameState.m_timeWarp);
}