//
// GJMGLayer::loadGroundSprites from 0x1006bf280 to 0x1006bf417 (407 bytes)
//
// 4 xrefs:
// > GJMGLayer::init @ 0x1006bf011
// > GJMGLayer::init @ 0x1006bf1bb
// > GJMGLayer::updateGroundWidth @ 0x1006bf73f
// > GJMGLayer::updateGroundWidth @ 0x1006bf74c
//
// 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 12:35:31 +0000
//
__int64 __fastcall GJMGLayer::loadGroundSprites(__int64 a1, int a2, unsigned __int8 a3)
{
__int64 v3; // rax
__int64 result; // rax
__int64 v5; // rbx
__int64 v7; // r12
__int64 v8; // rsi
unsigned int v9; // r13d
int v10; // r15d
__int64 v11; // rax
float *v12; // r13
int v13; // r15d
__int64 v14; // rax
float v15[12]; // [rsp+0h] [rbp-30h] BYREF
*(_QWORD *)v15 = v3;
result = a3 ^ 1u;
v5 = *(_QWORD *)(a1 + 8 * result + 408);
if ( v5 )
{
v7 = sub_1007FE900(a1);
if ( (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 488LL))(v5) )
{
v8 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 488LL))(v5);
sub_1007FEF70(v7, v8);
}
result = sub_1007FEF90(v7);
if ( (_DWORD)result != a2 )
{
v9 = sub_1007FEF90(v7);
result = sub_1007FEF90(v7);
v10 = result;
if ( v9 >= a2 )
{
if ( (int)result - a2 > 0 )
{
v13 = result - a2 + 1;
do
{
result = sub_1007FEF90(v7);
if ( !(_DWORD)result )
break;
v14 = sub_1007FF000(v7);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v5 + 552LL))(v5, v14, 1);
result = sub_1007FF120(v7, 1);
--v13;
}
while ( v13 > 1 );
}
}
else if ( (int)result < a2 )
{
do
{
v11 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 1072LL))(v5);
v12 = (float *)cocos2d::CCSprite::createWithTexture_1(v11);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v5 + 456LL))(v5, v12);
sub_100278250(v15, (float)v10 * v12[108], 0.0);
(*(void (__fastcall **)(float *, float *))(*(_QWORD *)v12 + 184LL))(v12, v15);
sub_100278250(v15, 0.0, 0.0);
(*(void (__fastcall **)(float *, float *))(*(_QWORD *)v12 + 296LL))(v12, v15);
result = (*(__int64 (__fastcall **)(float *, void *))(*(_QWORD *)v12 + 960LL))(v12, &unk_100A108C8);
++v10;
}
while ( a2 != v10 );
}
}
}
return result;
}