//
// GJGroundLayer::loadGroundSprites from 0x545b54 to 0x545c9c (328 bytes)
//
// 4 xrefs:
// > GJGroundLayer::init @ 0x546134
// > GJGroundLayer::init @ 0x5461c4
// > GJGroundLayer::updateGroundWidth @ 0x54634c
// > GJGroundLayer::updateGroundWidth @ 0x546356
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:23 +0000
//
cocos2d::CCArray *__fastcall GJGroundLayer::loadGroundSprites(cocos2d::CCArray *this, unsigned int a2, int a3)
{
cocos2d::CCArray *v3; // r9
int v4; // r4
cocos2d::CCArray *v7; // r5
cocos2d::CCArray *v8; // r0
int v9; // r5
__int64 v10; // r0
float *v11; // r7
float v12; // s15
float v13; // s14
int v14; // r6
int Object; // r0
void (__fastcall *v16)(float *, _BYTE *); // [sp+4h] [bp-18h]
void (__fastcall *v17)(float *, _BYTE *); // [sp+4h] [bp-18h]
_BYTE v18[8]; // [sp+Ch] [bp-10h] BYREF
v3 = this;
v4 = *((_DWORD *)this + 80);
if ( a3 )
v4 = *((_DWORD *)this + 79);
if ( v4 )
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(this);
if ( (*(int (__fastcall **)(int))(*(_DWORD *)v4 + 244))(v4) )
{
v8 = (cocos2d::CCArray *)(*(int (__fastcall **)(int))(*(_DWORD *)v4 + 244))(v4);
cocos2d::CCArray::addObjectsFromArray(v7, v8);
}
this = (cocos2d::CCArray *)cocos2d::CCArray::count(v7);
if ( this != (cocos2d::CCArray *)a2 )
{
if ( cocos2d::CCArray::count(v7) >= a2 )
{
this = (cocos2d::CCArray *)cocos2d::CCArray::count(v7);
v14 = (int)this - a2;
while ( v14 > 0 )
{
this = (cocos2d::CCArray *)cocos2d::CCArray::count(v7);
if ( !this )
break;
--v14;
Object = cocos2d::CCArray::lastObject(v7);
(*(void (__fastcall **)(int, int, int))(*(_DWORD *)v4 + 276))(v4, Object, 1);
this = (cocos2d::CCArray *)cocos2d::CCArray::removeLastObject(v7, 1);
}
}
else
{
this = (cocos2d::CCArray *)cocos2d::CCArray::count(v7);
v9 = (int)this;
while ( v9 < (int)a2 )
{
v10 = ((__int64 (__fastcall *)(int))*(_DWORD *)(*(_DWORD *)v4 + 536))(v4);
v11 = (float *)cocos2d::CCSprite::createWithTexture(
(cocos2d::CCSprite *)v10,
(cocos2d::CCTexture2D *)HIDWORD(v10));
(*(void (__fastcall **)(int, float *))(*(_DWORD *)v4 + 228))(v4, v11);
v12 = (float)v9 * v11[86];
if ( a3 )
v13 = -*((float *)v3 + 84);
else
v13 = 0.0;
v16 = *(void (__fastcall **)(float *, _BYTE *))(*(_DWORD *)v11 + 92);
++v9;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v18, v12, v13);
v16(v11, v18);
v17 = *(void (__fastcall **)(float *, _BYTE *))(*(_DWORD *)v11 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v18, 0.0, 1.0);
v17(v11, v18);
this = (cocos2d::CCArray *)(*(int (__fastcall **)(float *, void *))(*(_DWORD *)v11 + 480))(v11, &unk_BECFD0);
}
}
}
}
return this;
}