//
// GJGroundLayer::scaleGround from 0x14027ec40 to 0x14027ede4 (420 bytes)
//
// 9 xrefs:
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236598
// > GJBaseGameLayer::preUpdateVisibility @ 0x1402365b7
// > GJBaseGameLayer::resetLevelVariables @ 0x14023b6e1
// > GJBaseGameLayer::resetLevelVariables @ 0x14023b700
// > GJBaseGameLayer::updateCameraBGArt @ 0x14023ea94
// > GJBaseGameLayer::updateCameraBGArt @ 0x14023eaab
// > ??> @ 0x1406879ac
// > ??> @ 0x1406879bc
// > ??> @ 0x1406d125c
//
// 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
//
float GJGroundLayer::scaleGround(GJGroundLayer *a1, float a2)
{
float m_groundWidth; // xmm8_4
__int64 v4; // rcx
cocos2d::CCDirector *v5; // rax
double v6; // xmm0_8
float v7; // xmm0_4
int v8; // ebx
cocos2d::CCSprite *m_lineSprite; // rcx
cocos2d::CCSprite_vtbl *v10; // rbx
const cocos2d::CCPoint *v11; // rax
float v12; // xmm6_4
float v14; // [rsp+60h] [rbp+8h]
((void (__fastcall *)(GJGroundLayer *))a1->setScaleX)(a1);
a1->getScaleY(a1);
((void (__fastcall *)(GJGroundLayer *))a1->setScaleY)(a1);
m_groundWidth = a1->m_groundWidth;
if ( a1->getParent(a1) )
{
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize(v5);
v6 = ((double (__fastcall *)(GJGroundLayer *))a1->getScaleX)(a1);
*(float *)&v6 = (float)(v14 / *(float *)&v6) + 10.0;
a1->m_groundWidth = *(float *)&v6;
v7 = ceilf(*(float *)&v6 / a1->m_textureWidth) + 1.0;
v8 = (int)v7 + 1;
if ( !a1->m_cameraRotated )
v8 = (int)v7;
GJGroundLayer::loadGroundSprites(a1, v8, 1);
GJGroundLayer::loadGroundSprites(a1, v8, 0);
((void (*)(void))a1->m_lineSprite->setScaleX)();
m_lineSprite = a1->m_lineSprite;
v10 = m_lineSprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_lineSprite->getPosition_0(m_lineSprite);
cocos2d::CCPoint::CCPoint(v7, (float)(a1->m_groundWidth * 0.5) - 5.0);
v10->setPosition_0(a1->m_lineSprite, v11);
}
v12 = a1->m_groundWidth - m_groundWidth;
GJGroundLayer::updateShadows(a1);
return v12;
}