//
// GJGroundLayer::updateGroundWidth from 0x434a00 to 0x434b20 (288 bytes)
//
// 1 xrefs:
// > GJGroundLayer::scaleGround @ 0x434c5e
//
// 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
//
void GJGroundLayer::updateGroundWidth(GJGroundLayer *a1, bool a2)
{
_BOOL4 v3; // r7
cocos2d::CCDirector *v4; // r0
GJGroundLayer_vtbl *v5; // r3
float v6; // r0
int v7; // r0
float m_textureWidth; // s14
float v9; // s15
int v10; // r5
cocos2d::CCSprite *m_lineSprite; // r0
void (*setScaleX)(void); // r3
cocos2d::CCSprite *v13; // r5
float m_groundWidth; // s14
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
int v16; // r0
cocos2d::CCSize v17; // [sp+4h] [bp-18h] BYREF
cocos2d::CCPoint v18; // [sp+Ch] [bp-10h] BYREF
v3 = a2;
if ( a1->getParent(a1) )
{
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v17, v4);
v5 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v3 )
{
v6 = COERCE_FLOAT(((int (__fastcall *)(GJGroundLayer *))v5->getScaleX)(a1));
}
else
{
v7 = (int)v5->getParent(a1);
v6 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v7 + 84))(v7));
}
m_textureWidth = a1->m_textureWidth;
v9 = (float)(v17.width / v6) + 10.0;
a1->m_groundWidth = v9;
v10 = (int)(float)(ceilf(v9 / m_textureWidth) + 1.0);
if ( a1->m_cameraRotated )
++v10;
GJGroundLayer::loadGroundSprites(a1, v10, 1);
GJGroundLayer::loadGroundSprites(a1, v10, 0);
m_lineSprite = a1->m_lineSprite;
if ( a1->m_lineType <= 1 )
{
if ( !v3 )
{
LABEL_12:
v13 = a1->m_lineSprite;
m_groundWidth = a1->m_groundWidth;
setPosition = v13->setPosition;
v16 = (int)v13->getPosition(v13);
cocos2d::CCPoint::CCPoint(&v18, (float)(m_groundWidth * 0.5) - 5.0, *(float *)(v16 + 4));
setPosition(v13, &v18);
return;
}
setScaleX = (void (*)(void))m_lineSprite->setScaleX;
}
else
{
setScaleX = (void (*)(void))m_lineSprite->setScaleX;
}
setScaleX();
goto LABEL_12;
}
}