//
// GJMGLayer::loadGroundSprites from 0x1005ec1f0 to 0x1005ec387 (407 bytes)
//
// 4 xrefs:
// > GJMGLayer::init @ 0x1005ebf81
// > GJMGLayer::init @ 0x1005ec12b
// > GJMGLayer::updateGroundWidth @ 0x1005ec6af
// > GJMGLayer::updateGroundWidth @ 0x1005ec6bc
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall GJMGLayer::loadGroundSprites(GJMGLayer *a1, int a2, bool a3)
{
__int64 v3; // rax
__int64 v4; // rbx
__int64 v6; // r12
__int64 v7; // rsi
unsigned int v8; // r13d
int v9; // r15d
cocos2d::CCTexture2D *v10; // rax
cocos2d::CCSprite *v11; // r13
int v12; // r15d
int v13; // r15d
__int64 v14; // rax
float v15[12]; // [rsp+0h] [rbp-30h] BYREF
*(_QWORD *)v15 = v3;
v4 = *((_QWORD *)&a1->m_ground1Sprite + !a3);
if ( v4 )
{
v6 = sub_10071F9E0(a1, *(_QWORD *)&a2);
if ( (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 472LL))(v4) )
{
v7 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 472LL))(v4);
sub_100720050(v6, v7);
}
if ( (unsigned int)sub_100720070(v6) != a2 )
{
v8 = sub_100720070(v6);
v9 = sub_100720070(v6);
if ( v8 >= a2 )
{
v12 = v9 - a2;
if ( v12 > 0 )
{
v13 = v12 + 1;
do
{
if ( !(unsigned int)sub_100720070(v6) )
break;
v14 = sub_1007200E0(v6);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v4 + 536LL))(v4, v14, 1);
sub_100720200(v6, 1);
--v13;
}
while ( v13 > 1 );
}
}
else if ( v9 < a2 )
{
do
{
v10 = (cocos2d::CCTexture2D *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 1056LL))(v4);
v11 = cocos2d::CCSprite::createWithTexture_1(v10);
(*(void (__fastcall **)(__int64, cocos2d::CCSprite *))(*(_QWORD *)v4 + 440LL))(v4, v11);
sub_10028CBE0(v15, (float)v9 * v11->m_obRect.size.width, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v11->setPosition)(v11, v15);
sub_10028CBE0(v15, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v11->setAnchorPoint)(v11, v15);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v11->setColor)(v11, &unk_1008219C8);
++v9;
}
while ( a2 != v9 );
}
}
}
}