//
// GJMGLayer::loadGroundSprites from 0x7eca54 to 0x7ecc30 (476 bytes)
//
// 5 xrefs:
// > GJMGLayer::init @ 0x7ecef4
// > GJMGLayer::init @ 0x7ed04c
// > GJMGLayer::updateGroundWidth @ 0x7ed36c
// > GJMGLayer::updateGroundWidth @ 0x7ed37c
// > ??> @ 0xb16a8
//
// 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 GJMGLayer::loadGroundSprites(GJMGLayer *a1, int a2, bool a3)
{
cocos2d::CCSprite *m_ground1Sprite; // x20
cocos2d::CCSprite *m_ground2Sprite; // x0
cocos2d::CCArray *v6; // x19
cocos2d::CCArray *v7; // x0
int v8; // w22
cocos2d::CCSprite *v9; // x0
cocos2d::CCTexture2D *v10; // x1
float *v11; // x19
float v12; // s0
void (__fastcall *v13)(float *, cocos2d::CCPoint *); // x25
void (__fastcall *v14)(float *, cocos2d::CCPoint *); // x25
int v15; // w0
int v16; // w21
__int64 Object; // x0
cocos2d::CCPoint v18; // [xsp+50h] [xbp+50h] BYREF
m_ground1Sprite = a1->m_ground1Sprite;
m_ground2Sprite = a1->m_ground2Sprite;
if ( !a3 )
m_ground1Sprite = m_ground2Sprite;
if ( m_ground1Sprite )
{
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)m_ground2Sprite);
if ( m_ground1Sprite->getChildren(m_ground1Sprite) )
{
v7 = m_ground1Sprite->getChildren(m_ground1Sprite);
cocos2d::CCArray::addObjectsFromArray(v6, v7);
}
if ( (unsigned int)cocos2d::CCArray::count(v6) != a2 )
{
if ( a2 > (unsigned int)cocos2d::CCArray::count(v6) )
{
v8 = cocos2d::CCArray::count(v6);
if ( a2 > v8 )
{
do
{
v9 = (cocos2d::CCSprite *)m_ground1Sprite->getTexture(m_ground1Sprite);
v11 = (float *)cocos2d::CCSprite::createWithTexture(v9, v10);
m_ground1Sprite->addChild(m_ground1Sprite, (cocos2d::CCNode *)v11);
v12 = (float)v8++;
v13 = *(void (__fastcall **)(float *, cocos2d::CCPoint *))(*(_QWORD *)v11 + 184LL);
cocos2d::CCPoint::CCPoint(&v18, v12 * v11[108], 0.0);
v13(v11, &v18);
v14 = *(void (__fastcall **)(float *, cocos2d::CCPoint *))(*(_QWORD *)v11 + 280LL);
cocos2d::CCPoint::CCPoint(&v18, 0.0, 0.0);
v14(v11, &v18);
(*(void (__fastcall **)(float *, void *))(*(_QWORD *)v11 + 944LL))(v11, &unk_ED4710);
}
while ( v8 != a2 );
}
}
else
{
v15 = cocos2d::CCArray::count(v6);
v16 = v15 - a2;
if ( v16 > 0 )
{
do
{
if ( !(unsigned int)cocos2d::CCArray::count(v6) )
break;
--v16;
Object = cocos2d::CCArray::lastObject(v6);
m_ground1Sprite->removeChild_0(m_ground1Sprite, (cocos2d::CCNode *)Object, 1);
cocos2d::CCArray::removeLastObject(v6, 1);
}
while ( v16 );
}
}
}
}
}