//
// GJGroundLayer::init from 0x1006bdb20 to 0x1006bdffd (1245 bytes)
//
// 1 xrefs:
// > GJGroundLayer::create @ 0x1006bdadb
//
// 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:30 +0000
//
bool __fastcall GJGroundLayer::init(__int64 a1, int a2, unsigned int a3)
{
bool result; // al
__int64 v5; // rax
__int64 v6; // rax
__int64 GTexture; // r14
double Line; // xmm0_8
char *v9; // r12
__int64 v10; // rax
double v11; // xmm0_8
unsigned __int8 *v12; // r13
__int64 v13; // rax
_QWORD *v14; // r12
__int64 v15; // rax
__m128 v16; // xmm1
__int64 v17; // rax
char *v18; // r15
__int64 v19; // rax
__int64 v20; // r12
unsigned int v21; // r13d
__int64 v22; // rax
__int64 v23; // rax
__int64 CString; // rax
_QWORD *v25; // r14
__int64 v26; // rax
char *v27; // r15
__int64 v28; // rax
__int64 v29; // rbx
unsigned int v30; // r14d
__int64 v31; // rax
char v32; // [rsp+0h] [rbp-50h]
__int64 v33; // [rsp+4h] [rbp-4Ch] BYREF
int v34; // [rsp+Ch] [rbp-44h]
unsigned int v35; // [rsp+10h] [rbp-40h]
float v36[2]; // [rsp+14h] [rbp-3Ch] BYREF
float v37; // [rsp+1Ch] [rbp-34h] BYREF
__int16 v38; // [rsp+24h] [rbp-2Ch] BYREF
char v39; // [rsp+26h] [rbp-2Ah]
bool v40; // [rsp+27h] [rbp-29h]
result = cocos2d::CCLayer::init((_WORD *)a1);
if ( result )
{
v40 = result;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)a1 + 320LL))(a1, &unk_100BE5F50);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v33, v5);
v6 = GameManager::sharedState();
v34 = a2;
GTexture = GameManager::getGTexture(v6, a2);
*(_BYTE *)(a1 + 441) = 1;
Line = GJGroundLayer::createLine(a1, a3);
v9 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"groundSquareShadow_001.png", Line);
sub_100278250(v36, 0.0, 1.0);
(*(void (__fastcall **)(char *, float *))(*(_QWORD *)v9 + 296LL))(v9, v36);
v10 = cocos2d::CCDirector::sharedDirector();
*(float *)&Line = sub_100479760(v10);
sub_100278250(v36, *(float *)&Line + -1.0, 0.0);
(*(void (__fastcall **)(char *, float *))(*(_QWORD *)v9 + 184LL))(v9, v36);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v9, 6);
v11 = (*(double (__fastcall **)(char *, _QWORD))(*(_QWORD *)v9 + 72LL))(v9, 0);
v12 = (unsigned __int8 *)cocos2d::CCSprite::createWithSpriteFrameName((__int64)"groundSquareShadow_001.png", v11);
sub_100278250(v36, 1.0, 1.0);
(*(void (__fastcall **)(unsigned __int8 *, float *))(*(_QWORD *)v12 + 296LL))(v12, v36);
v13 = cocos2d::CCDirector::sharedDirector();
*(float *)&v11 = sub_100479770(v13);
sub_100278250(v36, *(float *)&v11 + 1.0, 0.0);
(*(void (__fastcall **)(unsigned __int8 *, float *))(*(_QWORD *)v12 + 184LL))(v12, v36);
(*(void (__fastcall **)(__int64, unsigned __int8 *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v12, 6);
cocos2d::CCSprite::setFlipX(v12, 1u);
(*(void (__fastcall **)(unsigned __int8 *, __int64))(*(_QWORD *)v12 + 72LL))(v12, 1);
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v9 + 912LL))(v9, 100);
(*(void (__fastcall **)(unsigned __int8 *, __int64))(*(_QWORD *)v12 + 912LL))(v12, 100);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v9 + 128LL))(v9, 0.69999999);
(*(void (__fastcall **)(unsigned __int8 *, float))(*(_QWORD *)v12 + 128LL))(v12, 0.69999999);
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v9 + 1080LL))(v9, 0x30300000306LL);
(*(void (__fastcall **)(unsigned __int8 *, __int64))(*(_QWORD *)v12 + 1080LL))(v12, 0x30300000306LL);
*(_BYTE *)(a1 + 440) = 0;
v39 = -1;
v38 = 26112;
v14 = cocos2d::CCSpriteBatchNode::create(GTexture, 0x1Du);
(*(void (__fastcall **)(__int64, _QWORD *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v14, 2);
v15 = (*(__int64 (__fastcall **)(_QWORD *))(*v14 + 896LL))(v14);
(*(void (__fastcall **)(float *, __int64))(*(_QWORD *)v15 + 144LL))(v36, v15);
*(float *)&v11 = v36[0];
*(float *)(a1 + 424) = v36[0];
v16 = (__m128)(unsigned int)v33;
v16.f32[0] = *(float *)&v33 / *(float *)&v11;
*(float *)(a1 + 444) = 128.0 - v36[1];
v17 = (*(__int64 (__fastcall **)(_QWORD *))(*v14 + 896LL))(v14);
v18 = cocos2d::CCSprite::createWithTexture(v17, (__int64)&unk_100BE5F58);
*(_QWORD *)(a1 + 408) = v18;
v18[559] = 1;
sub_100278250(&v37, 0.0, 0.0);
(*(void (__fastcall **)(char *, float *))(*(_QWORD *)v18 + 184LL))(v18, &v37);
(*(void (__fastcall **)(_QWORD, __int16 *))(**(_QWORD **)(a1 + 408) + 960LL))(*(_QWORD *)(a1 + 408), &v38);
(*(void (__fastcall **)(_QWORD *, _QWORD))(*v14 + 456LL))(v14, *(_QWORD *)(a1 + 408));
(*(void (__fastcall **)(_QWORD *, __int64))(*v14 + 912LL))(v14, 1);
v35 = (int)(float)(_mm_round_ss((__m128)0LL, v16, 10).f32[0] + 1.0);
GJGroundLayer::loadGroundSprites(a1, v35, 1);
BYTE2(v37) = v39;
LOWORD(v37) = v38;
v19 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 408) + 488LL))(*(_QWORD *)(a1 + 408));
if ( v19 )
{
v20 = v19;
if ( (unsigned int)sub_1007FEF90(v19) )
{
v21 = 0;
do
{
v22 = sub_1007FEFE0(v20, v21);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v22 + 960LL))(v22, &v37);
++v21;
}
while ( v21 < (unsigned int)sub_1007FEF90(v20) );
}
}
result = v40;
if ( v34 >= 8 )
{
v23 = sub_10088E820("groundSquare_%02d_2_001.png", v32);
CString = cocos2d::CCString::getCString(v23);
v25 = cocos2d::CCSpriteBatchNode::create(CString, 0x1Du);
(*(void (__fastcall **)(__int64, _QWORD *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v25, 3);
v26 = (*(__int64 (__fastcall **)(_QWORD *))(*v25 + 896LL))(v25);
v27 = cocos2d::CCSprite::createWithTexture(v26, (__int64)&unk_100BE5F58);
*(_QWORD *)(a1 + 416) = v27;
v27[559] = 1;
sub_100278250(&v37, 0.0, 0.0);
(*(void (__fastcall **)(char *, float *))(*(_QWORD *)v27 + 184LL))(v27, &v37);
(*(void (__fastcall **)(_QWORD, __int16 *))(**(_QWORD **)(a1 + 416) + 960LL))(*(_QWORD *)(a1 + 416), &v38);
(*(void (__fastcall **)(_QWORD *, _QWORD))(*v25 + 456LL))(v25, *(_QWORD *)(a1 + 416));
GJGroundLayer::loadGroundSprites(a1, v35, 0);
BYTE2(v37) = v39;
LOWORD(v37) = v38;
v28 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 408) + 488LL))(*(_QWORD *)(a1 + 408));
if ( v28 )
{
v29 = v28;
if ( (unsigned int)sub_1007FEF90(v28) )
{
v30 = 0;
do
{
v31 = sub_1007FEFE0(v29, v30);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v31 + 960LL))(v31, &v37);
++v30;
}
while ( v30 < (unsigned int)sub_1007FEF90(v29) );
}
}
return v40;
}
}
return result;
}