//
// GJGroundLayer::loadGroundSprites from 0x43429c to 0x4343e4 (328 bytes)
//
// 4 xrefs:
// > GJGroundLayer::init @ 0x434880
// > GJGroundLayer::init @ 0x43490c
// > GJGroundLayer::updateGroundWidth @ 0x434a94
// > GJGroundLayer::updateGroundWidth @ 0x434a9e
//
// 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 GJGroundLayer::loadGroundSprites(GJGroundLayer *a1, int a2, bool a3)
{
cocos2d::CCSprite *m_ground2Sprite; // r4
_BOOL4 v6; // r10
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
cocos2d::CCNode *Object; // r0
void (__fastcall *v16)(float *, cocos2d::CCPoint *); // [sp+4h] [bp-18h]
void (__fastcall *v17)(float *, cocos2d::CCPoint *); // [sp+4h] [bp-18h]
cocos2d::CCPoint v18; // [sp+Ch] [bp-10h] BYREF
m_ground2Sprite = a1->m_ground2Sprite;
v6 = a3;
if ( a3 )
m_ground2Sprite = a1->m_ground1Sprite;
if ( m_ground2Sprite )
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)a1);
if ( m_ground2Sprite->getChildren(m_ground2Sprite) )
{
v8 = m_ground2Sprite->getChildren(m_ground2Sprite);
cocos2d::CCArray::addObjectsFromArray(v7, v8);
}
if ( cocos2d::CCArray::count(v7) != a2 )
{
if ( cocos2d::CCArray::count(v7) >= (unsigned int)a2 )
{
v14 = cocos2d::CCArray::count(v7) - a2;
while ( v14 > 0 && cocos2d::CCArray::count(v7) )
{
--v14;
Object = (cocos2d::CCNode *)cocos2d::CCArray::lastObject(v7);
m_ground2Sprite->removeChild_0(m_ground2Sprite, Object, 1);
cocos2d::CCArray::removeLastObject(v7, 1);
}
}
else
{
v9 = cocos2d::CCArray::count(v7);
while ( v9 < a2 )
{
v10 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))m_ground2Sprite->getTexture)(m_ground2Sprite);
v11 = (float *)cocos2d::CCSprite::createWithTexture(
(cocos2d::CCSprite *)v10,
(cocos2d::CCTexture2D *)HIDWORD(v10));
m_ground2Sprite->addChild(m_ground2Sprite, (cocos2d::CCNode *)v11);
v12 = (float)v9 * v11[86];
if ( v6 )
v13 = -a1->m_ground1Offset;
else
v13 = 0.0;
v16 = *(void (__fastcall **)(float *, cocos2d::CCPoint *))(*(_DWORD *)v11 + 92);
++v9;
cocos2d::CCPoint::CCPoint(&v18, v12, v13);
v16(v11, &v18);
v17 = *(void (__fastcall **)(float *, cocos2d::CCPoint *))(*(_DWORD *)v11 + 140);
cocos2d::CCPoint::CCPoint(&v18, 0.0, 1.0);
v17(v11, &v18);
(*(void (__fastcall **)(float *, _UNKNOWN **))(*(_DWORD *)v11 + 472))(v11, &off_9AB688);
}
}
}
}
}