//
// MenuGameLayer::update from 0x10039b3a4 to 0x10039b640 (668 bytes)
//
// 1 xrefs:
// > ??> @ 0x10080b158
//
// 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 MenuGameLayer::update(MenuGameLayer *a1, float a2)
{
cocos2d::CCDirector *v4; // x0
PlayerObject *m_playerObject; // x20
__int64 *v6; // x0
PlayerObject *v7; // x8
float m_vehicleSize; // s0
float m_unkAngle1; // s10
float v10; // s12
cocos2d::CCDirector *v11; // x0
float v12; // s10
PlayerObject *v13; // x20
__n128 v14; // q0
__n128 v15; // q1
float *v16; // x0
__n128 v17; // q0
__n128 v18; // q1
__n128 v19; // q0
__n128 v20; // q1
float m_backgroundWrapPosition; // s0
float v22; // s1
__n128 v23; // q0
__n128 v24; // q1
GJGroundLayer *m_groundLayer; // x20
float m_textureWidth; // s0
float v27; // s1
__int64 v28; // [xsp+0h] [xbp-60h] BYREF
__int64 v29; // [xsp+8h] [xbp-58h] BYREF
__int64 v30; // [xsp+10h] [xbp-50h] BYREF
float v31; // [xsp+18h] [xbp-48h]
cocos2d::CCPoint v32; // 0:s0.4,4:s1.4
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v4);
a1->m_deltaCount = a1->m_deltaCount + a2;
MenuGameLayer::updateColors(a1);
m_playerObject = a1->m_playerObject;
v6 = (__int64 *)((__int64 (__fastcall *)(PlayerObject *))m_playerObject->getPosition)(m_playerObject);
sub_1000229B8(&v30, v6);
sub_1000229D0(&m_playerObject->m_shipRotation, (double *)&v30);
PlayerObject::updateInternalActions(a1->m_playerObject, a2);
((void (__fastcall *)(PlayerObject *, float))a1->m_playerObject->update)(a1->m_playerObject, a2 * 60.0);
v7 = a1->m_playerObject;
v7->m_totalTime = a1->m_deltaCount;
m_vehicleSize = v7->m_vehicleSize;
m_unkAngle1 = v7->m_unkAngle1;
if ( m_vehicleSize == 1.0 )
v10 = 0.0;
else
v10 = (float)(m_unkAngle1 * (float)(1.0 - m_vehicleSize)) * 0.5;
v11 = cocos2d::CCDirector::sharedDirector();
v12 = (float)((float)(sub_1001768D0((__int64)v11) + 90.0) + (float)(m_unkAngle1 * 0.5)) - v10;
if ( *(float *)(((__int64 (__fastcall *)(PlayerObject *))a1->m_playerObject->getPosition)(a1->m_playerObject) + 4) < v12 )
{
v13 = a1->m_playerObject;
v14.n128_u32[0] = *(_DWORD *)((__int64 (__fastcall *)(PlayerObject *))v13->getPosition)(v13);
v15.n128_f32[0] = v12;
sub_100022980(v14, v15, &v30);
((void (__fastcall *)(PlayerObject *, __int64 *))v13->setPosition)(v13, &v30);
PlayerObject::hitGround(a1->m_playerObject, nullptr, 0);
}
PlayerObject::updateRotation_1(a1->m_playerObject, a2 * 60.0);
v16 = (float *)((__int64 (__fastcall *)(PlayerObject *))a1->m_playerObject->getPosition)(a1->m_playerObject);
if ( *v16 > (float)(v31 + 100.0) )
MenuGameLayer::resetPlayer(a1);
v17.n128_f32[0] = a1->m_realBackgroundPosition.x + (float)((float)((float)(a2 * 60.0) * 5.77) * 0.9);
v18.n128_u32[0] = 0;
sub_100022980(v17, v18, &v30);
v19.n128_f64[0] = sub_1000229D0(&a1->m_realBackgroundPosition, (double *)&v30);
v19.n128_f32[0] = a1->m_realBackgroundPosition.x * -0.1;
v20.n128_f32[0] = a1->m_realBackgroundPosition.y * -0.1;
sub_100022980(v19, v20, &v30);
m_backgroundWrapPosition = a1->m_backgroundWrapPosition;
v22 = *(float *)&v30;
if ( *(float *)&v30 < (float)-m_backgroundWrapPosition )
{
do
v22 = v22 + m_backgroundWrapPosition;
while ( v22 < (float)-m_backgroundWrapPosition );
*(float *)&v30 = v22;
}
v23 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, __int64 *))a1->m_backgroundSprite->setPosition)(
a1->m_backgroundSprite,
&v30);
v23.n128_f32[0] = -a1->m_realBackgroundPosition.x;
v24.n128_u32[0] = 0;
sub_100022980(v23, v24, &v29);
m_groundLayer = a1->m_groundLayer;
m_textureWidth = m_groundLayer->m_textureWidth;
v27 = *(float *)&v29;
if ( *(float *)&v29 < (float)-m_textureWidth )
{
do
v27 = m_textureWidth + v27;
while ( v27 < (float)-m_textureWidth );
*(float *)&v29 = v27;
}
v32.x = sub_1000229B8(&v28, &v29);
GJGroundLayer::updateGroundPos(m_groundLayer, v32);
PlayerObject::updateEffects(a1->m_playerObject, a2);
}