//
// GJGroundLayer::updateGroundWidth from 0x1005eb670 to 0x1005eb7e4 (372 bytes)
//
// 1 xrefs:
// > GJGroundLayer::scaleGround @ 0x1005eb5c7
//
// 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 __fastcall GJGroundLayer::updateGroundWidth(GJGroundLayer *a1, bool a2)
{
GJGroundLayer *v3; // rbx
cocos2d::CCDirector *v4; // rsi
GJGroundLayer_vtbl *v5; // rax
float (__cdecl **p_getScaleX)(cocos2d::CCNode *__hidden); // rax
float v7; // xmm0_4
__m128 v8; // xmm1
int v9; // r15d
float *v10; // rdi
double v11; // xmm0_8
float m_groundWidth; // xmm0_4
cocos2d::CCSprite *m_lineSprite; // rbx
__int64 v14; // rax
float v15[2]; // [rsp+4h] [rbp-2Ch] BYREF
float v16; // [rsp+Ch] [rbp-24h] BYREF
float v17; // [rsp+14h] [rbp-1Ch]
double v18; // 0:xmm0_8.8
v3 = a1;
if ( ((__int64 (__fastcall *)(GJGroundLayer *))a1->getParent)(a1) )
{
v4 = cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v18 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v16);
v5 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( a2 )
{
p_getScaleX = &v5->getScaleX;
}
else
{
a1 = (GJGroundLayer *)((__int64 (__fastcall *)(GJGroundLayer *, cocos2d::CCDirector *, double))v5->getParent)(
a1,
v4,
v18);
p_getScaleX = &a1->getScale;
}
v7 = ((float (__fastcall *)(GJGroundLayer *, cocos2d::CCDirector *, double))*p_getScaleX)(a1, v4, v18);
v8 = (__m128)LODWORD(v16);
v17 = v7;
v8.f32[0] = (float)(v16 / v7) + 10.0;
LODWORD(v3->m_groundWidth) = v8.i32[0];
v8.f32[0] = v8.f32[0] / v3->m_textureWidth;
v9 = (int)(float)(_mm_round_ss((__m128)0LL, v8, 10).f32[0] + 1.0) + v3->m_cameraRotated;
GJGroundLayer::loadGroundSprites(v3, v9, 1);
GJGroundLayer::loadGroundSprites(v3, v9, 0);
if ( v3->m_lineType < 2 )
{
v8.i64[0] = LODWORD(v17);
if ( !a2 )
{
LABEL_10:
m_groundWidth = v3->m_groundWidth;
m_lineSprite = v3->m_lineSprite;
v17 = (float)(m_groundWidth * 0.5) + -5.0;
v14 = ((__int64 (__fastcall *)(cocos2d::CCSprite *, float, double))m_lineSprite->getPosition)(
m_lineSprite,
v17,
*(double *)v8.i64);
sub_10028CBE0(v15, v17, *(float *)(v14 + 4));
((void (__fastcall *)(cocos2d::CCSprite *, float *))m_lineSprite->setPosition)(m_lineSprite, v15);
return;
}
v10 = (float *)v3->m_lineSprite;
HIDWORD(v11) = 0;
*(float *)&v11 = 1.0 / v17;
}
else
{
v10 = (float *)v3->m_lineSprite;
*(_QWORD *)&v11 = LODWORD(v16);
*(float *)&v11 = (float)((float)(v16 + 10.0) / v17) / v10[108];
}
(*(void (__fastcall **)(float *, double))(*(_QWORD *)v10 + 128LL))(v10, v11);
goto LABEL_10;
}
}