//
// PlayLayer::createObjectsFromSetupFinished from 0x14050c1f0 to 0x14050c68a (1178 bytes)
//
// 2 xrefs:
// > PlayLayer::processCreateObjectsFromSetup @ 0x14050c125
// > ??> @ 0x14092a9a4
//
// 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:33:29 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall PlayLayer::createObjectsFromSetupFinished(__int64 a1)
{
cocos2d::CCArray *v2; // rcx
signed int v3; // ebx
struct cocos2d::CCObject *v4; // rax
cocos2d::CCDirector *v5; // rax
float v6; // xmm0_4
_QWORD *v7; // rsi
__int64 v8; // rbx
__int64 v9; // rax
__int64 v10; // rdx
__int64 v11; // rbx
__int64 v12; // rcx
__int64 v13; // rax
__int64 v14; // rbx
__int64 v15; // rsi
unsigned __int64 v16; // r9
__int64 v17; // rbp
__int64 v18; // r10
unsigned __int64 v19; // rcx
unsigned __int64 v20; // r9
__int64 v21; // rbx
__int16 v23; // [rsp+20h] [rbp-58h] BYREF
unsigned __int8 v24; // [rsp+22h] [rbp-56h]
__int16 v25; // [rsp+30h] [rbp-48h]
_QWORD *v26; // [rsp+40h] [rbp-38h] BYREF
float v27; // [rsp+48h] [rbp-30h]
int v28; // [rsp+4Ch] [rbp-2Ch]
v2 = *(cocos2d::CCArray **)(a1 + 14712);
if ( v2 )
{
if ( cocos2d::CCArray::count(v2) )
{
qsort(
*(void **)(*(_QWORD *)(*(_QWORD *)(a1 + 14712) + 56LL) + 16LL),
**(unsigned int **)(*(_QWORD *)(a1 + 14712) + 56LL),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_14030B1E0);
v3 = 0;
while ( v3 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 14712)) )
{
if ( v3 >= 3 )
break;
v4 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 14712), v3++);
*((_DWORD *)v4 + 452) = v3;
EnhancedGameObject::updateUserCoin((__int64)v4);
}
}
}
if ( !*(_BYTE *)(a1 + 12670) )
{
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v2);
v6 = fmaxf(cocos2d::CCDirector::getScreenRight(v5) + 300.0, *(float *)(a1 + 14976) + 340.0);
*(float *)(a1 + 13080) = v6;
*(float *)(a1 + 14892) = v6;
v7 = operator new(0x560u);
v26 = v7;
GameObject::GameObject((__int64)v7);
*v7 = &EndPortalObject::`vftable';
v7[40] = &EndPortalObject::`vftable';
v7[43] = &EndPortalObject::`vftable';
v7[170] = 0;
*((_WORD *)v7 + 684) = 0;
if ( EndPortalObject::init((__int64)v7) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v7);
}
else
{
(*(void (__fastcall **)(_QWORD *, __int64))(*v7 + 8LL))(v7, 1);
v7 = nullptr;
}
*(_QWORD *)(a1 + 13088) = v7;
v8 = *v7;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v26, *(float *)(a1 + 13080), 225.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v8 + 1216))(v7, v9);
*(_DWORD *)(*(_QWORD *)(a1 + 13088) + 1056LL) = 11;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1192LL))(a1, *(_QWORD *)(a1 + 13088));
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 3536), *(struct cocos2d::CCObject **)(a1 + 13088));
v10 = *(_QWORD *)(a1 + 3512);
v23 = *(_WORD *)(v10 + 2706);
v24 = *(_BYTE *)(v10 + 2708);
v11 = *(_QWORD *)(a1 + 13088);
v12 = *(_QWORD *)(v11 + 776);
if ( v12 )
{
v25 = *(_WORD *)(v10 + 2706);
*(float *)&v26 = (float)(unsigned __int8)v25 / 255.0;
*((float *)&v26 + 1) = (float)HIBYTE(v25) / 255.0;
v27 = (float)*(unsigned __int8 *)(v10 + 2708) / 255.0;
v28 = 1065353216;
(*(void (__fastcall **)(__int64, _QWORD **))(*(_QWORD *)v12 + 1352LL))(v12, &v26);
*(float *)&v26 = (float)(unsigned __int8)v23 / 255.0;
*((float *)&v26 + 1) = (float)HIBYTE(v23) / 255.0;
v27 = (float)v24 / 255.0;
v28 = 1065353216;
(*(void (__fastcall **)(_QWORD, _QWORD **))(**(_QWORD **)(v11 + 776) + 1384LL))(*(_QWORD *)(v11 + 776), &v26);
}
(**(void (__fastcall ***)(__int64, __int16 *))(*(_QWORD *)(v11 + 1360) + 320LL))(
*(_QWORD *)(v11 + 1360) + 320LL,
&v23);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 13088) + 336LL))(*(_QWORD *)(a1 + 13088), 0);
v13 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 13088) + 200LL))(*(_QWORD *)(a1 + 13088));
cocos2d::CCPoint::operator=(a1 + 15564, v13);
}
LevelTools::sortSpeedObjects(*(cocos2d::CCArray **)(a1 + 14912), a1);
GJBaseGameLayer::orderSpawnObjects(a1);
GJBaseGameLayer::updateMaxGameplayY(a1);
v14 = *(_QWORD *)(a1 + 14688);
v15 = *(_QWORD *)(a1 + 14696);
if ( v14 != v15 )
{
do
{
sub_14003D310(v14);
v14 += 32;
}
while ( v14 != v15 );
*(_QWORD *)(a1 + 14696) = *(_QWORD *)(a1 + 14688);
}
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 14712));
cocos2d::CCObject::release(*(cocos2d::CCObject **)(a1 + 14712));
*(_QWORD *)(a1 + 14712) = 0;
v16 = (int)++*(_DWORD *)(a1 + 15544);
v17 = *(_QWORD *)(a1 + 15480);
v18 = *(_QWORD *)(a1 + 15472);
v19 = (v17 - v18) / 3;
if ( v16 >= v19 )
{
if ( v16 > v19 )
{
if ( v16 <= (*(_QWORD *)(a1 + 15488) - v18) / 3 )
{
v20 = v16 - v19;
if ( v20 )
{
v21 = 3 * v20;
memset(*(void **)(a1 + 15480), 0, 3 * v20);
v17 += v21;
}
*(_QWORD *)(a1 + 15480) = v17;
}
else
{
sub_14051D2D0(a1 + 15472, *(int *)(a1 + 15544));
}
}
}
else
{
*(_QWORD *)(a1 + 15480) = v18 + 2 * v16 + v16;
}
sub_140083390(a1 + 15496, *(int *)(a1 + 15544));
return sub_14051BF10(a1 + 15520, ((unsigned __int64)*(int *)(a1 + 15544) >> 5) + 1);
}