//
// GJBaseGameLayer::checkSpawnObjects from 0x140322080 to 0x14032235a (730 bytes)
//
// 8 xrefs:
// > GJBaseGameLayer::loadUpToPosition @ 0x14033e97e
// > GJBaseGameLayer::loadUpToPosition @ 0x14033e994
// > GJBaseGameLayer::update @ 0x140341334
// > LevelEditorLayer::onPlaytest @ 0x1403fefc7
// > PlayLayer::setupHasCompleted @ 0x140505acf
// > PlayLayer::resetLevel @ 0x14051954a
// > ??> @ 0x14091ee78
// > ??> @ 0x14091ee84
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:30:23 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall GJBaseGameLayer::checkSpawnObjects(__int64 a1)
{
_BYTE *v2; // rcx
const struct cocos2d::CCPoint *v3; // rax
const struct cocos2d::CCPoint *v4; // rax
char v5; // r15
__int64 v6; // rcx
cocos2d::CCArray *v7; // rbx
unsigned int v8; // r14d
char v9; // si
struct cocos2d::CCObject *v10; // rax
struct cocos2d::CCObject *v11; // rbx
char v12; // r14
const struct cocos2d::CCPoint *v13; // rdx
bool v14; // cf
char v15; // cl
void *v17; // rcx
__int64 v18; // rax
_BYTE v19[4]; // [rsp+30h] [rbp-49h] BYREF
float v20; // [rsp+34h] [rbp-45h]
float v21; // [rsp+38h] [rbp-41h] BYREF
float v22; // [rsp+40h] [rbp-39h] BYREF
_BYTE v23[16]; // [rsp+48h] [rbp-31h] BYREF
_BYTE v24[16]; // [rsp+58h] [rbp-21h] BYREF
_BYTE v25[16]; // [rsp+68h] [rbp-11h] BYREF
__int128 v26; // [rsp+78h] [rbp-1h] BYREF
__int64 v27; // [rsp+88h] [rbp+Fh]
int v28; // [rsp+E0h] [rbp+67h] BYREF
float v29; // [rsp+E8h] [rbp+6Fh] BYREF
float v30; // [rsp+ECh] [rbp+73h]
float v31; // [rsp+F0h] [rbp+77h] BYREF
char v32; // [rsp+F8h] [rbp+7Fh] BYREF
float v33; // [rsp+FCh] [rbp+83h]
v2 = *(_BYTE **)(a1 + 3512);
if ( v2[2936] )
{
v3 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64, int *))(*(_QWORD *)a1 + 1264LL))(a1, &v28);
}
else
{
v4 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v2 + 200LL))(v2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, v4);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, v3);
v5 = 1;
do
{
v7 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 3568), *(int *)(a1 + 828));
if ( !v7 )
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
v28 = *(_DWORD *)(a1 + 828);
v8 = *(_DWORD *)(*(_QWORD *)sub_140067F60((_QWORD *)(a1 + 840), (__int64)v23, (unsigned __int8 *)&v28) + 20LL);
v9 = *(_BYTE *)(*(_QWORD *)sub_140358A00(a1 + 904, v24) + 20LL);
if ( cocos2d::CCArray::count(v7) <= v8 )
break;
v10 = cocos2d::CCArray::objectAtIndex(v7, v8);
v11 = v10;
v12 = 0;
if ( *((_BYTE *)v10 + 1488) )
{
if ( *((_BYTE *)v10 + 1459) )
{
v12 = 1;
LABEL_29:
if ( !*((_BYTE *)v11 + 654) && !v12 && (!*(_BYTE *)(a1 + 13721) || !*((_BYTE *)v11 + 1267)) )
{
if ( *((_DWORD *)v11 + 259) == 1268 )
{
v26 = 0;
v27 = 0;
SpawnTriggerGameObject::updateRemapKeys(v11, &v26);
v17 = (void *)v26;
if ( (_QWORD)v26 )
{
if ( ((v27 - (_QWORD)v26) & 0xFFFFFFFFFFFFFFFCuLL) >= 0x1000 )
{
v17 = *(void **)(v26 - 8);
if ( (unsigned __int64)(v26 - (_QWORD)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
}
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64, _QWORD, _QWORD))(*(_QWORD *)v11 + 1144LL))(
v11,
a1,
0,
0);
}
v18 = sub_140067F60((_QWORD *)(a1 + 840), (__int64)v25, (unsigned __int8 *)&v28);
++*(_DWORD *)(*(_QWORD *)v18 + 20LL);
goto LABEL_17;
}
}
else
{
v13 = (struct cocos2d::CCObject *)((char *)v10 + 1800);
if ( *(_BYTE *)(a1 + 12670) )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, v13);
if ( v29 >= v31 )
goto LABEL_29;
goto LABEL_16;
}
if ( *(_BYTE *)(*(_QWORD *)(a1 + 3512) + 2507LL) )
{
if ( !v9 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v32, v13);
v14 = v30 < v33;
goto LABEL_15;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v19, v13);
if ( v20 >= v30 )
goto LABEL_29;
}
else
{
if ( !v9 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v21, v13);
v14 = v29 < v21;
LABEL_15:
if ( !v14 )
goto LABEL_29;
goto LABEL_16;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v22, v13);
if ( v22 >= v29 )
goto LABEL_29;
}
}
LABEL_16:
v5 = 0;
LABEL_17:
v15 = 0;
if ( !*(_BYTE *)(a1 + 13648) )
v15 = v5;
v5 = v15;
}
while ( v15 );
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 1320LL))(a1);
}