//
// GJGroundLayer::init from 0x916b74 to 0x917054 (1248 bytes)
//
// 2 xrefs:
// > GJGroundLayer::create @ 0x917100
// > ??> @ 0xdaf68
//
// This function is hookable on this platform (idp: arm, 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:57:19 +0000
//
__int64 __fastcall GJGroundLayer::init(GJGroundLayer *this, int a2, int a3)
{
unsigned __int8 v6; // w0
unsigned int v7; // w27
cocos2d::CCDirector *v9; // x0
cocos2d::CCDirector *v10; // x0
GameManager *WinSize; // x0
GameManager *v12; // x0
__int64 GTexture; // x0
const char *v14; // x1
cocos2d::CCDirector **v15; // x21
cocos2d::CCDirector *v16; // x0
float v17; // s0
const char *v18; // x1
cocos2d::CCDirector **v19; // x20
cocos2d::CCDirector *v20; // x0
float v21; // s0
__int64 v22; // x21
__int64 v23; // x0
float v24; // s2
float v25; // s0
unsigned int v26; // w20
cocos2d::CCSprite *v27; // x0
const cocos2d::CCRect *v28; // x2
__int64 v29; // x0
cocos2d::CCString *v30; // x0
cocos2d::CCSpriteBatchNode *CString; // x0
unsigned int v32; // w2
__int64 v33; // x21
cocos2d::CCSprite *v34; // x0
const cocos2d::CCRect *v35; // x2
__int64 v36; // x0
__int64 v37; // x24
void (__fastcall *v38)(__int64, _BYTE *); // x25
cocos2d::CCSpriteBatchNode *v39; // [xsp+70h] [xbp+70h]
cocos2d::CCSpriteBatchNode *v40; // [xsp+70h] [xbp+70h]
void (__fastcall *v41)(cocos2d::CCDirector **, _BYTE *); // [xsp+78h] [xbp+78h]
void (__fastcall *v42)(cocos2d::CCDirector **, _BYTE *); // [xsp+78h] [xbp+78h]
void (__fastcall *v43)(cocos2d::CCDirector **, _BYTE *); // [xsp+78h] [xbp+78h]
void (__fastcall *v44)(cocos2d::CCDirector **, _BYTE *); // [xsp+78h] [xbp+78h]
void (__fastcall *v45)(cocos2d::CCSpriteBatchNode *, _BYTE *); // [xsp+78h] [xbp+78h]
__int64 v46; // [xsp+98h] [xbp+98h] BYREF
__int64 v47; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v48; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v49[8]; // [xsp+B0h] [xbp+B0h] BYREF
v6 = cocos2d::CCLayer::init(this);
v7 = v6;
if ( v6 )
{
v9 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(GJGroundLayer *))(*(_QWORD *)this + 320LL))(this);
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
WinSize = (GameManager *)cocos2d::CCDirector::getWinSize(&v47, v10);
v12 = (GameManager *)GameManager::sharedState(WinSize);
GTexture = GameManager::getGTexture(v12, a2);
*((_BYTE *)this + 441) = 1;
v39 = (cocos2d::CCSpriteBatchNode *)GTexture;
GJGroundLayer::createLine(this, a3);
v15 = (cocos2d::CCDirector **)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"groundSquareShadow_001.png",
v14);
v41 = *((void (__fastcall **)(cocos2d::CCDirector **, _BYTE *))*v15 + 37);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, 0.0, 1.0);
v41(v15, v49);
v42 = *((void (__fastcall **)(cocos2d::CCDirector **, _BYTE *))*v15 + 23);
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(*v15);
cocos2d::CCDirector::getScreenLeft(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, v17 - 1.0, 0.0);
v42(v15, v49);
(*(void (__fastcall **)(GJGroundLayer *, cocos2d::CCDirector **, __int64))(*(_QWORD *)this + 464LL))(this, v15, 6);
(*((void (__fastcall **)(cocos2d::CCDirector **, _QWORD))*v15 + 9))(v15, 0);
v19 = (cocos2d::CCDirector **)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"groundSquareShadow_001.png",
v18);
v43 = *((void (__fastcall **)(cocos2d::CCDirector **, _BYTE *))*v19 + 37);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, 1.0, 1.0);
v43(v19, v49);
v44 = *((void (__fastcall **)(cocos2d::CCDirector **, _BYTE *))*v19 + 23);
v20 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(*v19);
cocos2d::CCDirector::getScreenRight(v20);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, v21 + 1.0, 0.0);
v44(v19, v49);
(*(void (__fastcall **)(GJGroundLayer *, cocos2d::CCDirector **, __int64))(*(_QWORD *)this + 464LL))(this, v19, 6);
cocos2d::CCSprite::setFlipX((cocos2d::CCSprite *)v19, 1);
(*((void (__fastcall **)(cocos2d::CCDirector **, __int64))*v19 + 9))(v19, 1);
(*((void (__fastcall **)(cocos2d::CCDirector **, __int64))*v15 + 114))(v15, 100);
(*((void (__fastcall **)(cocos2d::CCDirector **, __int64))*v19 + 114))(v19, 100);
(*((void (__fastcall **)(cocos2d::CCDirector **, float))*v15 + 16))(v15, 0.7);
(*((void (__fastcall **)(cocos2d::CCDirector **, float))*v19 + 16))(v19, 0.7);
(*((void (__fastcall **)(cocos2d::CCDirector **, __int64))*v15 + 135))(v15, 0x30300000306LL);
(*((void (__fastcall **)(cocos2d::CCDirector **, __int64))*v19 + 135))(v19, 0x30300000306LL);
*((_BYTE *)this + 440) = 0;
LOWORD(v46) = 26112;
BYTE2(v46) = -1;
v22 = cocos2d::CCSpriteBatchNode::create(v39, (const char *)&off_18 + 5, 0xFFFFFFFF);
(*(void (__fastcall **)(GJGroundLayer *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v22, 2);
v23 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v22 + 896LL))(v22);
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v23 + 144LL))(&v48);
v24 = *((float *)&v48 + 1);
v25 = *(float *)&v47 / *(float *)&v48;
*((_DWORD *)this + 106) = v48;
*((float *)this + 111) = 128.0 - v24;
v26 = (int)(float)(ceilf(v25) + 1.0);
v27 = (cocos2d::CCSprite *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v22 + 896LL))(v22);
v29 = cocos2d::CCSprite::createWithTexture(v27, (cocos2d::CCTexture2D *)&unk_155CF10, v28);
*((_QWORD *)this + 51) = v29;
*(_BYTE *)(v29 + 559) = 1;
v40 = *((cocos2d::CCSpriteBatchNode **)this + 51);
v45 = *(void (__fastcall **)(cocos2d::CCSpriteBatchNode *, _BYTE *))(*(_QWORD *)v40 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, 0.0, 0.0);
v45(v40, v49);
(*(void (__fastcall **)(_QWORD, __int64 *))(**((_QWORD **)this + 51) + 960LL))(*((_QWORD *)this + 51), &v46);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v22 + 456LL))(v22, *((_QWORD *)this + 51));
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v22 + 912LL))(v22, 1);
GJGroundLayer::loadGroundSprites(this, v26, 1u);
GJGroundLayer::updateGround01Color((__int64)this, v46);
if ( a2 > 7 )
{
v30 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)(unsigned int)a2);
CString = (cocos2d::CCSpriteBatchNode *)cocos2d::CCString::getCString(v30);
v33 = cocos2d::CCSpriteBatchNode::create(CString, (const char *)&off_18 + 5, v32);
(*(void (__fastcall **)(GJGroundLayer *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v33, 3);
v34 = (cocos2d::CCSprite *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v33 + 896LL))(v33);
v36 = cocos2d::CCSprite::createWithTexture(v34, (cocos2d::CCTexture2D *)&unk_155CF10, v35);
*((_QWORD *)this + 52) = v36;
*(_BYTE *)(v36 + 559) = 1;
v37 = *((_QWORD *)this + 52);
v38 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v37 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, 0.0, 0.0);
v38(v37, v49);
(*(void (__fastcall **)(_QWORD, __int64 *))(**((_QWORD **)this + 52) + 960LL))(*((_QWORD *)this + 52), &v46);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v33 + 456LL))(v33, *((_QWORD *)this + 52));
GJGroundLayer::loadGroundSprites(this, v26, 0);
GJGroundLayer::updateGround01Color((__int64)this, v46);
}
}
return v7;
}