//
// MenuGameLayer::tryJump from 0x140331f70 to 0x140332237 (711 bytes)
//
// 4 xrefs:
// > MenuGameLayer::init @ 0x140331a78
// > ??> @ 0x14069404c
// > ??> @ 0x140694060
// > ??> @ 0x1406d5084
//
// 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::tryJump(MenuGameLayer *a1, float a2)
{
cocos2d::CCDirector *v3; // rax
float v4; // xmm6_4
PlayerObject *m_playerObject; // rcx
__int64 v6; // rbx
__int64 v7; // rcx
cocos2d::CCDirector *v8; // rax
__int64 v9; // rbx
__int64 v10; // rcx
cocos2d::CCDirector *v11; // rax
__int64 v12; // rbx
__int64 v13; // rcx
cocos2d::CCDirector *v14; // rax
const cocos2d::CCPoint *v15; // rax
PlayerObject *v16; // rcx
PlayerObject *v17; // rcx
PlayerObject *v18; // rbx
bool v19; // zf
int v20; // [rsp+40h] [rbp+8h] BYREF
float v21; // [rsp+54h] [rbp+1Ch]
v3 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v3);
v4 = 0.2;
if ( a1->m_isDestroyingPlayer )
v4 = 0.40000001;
m_playerObject = a1->m_playerObject;
if ( !m_playerObject->m_isShip )
{
if ( m_playerObject->m_isBall || m_playerObject->m_isSpider )
{
v4 = -1.0;
goto LABEL_25;
}
if ( m_playerObject->m_isBird )
{
v9 = (__int64)m_playerObject->getPosition_0(m_playerObject);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
if ( (float)((float)((float)(cocos2d::CCDirector::getScreenBottom(v11) + 90.0) + 15.0) + 200.0) > *(float *)(v9 + 4) )
{
v4 = 0.40000001;
goto LABEL_25;
}
}
else if ( m_playerObject->m_isDart )
{
v12 = (__int64)m_playerObject->getPosition_0(m_playerObject);
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v13);
if ( (float)((float)(cocos2d::CCDirector::getScreenBottom(v14) + 90.0) + 75.0) > *(float *)(v12 + 4) )
{
v4 = 1.0;
goto LABEL_25;
}
v15 = a1->m_playerObject->getPosition_0(a1->m_playerObject);
if ( v15->y <= (float)(v21 - 75.0) )
{
v4 = 0.5;
goto LABEL_25;
}
}
else
{
if ( !m_playerObject->m_isSwing )
goto LABEL_25;
if ( !m_playerObject->m_isUpsideDown && m_playerObject->getPosition_0(m_playerObject)->y < 150.0 )
{
v4 = 0.89999998;
goto LABEL_25;
}
v16 = a1->m_playerObject;
if ( v16->m_isUpsideDown && v16->getPosition_0(v16)->y > 210.0 )
{
v4 = 0.89999998;
goto LABEL_25;
}
}
LABEL_15:
v4 = 0.0;
goto LABEL_25;
}
v6 = (__int64)m_playerObject->getPosition_0(m_playerObject);
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
if ( (float)((float)((float)(cocos2d::CCDirector::getScreenBottom(v8) + 90.0) + 15.0) + 100.0) <= *(float *)(v6 + 4) )
goto LABEL_15;
v4 = 0.30000001;
LABEL_25:
if ( v4 >= (float)((float)rand() / 32767.0)
&& ((v17 = a1->m_playerObject, v17->m_isOnGround2)
|| v17->m_isShip
|| v17->m_isBird
|| v17->m_isDart
|| v17->m_isSwing) )
{
PlayerObject::pushButton(v17, Jump);
}
else
{
v18 = a1->m_playerObject;
if ( !v18->m_inputsLocked )
{
v20 = 1;
*(_BYTE *)sub_1400CDBF0((__int64 *)&v18->m_holdingButtons, &v20) = 0;
}
if ( !v18->m_controlsDisabled )
{
if ( v18->m_jumpBuffered )
PlayerObject::placeStreakPoint(v18);
v19 = !v18->m_isDashing;
*(_WORD *)&v18->m_jumpBuffered = 0;
v18->m_touchedPad = 1;
if ( !v19 )
PlayerObject::stopDashing(v18);
}
}
}