//
// MenuGameLayer::update from 0x140332240 to 0x140332705 (1221 bytes)
//
// 2 xrefs:
// > ??> @ 0x1405aa778
// > ??> @ 0x1406d50a8
//
// 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 MenuGameLayer::update(MenuGameLayer *a1, float a2)
{
cocos2d::CCDirector *v3; // rax
GJGroundLayer *m_groundLayer; // rax
float v6; // xmm9_4
__int64 v7; // rax
cocos2d::CCArray *v8; // rax
unsigned int v9; // ebx
cocos2d::CCArray *v10; // rbp
unsigned int v11; // edi
struct cocos2d::CCObject *v12; // rax
cocos2d::CCSprite *m_ground2Sprite; // rcx
__int64 v14; // rax
cocos2d::CCSprite *v15; // rcx
cocos2d::CCArray *v16; // rax
cocos2d::CCArray *v17; // rdi
struct cocos2d::CCObject *v18; // rax
__int64 v19; // rax
__int64 v20; // rcx
float v21; // xmm6_4
PlayerObject *m_playerObject; // rax
float m_vehicleSize; // xmm0_4
float m_unkAngle1; // xmm8_4
cocos2d::CCDirector *v25; // rax
float ScreenBottom; // xmm0_4
PlayerObject *v27; // rcx
PlayerObject_vtbl *v28; // rbx
float *v29; // rax
const cocos2d::CCPoint *v30; // rax
float x; // xmm0_4
__int64 v32; // rax
double v33; // xmm0_8
float v34; // xmm0_4
float v35; // xmm1_4
float v36; // xmm0_4
float v37; // xmm0_4
float m_textureWidth; // xmm2_4
GJGroundLayer *v39; // rbx
const cocos2d::CCPoint *v40; // rax
const cocos2d::CCPoint *v41; // rdi
cocos2d::CCSprite *v42; // rcx
float v43; // [rsp+20h] [rbp-78h]
cocos2d::CCPoint v44; // [rsp+A0h] [rbp+8h] BYREF
float v45; // [rsp+B0h] [rbp+18h] BYREF
float v46; // [rsp+B8h] [rbp+20h]
v3 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v3);
m_groundLayer = a1->m_groundLayer;
v6 = a2 * 60.0;
a1->m_deltaCount = a2 + a1->m_deltaCount;
v7 = (__int64)m_groundLayer->m_ground1Sprite->getColor(&m_groundLayer->m_ground1Sprite->cocos2d::CCRGBAProtocol);
LOWORD(v44.x) = *(_WORD *)v7;
BYTE2(v44.x) = *(_BYTE *)(v7 + 2);
v8 = a1->m_groundLayer->m_ground1Sprite->getChildren(a1->m_groundLayer->m_ground1Sprite);
v9 = 0;
v10 = v8;
if ( v8 )
{
v11 = 0;
if ( cocos2d::CCArray::count(v8) )
{
do
{
v12 = cocos2d::CCArray::objectAtIndex(v10, v11);
(**(void (__fastcall ***)(__int64, cocos2d::CCPoint *))&v12[5].m_unknown2)((__int64)&v12[5].m_unknown2, &v44);
++v11;
}
while ( v11 < cocos2d::CCArray::count(v10) );
}
}
m_ground2Sprite = a1->m_groundLayer->m_ground2Sprite;
if ( m_ground2Sprite )
{
v14 = (__int64)m_ground2Sprite->getColor(&m_ground2Sprite->cocos2d::CCRGBAProtocol);
LOWORD(v44.x) = *(_WORD *)v14;
BYTE2(v44.x) = *(_BYTE *)(v14 + 2);
v15 = a1->m_groundLayer->m_ground2Sprite;
if ( v15 )
{
v16 = v15->getChildren(v15);
v17 = v16;
if ( v16 )
{
if ( cocos2d::CCArray::count(v16) )
{
do
{
v18 = cocos2d::CCArray::objectAtIndex(v17, v9);
(**(void (__fastcall ***)(__int64, cocos2d::CCPoint *))&v18[5].m_unknown2)(
(__int64)&v18[5].m_unknown2,
&v44);
++v9;
}
while ( v9 < cocos2d::CCArray::count(v17) );
}
}
}
}
a1->m_playerObject->getPosition_0(a1->m_playerObject);
cocos2d::CCPoint::CCPoint(&v44);
cocos2d::CCPoint::operator=(&a1->m_playerObject->m_shipRotation, v19);
PlayerObject::updateInternalActions(a1->m_playerObject, a2);
((void (__fastcall *)(PlayerObject *))a1->m_playerObject->update)(a1->m_playerObject);
v21 = 0.0;
a1->m_playerObject->m_totalTime = a1->m_deltaCount;
m_playerObject = a1->m_playerObject;
m_vehicleSize = m_playerObject->m_vehicleSize;
m_unkAngle1 = m_playerObject->m_unkAngle1;
if ( m_vehicleSize != 1.0 )
v21 = (float)((float)(1.0 - m_vehicleSize) * m_unkAngle1) * 0.5;
v25 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v20);
ScreenBottom = cocos2d::CCDirector::getScreenBottom(v25);
if ( (float)((float)((float)(ScreenBottom + 90.0) + (float)(m_unkAngle1 * 0.5)) - v21) > a1->m_playerObject->getPosition_0(a1->m_playerObject)->y )
{
v27 = a1->m_playerObject;
v28 = v27->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v29 = (float *)v27->getPosition_0(v27);
cocos2d::CCPoint::CCPoint(ScreenBottom, *v29);
v28->setPosition_0(a1->m_playerObject, v30);
PlayerObject::hitGround(a1->m_playerObject, nullptr, 0);
}
PlayerObject::updateRotation_1(a1->m_playerObject, v6);
x = a1->m_playerObject->getPosition_0(a1->m_playerObject)->x;
if ( x > (float)(v43 + 100.0) )
MenuGameLayer::resetPlayer(a1);
cocos2d::CCPoint::CCPoint(x, (float)((float)(v6 * 5.7700019) * 0.89999998) + a1->m_realBackgroundPosition.x);
v33 = cocos2d::CCPoint::operator=(&a1->m_realBackgroundPosition, v32);
cocos2d::CCPoint::CCPoint(*(float *)&v33, (float)-a1->m_realBackgroundPosition.x * 0.1);
v34 = v45;
v35 = -a1->m_backgroundWrapPosition;
if ( v35 > v45 )
{
do
v34 = v34 + a1->m_backgroundWrapPosition;
while ( v35 > v34 );
v45 = v34;
}
v36 = ((float (__fastcall *)(cocos2d::CCSprite *, float *))a1->m_backgroundSprite->setPosition_0)(
a1->m_backgroundSprite,
&v45);
cocos2d::CCPoint::CCPoint(v36, -a1->m_realBackgroundPosition.x);
v37 = v46;
m_textureWidth = a1->m_groundLayer->m_textureWidth;
if ( (float)-m_textureWidth > v46 )
{
do
v37 = v37 + m_textureWidth;
while ( (float)-m_textureWidth > v37 );
v46 = v37;
}
cocos2d::CCPoint::CCPoint(&v44);
v39 = a1->m_groundLayer;
v41 = v40;
v39->m_ground1Sprite->setPosition_0(v39->m_ground1Sprite, v40);
v42 = v39->m_ground2Sprite;
if ( v42 )
v42->setPosition_0(v42, v41);
HardStreak::updateStroke(a1->m_playerObject->m_waveTrail, a2);
}