//
// PlayLayer::prepareCreateObjectsFromSetup from 0x31aa24 to 0x31abc8 (420 bytes)
//
// 1 xrefs:
// > PlayLayer::init @ 0x31ce84
//
// 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
//
int __fastcall PlayLayer::prepareCreateObjectsFromSetup(int a1, _DWORD *a2)
{
_BOOL4 v4; // r5
cocos2d::CCArray *v5; // r0
int v6; // r0
int v7; // r9
int v8; // r10
int v9; // r0
const std::string *v10; // r1
cocos2d::CCObject *v11; // r0
GJEffectManager *v12; // r0
_BYTE *v13; // r3
char v14; // r2
char v15; // r5
char v16; // r1
char v17; // r2
GameManager *v18; // r0
cocos2d::CCObject *v19; // r0
int v21; // [sp+4h] [bp-20h]
int v22; // [sp+14h] [bp-10h] BYREF
int v23; // [sp+18h] [bp-Ch] BYREF
sub_776584((int)&v22, " ");
if ( sub_774DBC(a2, &v22) )
{
sub_776584((int)&v23, (char *)&unk_939830);
v4 = sub_774DBC(a2, &v23) != 0;
sub_774008(&v23);
}
else
{
v4 = 0;
}
v5 = (cocos2d::CCArray *)sub_774008(&v22);
if ( v4 )
{
v6 = sub_774A78((int)a2, ";");
v7 = 0;
v21 = *(_DWORD *)(*a2 - 12);
v8 = v6;
while ( 1 )
{
sub_776158(&v23, a2, v7, v8 - v7);
if ( *(_DWORD *)(v23 - 12) || v7 != v21 )
{
v9 = *(_DWORD *)(a1 + 11784);
if ( v9 == *(_DWORD *)(a1 + 11788) )
{
std::vector::_M_emplace_back_aux(a1 + 11780, (int)&v23);
}
else
{
if ( v9 )
sub_775C20(v9, &v23);
*(_DWORD *)(a1 + 11784) += 4;
}
}
if ( v8 == -1 )
break;
v7 = v8 + 1;
v8 = sub_774A78((int)a2, ";");
sub_774008(&v23);
}
sub_774008(&v23);
v11 = (cocos2d::CCObject *)LevelSettingsObject::objectFromString(*(LevelSettingsObject **)(a1 + 11780), v10);
*(_DWORD *)(a1 + 2240) = v11;
cocos2d::CCObject::retain(v11);
*(_DWORD *)(*(_DWORD *)(a1 + 2240) + 320) = *(_DWORD *)(a1 + 1544);
GJBaseGameLayer::loadLevelSettings((GJBaseGameLayer *)a1);
v12 = *(GJEffectManager **)(*(_DWORD *)(a1 + 2240) + 264);
v13 = *(_BYTE **)(a1 + 2232);
v14 = v13[2132];
v15 = v13[2130];
BYTE1(v22) = v13[2131];
BYTE2(v22) = v14;
LOBYTE(v22) = v15;
v16 = v13[2134];
v17 = v13[2135];
LOBYTE(v13) = v13[2133];
BYTE1(v23) = v16;
BYTE2(v23) = v17;
LOBYTE(v23) = (_BYTE)v13;
GJEffectManager::updateColors(v12, (cocos2d::ccColor3B)v22, (cocos2d::ccColor3B)v23);
v18 = GameManager::sharedState();
GameManager::loadFont(v18, *(_DWORD *)(*(_DWORD *)(a1 + 2240) + 300));
}
v19 = (cocos2d::CCObject *)cocos2d::CCArray::create(v5);
*(_DWORD *)(a1 + 11792) = v19;
cocos2d::CCObject::retain(v19);
*(_DWORD *)(a1 + 11800) = 1;
return sub_7751A8(a2);
}