//
// GJGroundLayer::loadGroundSprites from 0x10002c008 to 0x10002c1e0 (472 bytes)
//
// 4 xrefs:
// > GJGroundLayer::init @ 0x10002bd58
// > GJGroundLayer::init @ 0x10002be30
// > GJGroundLayer::updateGroundWidth @ 0x10002c4c0
// > GJGroundLayer::updateGroundWidth @ 0x10002c4d0
//
// 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 __fastcall GJGroundLayer::loadGroundSprites(GJGroundLayer *a1, int a2, bool a3)
{
__int64 v3; // x8
__int64 v4; // x19
_BOOL4 v5; // w21
__int64 v8; // x24
__int64 v9; // x0
unsigned int v10; // w25
int v11; // w0
int v12; // w23
cocos2d::CCTexture2D *v13; // x0
cocos2d::CCSprite *v14; // x25
__n128 v15; // q0
__n128 v16; // q1
__n128 v17; // q0
__n128 v18; // q1
int v19; // w20
__int64 v20; // x0
int v21; // [xsp+8h] [xbp-48h] BYREF
v3 = 416;
if ( a3 )
v3 = 408;
v4 = *(__int64 *)((char *)&a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable + v3);
if ( v4 )
{
v5 = a3;
v8 = sub_10024A15C(a1);
if ( (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 472LL))(v4) )
{
v9 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 472LL))(v4);
sub_10024A360(v8, v9);
}
if ( (unsigned int)sub_10024A36C(v8) != a2 )
{
v10 = sub_10024A36C(v8);
v11 = sub_10024A36C(v8);
v12 = v11;
if ( v10 >= a2 )
{
if ( v11 - a2 >= 1 )
{
v19 = v11 - a2 + 1;
do
{
if ( !(unsigned int)sub_10024A36C(v8) )
break;
v20 = sub_10024A398(v8);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v4 + 536LL))(v4, v20, 1);
sub_10024A430(v8, 1);
--v19;
}
while ( v19 > 1 );
}
}
else if ( v11 < a2 )
{
do
{
v13 = (cocos2d::CCTexture2D *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 1056LL))(v4);
v14 = cocos2d::CCSprite::createWithTexture_1(v13);
(*(void (__fastcall **)(__int64, cocos2d::CCSprite *))(*(_QWORD *)v4 + 440LL))(v4, v14);
v16.n128_u32[0] = 0;
if ( v5 )
v16.n128_f32[0] = -a1->m_ground1Offset;
v15.n128_f32[0] = v14->m_obRect.size.width * (float)v12;
sub_100022980(v15, v16, &v21);
v17 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, int *))v14->setPosition)(v14, &v21);
v17.n128_u32[0] = 0;
v18.n128_u32[0] = 1.0;
sub_100022980(v17, v18, &v21);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v14->setAnchorPoint)(v14, &v21);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v14->setColor)(v14, &unk_100635654);
++v12;
}
while ( a2 != v12 );
}
}
}
}