//
// GJGroundLayer::init from 0x545eb0 to 0x5461ea (826 bytes)
//
// 1 xrefs:
// > GJGroundLayer::create @ 0x54628c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:52:23 +0000
//
int __fastcall GJGroundLayer::init(GJGroundLayer *this, const char *a2, int a3)
{
cocos2d::CCDirector *v6; // r0
GameManager *WinSize; // r0
GameManager *v8; // r0
int GTexture; // r0
cocos2d::CCSpriteBatchNode *v10; // r11
const char *v11; // r1
int *v12; // r6
int (__fastcall *v13)(int *, _BYTE *); // r8
cocos2d::CCDirector *v14; // r0
void (__fastcall *v15)(int *, _BYTE *); // r8
cocos2d::CCDirector *v16; // r0
float v17; // r0
const char *v18; // r1
cocos2d::CCSprite *v19; // r5
int (__fastcall *v20)(cocos2d::CCSprite *, _BYTE *); // r8
cocos2d::CCDirector *v21; // r0
void (__fastcall *v22)(cocos2d::CCSprite *, _BYTE *); // r8
cocos2d::CCDirector *v23; // r0
float v24; // r0
int v25; // r2
int *v26; // r11
int v27; // r0
float v28; // s14
float v29; // s15
cocos2d::CCSprite *v30; // r0
const cocos2d::CCRect *v31; // r2
int v32; // r0
void (__fastcall *v33)(int, _BYTE *); // r6
int v34; // r3
cocos2d::CCString *v35; // r0
cocos2d::CCSpriteBatchNode *CString; // r0
unsigned int v37; // r2
int v38; // r10
cocos2d::CCSprite *v39; // r0
const cocos2d::CCRect *v40; // r2
int v41; // r0
int v42; // r8
void (__fastcall *v43)(int, _BYTE *); // r9
int v45; // [sp+0h] [bp-44h]
unsigned int v46; // [sp+4h] [bp-40h]
int v47; // [sp+Ch] [bp-38h]
int v48; // [sp+10h] [bp-34h] BYREF
float v49[2]; // [sp+14h] [bp-30h] BYREF
int v50; // [sp+1Ch] [bp-28h]
int v51; // [sp+20h] [bp-24h]
float v52[4]; // [sp+24h] [bp-20h] BYREF
_BYTE v53[8]; // [sp+34h] [bp-10h] BYREF
v45 = cocos2d::CCLayer::init(this);
if ( v45 )
{
v6 = (cocos2d::CCDirector *)(*(int (__fastcall **)(GJGroundLayer *, void *))(*(_DWORD *)this + 160))(
this,
&unk_D2C098);
cocos2d::CCDirector::sharedDirector(v6);
WinSize = (GameManager *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v49);
v8 = (GameManager *)GameManager::sharedState(WinSize);
GTexture = GameManager::getGTexture(v8, a2);
*((_BYTE *)this + 333) = 1;
v10 = (cocos2d::CCSpriteBatchNode *)GTexture;
GJGroundLayer::createLine(this, a3);
v12 = (int *)cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"groundSquareShadow_001.png", v11);
v13 = *(int (__fastcall **)(int *, _BYTE *))(*v12 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, 0.0, 1.0);
v14 = (cocos2d::CCDirector *)v13(v12, v53);
v15 = *(void (__fastcall **)(int *, _BYTE *))(*v12 + 92);
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v14);
v17 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v16));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, v17 - 1.0, 0.0);
v15(v12, v53);
(*(void (__fastcall **)(GJGroundLayer *, int *, int))(*(_DWORD *)this + 232))(this, v12, 6);
(*(void (__fastcall **)(int *, _DWORD))(*v12 + 36))(v12, 0);
v19 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"groundSquareShadow_001.png",
v18);
v20 = *(int (__fastcall **)(cocos2d::CCSprite *, _BYTE *))(*(_DWORD *)v19 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, 1.0, 1.0);
v21 = (cocos2d::CCDirector *)v20(v19, v53);
v22 = *(void (__fastcall **)(cocos2d::CCSprite *, _BYTE *))(*(_DWORD *)v19 + 92);
v23 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v21);
v24 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v23));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, v24 + 1.0, 0.0);
v22(v19, v53);
(*(void (__fastcall **)(GJGroundLayer *, cocos2d::CCSprite *, int))(*(_DWORD *)this + 232))(this, v19, 6);
cocos2d::CCSprite::setFlipX(v19, 1);
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v19 + 36))(v19, 1);
(*(void (__fastcall **)(int *, int))(*v12 + 456))(v12, 100);
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v19 + 456))(v19, 100);
(*(void (__fastcall **)(int *, int))(*v12 + 64))(v12, 1060320051);
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v19 + 64))(v19, 1060320051);
v25 = *v12;
v50 = 774;
v51 = 771;
(*(void (__fastcall **)(int *, int, int))(v25 + 540))(v12, 774, 771);
(*(void (__fastcall **)(cocos2d::CCSprite *, int, int))(*(_DWORD *)v19 + 540))(v19, v50, v51);
*((_BYTE *)this + 332) = 0;
LOBYTE(v48) = 0;
*(_WORD *)((char *)&v48 + 1) = -154;
v26 = (int *)cocos2d::CCSpriteBatchNode::create(v10, (const char *)&dword_1C + 1, 0xFFu);
(*(void (__fastcall **)(GJGroundLayer *, int *, int))(*(_DWORD *)this + 232))(this, v26, 2);
v27 = (*(int (__fastcall **)(int *))(*v26 + 448))(v26);
(*(void (__fastcall **)(float *, int))(*(_DWORD *)v27 + 72))(v52, v27);
v28 = v49[0];
v29 = v52[0];
*((float *)this + 81) = v52[0];
v46 = (int)(float)(ceilf(v28 / v29) + 1.0);
*((float *)this + 84) = 128.0 - v52[1];
v30 = (cocos2d::CCSprite *)(*(int (__fastcall **)(int *))(*v26 + 448))(v26);
v32 = cocos2d::CCSprite::createWithTexture(v30, (cocos2d::CCTexture2D *)&unk_D2C0A0, v31);
*((_DWORD *)this + 79) = v32;
*(_BYTE *)(v32 + 471) = 1;
v47 = *((_DWORD *)this + 79);
v33 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v47 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, 0.0, 0.0);
v33(v47, v53);
(*(void (__fastcall **)(_DWORD, int *))(**((_DWORD **)this + 79) + 480))(*((_DWORD *)this + 79), &v48);
(*(void (__fastcall **)(int *, _DWORD))(*v26 + 228))(v26, *((_DWORD *)this + 79));
v34 = *v26;
LODWORD(v52[2]) = 1;
v52[3] = 0.0;
(*(void (__fastcall **)(int *, int, _DWORD))(v34 + 456))(v26, 1, 0);
GJGroundLayer::loadGroundSprites(this, v46, 1);
GJGroundLayer::updateGround01Color((int)this, v48);
if ( (int)a2 > 7 )
{
v35 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
a2);
CString = (cocos2d::CCSpriteBatchNode *)cocos2d::CCString::getCString(v35);
v38 = cocos2d::CCSpriteBatchNode::create(CString, (const char *)&dword_1C + 1, v37);
(*(void (__fastcall **)(GJGroundLayer *, int, int))(*(_DWORD *)this + 232))(this, v38, 3);
v39 = (cocos2d::CCSprite *)(*(int (__fastcall **)(int))(*(_DWORD *)v38 + 448))(v38);
v41 = cocos2d::CCSprite::createWithTexture(v39, (cocos2d::CCTexture2D *)&unk_D2C0A0, v40);
*((_DWORD *)this + 80) = v41;
*(_BYTE *)(v41 + 471) = 1;
v42 = *((_DWORD *)this + 80);
v43 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v42 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, 0.0, 0.0);
v43(v42, v53);
(*(void (__fastcall **)(_DWORD, int *))(**((_DWORD **)this + 80) + 480))(*((_DWORD *)this + 80), &v48);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v38 + 228))(v38, *((_DWORD *)this + 80));
GJGroundLayer::loadGroundSprites(this, v46, 0);
GJGroundLayer::updateGround01Color((int)this, v48);
}
}
return v45;
}