//
// GJGroundLayer::init from 0x7ebd54 to 0x7ec234 (1248 bytes)
//
// 2 xrefs:
// > GJGroundLayer::create @ 0x7ec2e0
// > ??> @ 0xa6c08
//
// 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)
{
bool v6; // w27
cocos2d::CCDirector *v8; // x0
GameManager *v9; // x0
const char *GTexture; // x0
cocos2d::CCSprite *v11; // x21
cocos2d::CCDirector *v12; // x0
float v13; // s0
cocos2d::CCSprite *v14; // x20
cocos2d::CCDirector *v15; // x0
float v16; // s0
cocos2d::CCSpriteBatchNode *v17; // x21
__int64 v18; // x0
float v19; // s3
float v20; // s0
cocos2d::CCTexture2D *(__fastcall *getTexture)(cocos2d::CCSpriteBatchNode *__hidden); // x1
int v22; // w20
cocos2d::CCTexture2D *v23; // x0
cocos2d::CCSprite *v24; // x0
cocos2d::CCSprite_vtbl *v25; // x2
cocos2d::CCString *v26; // x0
const char *CString; // x0
cocos2d::CCSpriteBatchNode *v28; // x21
cocos2d::CCTexture2D *v29; // x0
cocos2d::CCSprite *v30; // x24
cocos2d::CCSprite_vtbl *v31; // x1
void (__fastcall *v32)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCSpriteBatchNode *v33; // [xsp+70h] [xbp+70h]
cocos2d::CCSpriteBatchNode *v34; // [xsp+70h] [xbp+70h]
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+78h] [xbp+78h]
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+78h] [xbp+78h]
void (__fastcall *v37)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+78h] [xbp+78h]
void (__fastcall *v38)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+78h] [xbp+78h]
void (__fastcall *v39)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+78h] [xbp+78h]
__int64 v40; // [xsp+98h] [xbp+98h] BYREF
float v41; // [xsp+A0h] [xbp+A0h]
__int64 v42; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v43; // [xsp+B0h] [xbp+B0h] BYREF
v6 = cocos2d::CCLayer::init(a1);
if ( v6 )
{
((void (__fastcall *)(GJGroundLayer *))a1->setContentSize)(a1);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8);
v9 = GameManager::sharedState();
GTexture = GameManager::getGTexture(v9, a2);
a1->m_blendLine = 1;
v33 = (cocos2d::CCSpriteBatchNode *)GTexture;
GJGroundLayer::createLine(a1, a3);
v11 = cocos2d::CCSprite::createWithSpriteFrameName("groundSquareShadow_001.png");
setAnchorPoint = v11->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v43, 0.0, 1.0);
setAnchorPoint(v11, &v43);
setPosition = v11->setPosition;
v12 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v12);
cocos2d::CCPoint::CCPoint(&v43, v13 - 1.0, 0.0);
setPosition(v11, &v43);
a1->addChild_0(a1, v11, 6);
v11->setTag(v11, 0);
v14 = cocos2d::CCSprite::createWithSpriteFrameName("groundSquareShadow_001.png");
v37 = v14->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v43, 1.0, 1.0);
v37(v14, &v43);
v38 = v14->setPosition;
v15 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v15);
cocos2d::CCPoint::CCPoint(&v43, v16 + 1.0, 0.0);
v38(v14, &v43);
a1->addChild_0(a1, v14, 6);
cocos2d::CCSprite::setFlipX(v14, 1);
v14->setTag(v14, 1);
v11->setOpacity(v11, 100);
v14->setOpacity(v14, 100);
v11->setScaleX(v11, 0.7);
v14->setScaleX(v14, 0.7);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v11->setBlendFunc)(v11, 0x30300000306LL);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v14->setBlendFunc)(v14, 0x30300000306LL);
a1->m_showGround = 0;
LOWORD(v40) = 26112;
BYTE2(v40) = -1;
v17 = cocos2d::CCSpriteBatchNode::create((const char *)v33, (unsigned int)&off_18 + 5);
a1->addChild_0(a1, v17, 2);
v18 = (__int64)v17->getTexture(v17);
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v18 + 144LL))(&v42);
v19 = *((float *)&v42 + 1);
v20 = v41 / *(float *)&v42;
getTexture = v17->getTexture;
LODWORD(a1->m_textureWidth) = v42;
a1->m_ground1Offset = 128.0 - v19;
v22 = (int)(ceilf(v20) + 1.0);
v23 = getTexture(v17);
v24 = cocos2d::CCSprite::createWithTexture(v23);
a1->m_ground1Sprite = v24;
v34 = (cocos2d::CCSpriteBatchNode *)v24;
v25 = v24->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v24->m_bDontDraw = 1;
v39 = v25->setPosition;
cocos2d::CCPoint::CCPoint(&v43, 0.0, 0.0);
v39((cocos2d::CCSprite *)v34, &v43);
a1->m_ground1Sprite->setColor(a1->m_ground1Sprite, (const cocos2d::ccColor3B *)&v40);
v17->addChild(v17, a1->m_ground1Sprite);
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *, __int64))v17->setBlendFunc)(v17, 1);
GJGroundLayer::loadGroundSprites(a1, v22, 1);
GJGroundLayer::updateGround01Color(a1, (cocos2d::ccColor3B)v40);
if ( a2 > 7 )
{
v26 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)(unsigned int)a2);
CString = cocos2d::CCString::getCString(v26);
v28 = cocos2d::CCSpriteBatchNode::create(CString, (unsigned int)&off_18 + 5);
a1->addChild_0(a1, v28, 3);
v29 = v28->getTexture(v28);
v30 = cocos2d::CCSprite::createWithTexture(v29);
a1->m_ground2Sprite = v30;
v31 = v30->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v30->m_bDontDraw = 1;
v32 = v31->setPosition;
cocos2d::CCPoint::CCPoint(&v43, 0.0, 0.0);
v32(v30, &v43);
a1->m_ground2Sprite->setColor(a1->m_ground2Sprite, (const cocos2d::ccColor3B *)&v40);
v28->addChild(v28, a1->m_ground2Sprite);
GJGroundLayer::loadGroundSprites(a1, v22, 0);
GJGroundLayer::updateGround01Color(a1, (cocos2d::ccColor3B)v40);
}
}
return v6;
}