//
// GJGroundLayer::init from 0x4345f8 to 0x434932 (826 bytes)
//
// 1 xrefs:
// > GJGroundLayer::create @ 0x4349d4
//
// 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
//
bool GJGroundLayer::init(GJGroundLayer *a1, int a2, int a3)
{
cocos2d::CCDirector *v6; // r0
GameManager *v7; // r0
const char *GTexture; // r0
const char *v9; // r11
cocos2d::CCSprite *v10; // r6
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCDirector *v13; // r0
float v14; // r0
cocos2d::CCSprite *v15; // r5
void (__fastcall *v16)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
void (__fastcall *v17)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCDirector *v18; // r0
float v19; // r0
cocos2d::CCSprite_vtbl *v20; // r2
cocos2d::CCSpriteBatchNode *v21; // r11
int v22; // r0
float width; // s14
float v24; // s15
float v25; // r0
cocos2d::CCTexture2D *(__fastcall *getTexture)(cocos2d::CCSpriteBatchNode *__hidden); // r2
cocos2d::CCTexture2D *v27; // r0
cocos2d::CCSprite *v28; // r0
cocos2d::CCSprite_vtbl *v29; // r2
void (__fastcall *v30)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
cocos2d::CCSpriteBatchNode_vtbl *v31; // r3
cocos2d::CCString *v32; // r0
const char *CString; // r0
cocos2d::CCSpriteBatchNode *v34; // r10
cocos2d::CCTexture2D *v35; // r0
cocos2d::CCSprite *v36; // r0
cocos2d::CCSprite_vtbl *v37; // r3
cocos2d::CCSprite *v38; // r8
void (__fastcall *v39)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
_BOOL4 v41; // [sp+0h] [bp-44h]
int v42; // [sp+4h] [bp-40h]
cocos2d::CCSprite *v43; // [sp+Ch] [bp-38h]
int v44; // [sp+10h] [bp-34h] BYREF
cocos2d::CCSize v45; // [sp+14h] [bp-30h] BYREF
int v46; // [sp+1Ch] [bp-28h]
int v47; // [sp+20h] [bp-24h]
float v48[4]; // [sp+24h] [bp-20h] BYREF
cocos2d::CCPoint v49; // [sp+34h] [bp-10h] BYREF
v41 = cocos2d::CCLayer::init(a1);
if ( v41 )
{
a1->setContentSize(a1, &stru_AC6524);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v45, v6);
v7 = GameManager::sharedState();
GTexture = GameManager::getGTexture(v7, a2);
a1->m_blendLine = 1;
v9 = GTexture;
GJGroundLayer::createLine(a1, a3);
v10 = cocos2d::CCSprite::createWithSpriteFrameName("groundSquareShadow_001.png");
setAnchorPoint = v10->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v49, 0.0, 1.0);
setAnchorPoint(v10, &v49);
setPosition = v10->setPosition;
v13 = cocos2d::CCDirector::sharedDirector();
v14 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v13));
cocos2d::CCPoint::CCPoint(&v49, v14 - 1.0, 0.0);
setPosition(v10, &v49);
a1->addChild_0(a1, v10, 6);
v10->setTag(v10, 0);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("groundSquareShadow_001.png");
v16 = v15->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v49, 1.0, 1.0);
v16(v15, &v49);
v17 = v15->setPosition;
v18 = cocos2d::CCDirector::sharedDirector();
v19 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v18));
cocos2d::CCPoint::CCPoint(&v49, v19 + 1.0, 0.0);
v17(v15, &v49);
a1->addChild_0(a1, v15, 6);
cocos2d::CCSprite::setFlipX(v15, 1);
v15->setTag(v15, 1);
v10->setOpacity(v10, 100);
v15->setOpacity(v15, 100);
((void (__fastcall *)(cocos2d::CCSprite *, int))v10->setScaleX)(v10, 1060320051);
((void (__fastcall *)(cocos2d::CCSprite *, int))v15->setScaleX)(v15, 1060320051);
v20 = v10->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v46 = 774;
v47 = 771;
((void (__fastcall *)(cocos2d::CCSprite *, int, int))v20->setBlendFunc)(v10, 774, 771);
((void (__fastcall *)(cocos2d::CCSprite *, int, int))v15->setBlendFunc)(v15, v46, v47);
a1->m_showGround = 0;
LOBYTE(v44) = 0;
*(_WORD *)((char *)&v44 + 1) = -154;
v21 = cocos2d::CCSpriteBatchNode::create(v9, (unsigned int)&dword_1C + 1);
a1->addChild_0(a1, v21, 2);
v22 = (int)v21->getTexture(v21);
(*(void (__fastcall **)(float *, int))(*(_DWORD *)v22 + 72))(v48, v22);
width = v45.width;
v24 = v48[0];
a1->m_textureWidth = v48[0];
v25 = ceilf(width / v24);
getTexture = v21->getTexture;
v42 = (int)(v25 + 1.0);
a1->m_ground1Offset = 128.0 - v48[1];
v27 = getTexture(v21);
v28 = cocos2d::CCSprite::createWithTexture(v27);
v29 = v28->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_ground1Sprite = v28;
v43 = v28;
v30 = v29->setPosition;
v28->m_bDontDraw = 1;
cocos2d::CCPoint::CCPoint(&v49, 0.0, 0.0);
v30(v43, &v49);
a1->m_ground1Sprite->setColor(a1->m_ground1Sprite, (const cocos2d::ccColor3B *)&v44);
v21->addChild(v21, a1->m_ground1Sprite);
v31 = v21->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
LODWORD(v48[2]) = 1;
v48[3] = 0.0;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *, int, _DWORD))v31->setBlendFunc)(v21, 1, 0);
GJGroundLayer::loadGroundSprites(a1, v42, 1);
GJGroundLayer::updateGround01Color(a1, (cocos2d::ccColor3B)v44);
if ( a2 > 7 )
{
v32 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)a2);
CString = cocos2d::CCString::getCString(v32);
v34 = cocos2d::CCSpriteBatchNode::create(CString, (unsigned int)&dword_1C + 1);
a1->addChild_0(a1, v34, 3);
v35 = v34->getTexture(v34);
v36 = cocos2d::CCSprite::createWithTexture(v35);
v37 = v36->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v38 = v36;
a1->m_ground2Sprite = v36;
v36->m_bDontDraw = 1;
v39 = v37->setPosition;
cocos2d::CCPoint::CCPoint(&v49, 0.0, 0.0);
v39(v38, &v49);
a1->m_ground2Sprite->setColor(a1->m_ground2Sprite, (const cocos2d::ccColor3B *)&v44);
v34->addChild(v34, a1->m_ground2Sprite);
GJGroundLayer::loadGroundSprites(a1, v42, 0);
GJGroundLayer::updateGround01Color(a1, (cocos2d::ccColor3B)v44);
}
}
return v41;
}