//
// GJMGLayer::loadGroundSprites from 0x1403880b0 to 0x14038826e (446 bytes)
//
// 8 xrefs:
// > GJBaseGameLayer::updateCameraBGArt @ 0x140348793
// > GJBaseGameLayer::updateCameraBGArt @ 0x1403487a0
// > GJMGLayer::init @ 0x140387df6
// > GJMGLayer::init @ 0x140387fbb
// > ??> @ 0x1408bda18
// > ??> @ 0x1408bda94
// > ??> @ 0x1408bdaac
// > ??> @ 0x140922be0
//
// 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:31:08 +0000
//
void __fastcall GJMGLayer::loadGroundSprites(__int64 a1, int a2, unsigned __int8 a3)
{
_QWORD *v4; // rsi
cocos2d::CCArray *v5; // rbx
struct cocos2d::CCArray *v6; // rax
int i; // r14d
struct cocos2d::CCTexture2D *v8; // rax
struct cocos2d::CCSprite *v9; // rdi
__int64 v10; // rbx
__int64 v11; // rax
__int64 v12; // rbx
__int64 v13; // rax
int v14; // edi
struct cocos2d::CCObject *Object; // rax
__int64 v16; // r8
_BYTE v17[16]; // [rsp+20h] [rbp-28h] BYREF
char v18; // [rsp+68h] [rbp+20h] BYREF
v4 = *(_QWORD **)(a1 + 8 * (a3 ^ 1LL) + 408);
if ( v4 )
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
if ( (*(__int64 (__fastcall **)(_QWORD *))(*v4 + 480LL))(v4) )
{
v6 = (struct cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD *))(*v4 + 480LL))(v4);
cocos2d::CCArray::addObjectsFromArray(v5, v6);
}
if ( cocos2d::CCArray::count(v5) != a2 )
{
if ( cocos2d::CCArray::count(v5) >= a2 )
{
v14 = cocos2d::CCArray::count(v5) - a2;
while ( v14 > 0 )
{
if ( !cocos2d::CCArray::count(v5) )
break;
--v14;
Object = cocos2d::CCArray::lastObject(v5);
LOBYTE(v16) = 1;
(*(void (__fastcall **)(_QWORD *, struct cocos2d::CCObject *, __int64))(*v4 + 536LL))(v4, Object, v16);
cocos2d::CCArray::removeLastObject(v5, 1);
}
}
else
{
for ( i = cocos2d::CCArray::count(v5); i < a2; ++i )
{
v8 = (struct cocos2d::CCTexture2D *)(*(__int64 (__fastcall **)(_QWORD *))(v4[43] + 16LL))(v4 + 43);
v9 = cocos2d::CCSprite::createWithTexture(v8);
(*(void (__fastcall **)(_QWORD *, struct cocos2d::CCSprite *))(*v4 + 464LL))(v4, v9);
v10 = *(_QWORD *)v9;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v18, (float)i * *((float *)v9 + 108), 0.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v10 + 184))(v9, v11);
v12 = *(_QWORD *)v9;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, 0.0, 0.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v12 + 288))(v9, v13);
(**((void (__fastcall ***)(__int64, void *))v9 + 40))((__int64)v9 + 320, &unk_140703478);
}
}
}
}
}