//
// GJGroundLayer::updateGroundWidth from 0x7ec344 to 0x7ec4e8 (420 bytes)
//
// 2 xrefs:
// > GJGroundLayer::scaleGround @ 0x7ec6f8
// > ??> @ 0x60d08
//
// 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 v2; // w22
cocos2d::CCDirector *v4; // x0
GJGroundLayer_vtbl *v5; // x1
__int64 v6; // x0
long double v7; // q0
bool v8; // zf
float m_textureWidth; // s1
float v10; // s2
int v11; // w20
cocos2d::CCSprite *m_lineSprite; // x20
float v13; // s0
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x19
__int64 v15; // x0
float v16; // [xsp+40h] [xbp+40h]
float v17; // [xsp+50h] [xbp+50h]
float v18; // [xsp+68h] [xbp+68h]
cocos2d::CCPoint v19; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
v2 = a2;
if ( a1->getParent(a1) )
{
v4 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v4);
v5 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v2 )
{
((void (__fastcall *)(GJGroundLayer *, float, float))v5->getScaleX)(a1, WinSize.width, WinSize.height);
}
else
{
v6 = ((__int64 (__fastcall *)(GJGroundLayer *, float, float))v5->getParent)(a1, WinSize.width, WinSize.height);
v7 = ((long double (__fastcall *)(__int64))*(_QWORD *)(*(_QWORD *)v6 + 168LL))(v6);
}
v8 = !a1->m_cameraRotated;
m_textureWidth = a1->m_textureWidth;
v17 = *(float *)&v7;
v10 = (float)(v18 / *(float *)&v7) + 10.0;
a1->m_groundWidth = v10;
v11 = (int)(float)(ceilf(v10 / m_textureWidth) + 1.0);
if ( !v8 )
++v11;
GJGroundLayer::loadGroundSprites(a1, v11, 1);
GJGroundLayer::loadGroundSprites(a1, v11, 0);
if ( a1->m_lineType <= 1 )
{
if ( v2 )
a1->m_lineSprite->setScaleX(a1->m_lineSprite, 1.0 / v17);
}
else
{
a1->m_lineSprite->setScaleX(
a1->m_lineSprite,
(float)((float)(v18 + 10.0) / v17) / a1->m_lineSprite->m_obRect.size.width);
}
m_lineSprite = a1->m_lineSprite;
v13 = (float)(a1->m_groundWidth * 0.5) + -5.0;
setPosition = m_lineSprite->setPosition;
v16 = v13;
v15 = (__int64)m_lineSprite->getPosition(m_lineSprite);
cocos2d::CCPoint::CCPoint(&v19, v16, *(float *)(v15 + 4));
setPosition(m_lineSprite, &v19);
}
}