//
// PlayLayer::createObjectsFromSetupFinished from 0x4048d4 to 0x404b08 (564 bytes)
//
// 1 xrefs:
// > PlayLayer::processCreateObjectsFromSetup @ 0x40ac1a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:47:27 +0000
//
void __fastcall PlayLayer::createObjectsFromSetupFinished(PlayLayer *this, int a2, GJBaseGameLayer *a3)
{
cocos2d::CCArray *v4; // r0
unsigned int v5; // r5
cocos2d::CCArray **v6; // r7
cocos2d::CCDirector *v7; // r0
float v8; // r0
float v9; // s15
cocos2d::CCDirector *v10; // r0
int v11; // r0
int v12; // r8
void (__fastcall *v13)(int, _DWORD *); // r10
_BYTE *v14; // r3
int v15; // r0
char v16; // r2
char v17; // r1
int v18; // r0
int v19; // r7
int *v20; // r5
int v21; // r0
unsigned int v22; // r3
int v23; // r5
unsigned int v24; // r1
int v25; // r3
_DWORD *i; // r1
unsigned int v27; // r1
int v28; // r2
unsigned int v29; // r3
int v30; // r2
_DWORD *j; // r1
EnhancedGameObject *v32; // r0
_DWORD v33[2]; // [sp+4h] [bp-Ch] BYREF
v4 = *((cocos2d::CCArray **)this + 2931);
if ( v4 )
{
v4 = (cocos2d::CCArray *)cocos2d::CCArray::count(v4);
if ( v4 )
{
v5 = 0;
v6 = (cocos2d::CCArray **)((char *)this + 11724);
qsort(
*(void **)(*(_DWORD *)(*((_DWORD *)this + 2931) + 52) + 12),
**(_DWORD **)(*((_DWORD *)this + 2931) + 52),
4u,
(int (*)(const void *, const void *))xCompRealPos);
while ( 1 )
{
v4 = (cocos2d::CCArray *)cocos2d::CCArray::count(*v6);
if ( v5 >= (unsigned int)v4 || v5 == 3 )
break;
v32 = (EnhancedGameObject *)cocos2d::CCArray::objectAtIndex(*v6, v5++);
*((_DWORD *)v32 + 402) = v5;
EnhancedGameObject::updateUserCoin(v32);
}
}
}
if ( !*((_BYTE *)this + 10614) )
{
v7 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v4);
v8 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v7));
v9 = *((float *)this + 2974) + 340.0;
if ( (float)(v8 + 300.0) >= v9 )
{
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v8));
v8 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v10));
v9 = v8 + 300.0;
}
*((float *)this + 2706) = v9;
*((float *)this + 2960) = v9;
v11 = EndPortalObject::create((EndPortalObject *)LODWORD(v8));
*((_DWORD *)this + 2708) = v11;
v12 = v11;
v13 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v11 + 684);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v33, *((float *)this + 2706), 225.0);
v13(v12, v33);
*(_DWORD *)(*((_DWORD *)this + 2708) + 912) = 11;
(*(void (__fastcall **)(PlayLayer *, _DWORD))(*(_DWORD *)this + 672))(this, *((_DWORD *)this + 2708));
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 522), *((cocos2d::CCObject **)this + 2708));
v14 = *((_BYTE **)this + 519);
v15 = *((_DWORD *)this + 2708);
v16 = v14[2108];
v17 = v14[2107];
LOBYTE(v14) = v14[2106];
BYTE2(v33[0]) = v16;
BYTE1(v33[0]) = v17;
LOBYTE(v33[0]) = (_BYTE)v14;
EndPortalObject::updateColors(v15, v33[0]);
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 2708) + 172))(*((_DWORD *)this + 2708), 0);
v18 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 2708) + 96))(*((_DWORD *)this + 2708));
cocos2d::CCPoint::operator=((char *)this + 12288, v18);
}
LevelTools::sortSpeedObjects(*((LevelTools **)this + 2963), this, a3);
GJBaseGameLayer::orderSpawnObjects(this);
GJBaseGameLayer::updateMaxGameplayY(this);
v19 = *((_DWORD *)this + 2928);
v20 = (int *)((char *)this + 11716);
while ( v19 != *v20 )
{
v21 = *v20 - 12;
*v20 = v21;
std::string::~string(v21);
}
cocos2d::CCArray::removeAllObjects(*((cocos2d::CCArray **)this + 2931));
cocos2d::CCObject::release(*((cocos2d::CCObject **)this + 2931));
*((_DWORD *)this + 2931) = 0;
v22 = *((_DWORD *)this + 3068) + 1;
*((_DWORD *)this + 3068) = v22;
v23 = *((_DWORD *)this + 3059);
v24 = -1431655765 * (*((_DWORD *)this + 3060) - v23);
if ( v24 >= v22 )
{
if ( v24 > v22 )
{
v25 = 3 * v22 + v23;
for ( i = (_DWORD *)((char *)this + 12240); v25 != *i; *i -= 3 )
;
}
}
else
{
std::vector::__append((void **)this + 3059, v22 - v24);
}
v27 = *((_DWORD *)this + 3068);
v28 = *((_DWORD *)this + 3062);
v29 = (*((_DWORD *)this + 3063) - v28) >> 2;
if ( v29 >= v27 )
{
if ( v29 > v27 )
{
v30 = v28 + 4 * v27;
for ( j = (_DWORD *)((char *)this + 12252); v30 != *j; *j -= 4 )
;
}
}
else
{
std::vector::__append((int)this + 12248, v27 - v29);
}
std::vector>::resize((int)this + 12260, (*((_DWORD *)this + 3068) >> 5) + 1);
}