//
// PlayLayer::createObjectsFromSetupFinished from 0x1000b69f0 to 0x1000b6d11 (801 bytes)
//
// 1 xrefs:
// > PlayLayer::processCreateObjectsFromSetup @ 0x1000adbf5
//
// 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)
{
__int64 v1; // rax
cocos2d::CCArray *m_coinArray; // rdi
unsigned int v4; // r15d
unsigned int v5; // r14d
__int64 v6; // rax
unsigned int v7; // eax
cocos2d::CCDirector *v8; // rax
float v9; // xmm1_4
float v10; // xmm0_4
cocos2d::CCDirector *v11; // rax
EndPortalObject *v12; // r14
std::string *begin; // r14
std::__vector_base::pointer i; // r15
unsigned __int64 m_nextColorKey; // rax
std::__vector_base::pointer v16; // rcx
signed __int64 v17; // rdx
std::__vector_base::pointer v18; // rcx
unsigned __int64 v19; // rdx
unsigned __int64 v20; // rax
unsigned __int64 v21; // rsi
std::__vector_base::pointer v22; // rcx
unsigned __int64 v23; // rdx
_QWORD v24[4]; // [rsp+0h] [rbp-20h] BYREF
v24[0] = v1;
m_coinArray = a1->m_coinArray;
if ( m_coinArray )
{
if ( (unsigned int)sub_100720070(m_coinArray) )
{
qsort(
a1->m_coinArray->data->arr,
a1->m_coinArray->data->num,
8u,
(int (__cdecl *)(const void *, const void *))sub_1000ABCD0);
if ( (unsigned int)sub_100720070(a1->m_coinArray) )
{
v4 = 0;
do
{
v5 = v4;
v6 = sub_1007200C0(a1->m_coinArray, v4++);
*(_DWORD *)(v6 + 1792) = v4;
EnhancedGameObject::updateUserCoin((EnhancedGameObject *)v6);
v7 = sub_100720070(a1->m_coinArray);
}
while ( v5 <= 1 && v4 < v7 );
}
}
}
if ( !a1->m_isPlatformer )
{
v8 = cocos2d::CCDirector::sharedDirector();
v9 = sub_100484DA0(v8) + 300.0;
v10 = a1->m_maxObjectX + 340.0;
if ( v10 <= v9 )
{
v11 = cocos2d::CCDirector::sharedDirector();
v10 = sub_100484DA0(v11) + 300.0;
}
a1->m_levelLength = v10;
a1->m_endXPosition = v10;
v12 = EndPortalObject::create();
a1->m_endPortal = v12;
sub_10028CBE0(v24, a1->m_levelLength, 225.0);
((void (__fastcall *)(EndPortalObject *, _QWORD *))v12->setStartPos)(v12, v24);
a1->m_endPortal->m_defaultZOrder = 11;
((void (__fastcall *)(PlayLayer *))a1->addToSection)(a1);
sub_10071FCD0(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);
((void (__fastcall *)(EndPortalObject *))a1->m_endPortal->getPosition)(a1->m_endPortal);
sub_10028CC90();
}
LevelTools::sortSpeedObjects(a1->m_speedObjects, a1);
GJBaseGameLayer::orderSpawnObjects(a1);
GJBaseGameLayer::updateMaxGameplayY(a1);
begin = a1->m_objectStrings.__begin_;
for ( i = a1->m_objectStrings.__end_; i != begin; --i )
{
if ( (i[-1].m_data.m_short.sizex2 & 1) != 0 )
operator delete(i[-1].m_data.m_long.longStorage);
}
a1->m_objectStrings.__end_ = begin;
sub_100720270(a1->m_coinArray);
cocos2d::CCObject::release(a1->m_coinArray);
a1->m_coinArray = nullptr;
m_nextColorKey = a1->m_nextColorKey + 1LL;
a1->m_nextColorKey = m_nextColorKey;
v16 = a1->m_keyColors.__begin_;
v17 = (char *)a1->m_keyColors.__end_ - (char *)v16;
if ( m_nextColorKey <= 0xAAAAAAAAAAAAAAABLL * v17 )
{
if ( m_nextColorKey < 0xAAAAAAAAAAAAAAABLL * v17 )
a1->m_keyColors.__end_ = &v16[m_nextColorKey];
}
else
{
sub_1000CAF40(&a1->m_keyColors, m_nextColorKey - 0xAAAAAAAAAAAAAAABLL * v17);
m_nextColorKey = a1->m_nextColorKey;
}
v18 = a1->m_keyOpacities.__begin_;
v19 = a1->m_keyOpacities.__end_ - v18;
if ( m_nextColorKey <= v19 )
{
if ( m_nextColorKey < v19 )
a1->m_keyOpacities.__end_ = &v18[m_nextColorKey];
}
else
{
sub_1000CB0D0(&a1->m_keyOpacities, m_nextColorKey - v19);
m_nextColorKey = a1->m_nextColorKey;
}
v20 = m_nextColorKey >> 5;
v21 = v20 + 1;
v22 = a1->m_keyPulses.m_bits.__begin_;
v23 = ((char *)a1->m_keyPulses.m_bits.__end_ - (char *)v22) >> 3;
if ( v23 <= v20 )
{
sub_1000C0F40(&a1->m_keyPulses, v21 - v23);
}
else if ( v21 < v23 )
{
a1->m_keyPulses.m_bits.__end_ = &v22[2 * v21];
}
}