//
// PlayLayer::createObjectsFromSetupFinished from 0x10011c090 to 0x10011c2a8 (536 bytes)
//
// 1 xrefs:
// > PlayLayer::processCreateObjectsFromSetup @ 0x1001167f8
//
// 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 PlayLayer::createObjectsFromSetupFinished(PlayLayer *a1)
{
cocos2d::CCArray *m_coinArray; // x0
__int64 v3; // x20
__int64 v4; // x0
unsigned int v5; // w21
unsigned int v6; // w0
cocos2d::CCDirector *v7; // x0
float v8; // s1
float v9; // s0
cocos2d::CCDirector *v10; // x0
EndPortalObject *v11; // x20
__n128 v12; // q0
__n128 v13; // q1
double *v14; // x0
int v15; // [xsp+8h] [xbp-28h] BYREF
m_coinArray = a1->m_coinArray;
if ( m_coinArray )
{
if ( (unsigned int)sub_10024A36C(m_coinArray) )
{
qsort(
a1->m_coinArray->data->arr,
a1->m_coinArray->data->num,
8u,
(int (__cdecl *)(const void *, const void *))sub_1001154BC);
if ( (unsigned int)sub_10024A36C(a1->m_coinArray) )
{
v3 = 0;
do
{
v4 = sub_10024A388(a1->m_coinArray, v3);
v5 = v3 + 1;
*(_DWORD *)(v4 + 1792) = v3 + 1;
EnhancedGameObject::updateUserCoin((EnhancedGameObject *)v4);
v6 = sub_10024A36C(a1->m_coinArray);
if ( (unsigned int)v3 > 1 )
break;
v3 = (unsigned int)(v3 + 1);
}
while ( v5 < v6 );
}
}
}
if ( !a1->m_isPlatformer )
{
v7 = cocos2d::CCDirector::sharedDirector();
v8 = sub_1001768E0(v7) + 300.0;
v9 = a1->m_maxObjectX + 340.0;
if ( v8 >= v9 )
{
v10 = cocos2d::CCDirector::sharedDirector();
v9 = sub_1001768E0(v10) + 300.0;
}
a1->m_levelLength = v9;
a1->m_endXPosition = v9;
v11 = EndPortalObject::create();
a1->m_endPortal = v11;
v12.n128_u32[0] = LODWORD(a1->m_levelLength);
v13.n128_u32[0] = 1130430464;
sub_100022980(v12, v13, &v15);
((void (__fastcall *)(EndPortalObject *, int *))v11->setStartPos)(v11, &v15);
a1->m_endPortal->m_defaultZOrder = 11;
((void (__fastcall *)(PlayLayer *))a1->addToSection)(a1);
sub_10024A2D0(a1->m_objects, a1->m_endPortal);
EndPortalObject::updateColors(
a1->m_endPortal,
(cocos2d::ccColor3B)(*(unsigned __int16 *)&a1->m_player1->m_playerColor1.r
| (a1->m_player1->m_playerColor1.b << 16)));
((void (__fastcall *)(EndPortalObject *, _QWORD))a1->m_endPortal->setVisible)(a1->m_endPortal, 0);
v14 = (double *)((__int64 (__fastcall *)(EndPortalObject *))a1->m_endPortal->getPosition)(a1->m_endPortal);
sub_1000229D0(&a1->m_endPosition, v14);
}
LevelTools::sortSpeedObjects(a1->m_speedObjects, a1);
GJBaseGameLayer::orderSpawnObjects(a1);
GJBaseGameLayer::updateMaxGameplayY(a1);
sub_10001783C((void ***)&a1->m_objectStrings);
sub_10024A45C(a1->m_coinArray);
cocos2d::CCObject::release(a1->m_coinArray);
a1->m_coinArray = nullptr;
++a1->m_nextColorKey;
sub_10011C2A8(&a1->m_keyColors);
sub_10011C2E0(&a1->m_keyOpacities, a1->m_nextColorKey);
sub_100123B3C(&a1->m_keyPulses, ((unsigned __int64)a1->m_nextColorKey >> 5) + 1);
}