//
// PlayerObject::updateJump from 0x349428 to 0x34a24e (3622 bytes)
//
// 2 xrefs:
// > PlayerObject::pushButton @ 0x34e9c6
// > PlayerObject::update @ 0x34f146
//
// 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 PlayerObject::updateJump(PlayerObject *a1, float a2)
{
double v2; // d0
float v3; // s16
_BOOL4 m_holdingLeft; // r6
_BOOL4 m_holdingRight; // r8
float v8; // s15
int v9; // r7
unsigned int v10; // r0
_BOOL4 m_jumpBuffered; // r9
int v12; // s15
_BOOL4 m_isOnGround; // r7
double m_gravity; // d9
float v15; // s17
float *p_m_vehicleSize; // r10
float m_gravityMod; // s19
float v18; // s20
bool v19; // zf
float v20; // s19
_BOOL4 m_platformerMovingLeft; // r2
_BOOL4 m_platformerMovingRight; // r6
_BOOL4 v23; // r8
_BOOL4 m_isPlatformer; // r1
float m_yStart; // s17
int v26; // r8
int m_maybeSlidingTime; // r3
double v28; // d6
double v29; // d7
int v30; // r0
int v31; // r0
float v32; // r1
float v33; // r2
double *p_m_platformerXVelocity; // r3
float v35; // s16
double *v36; // r6
float v37; // s16
float ModifiedSlopeYVel; // s15
PlayerObject *v39; // r0
double v40; // r2
GJRobotSprite *m_robotSprite; // r9
_BOOL4 m_isRobot; // r2
PlayerObject *v43; // r0
int v44; // r1
GameManager *v45; // r0
float v46; // s16
double m_accelerationOrSpeed; // d6
int v48; // r0
int v49; // r0
int v50; // r0
double v51; // d6
PlayerObject *v52; // r0
double v53; // r2
double v54; // d6
GJRobotSprite *v56; // r7
GJSpiderSprite *v57; // r7
float v58; // s13
double *p_m_yVelocity; // r6
_BOOL4 m_isUpsideDown; // r1
double m_yVelocity; // d5
float v62; // s14
float v63; // s12
float v64; // s18
float v65; // s16
int v66; // r0
_BOOL4 v67; // r2
PlayerObject *v68; // r0
int v69; // r1
_BOOL4 m_isBird; // r7
float v71; // s17
double v72; // d7
float m_slopeVelocity; // s13
float v74; // s17
double v75; // r2
float v76; // s17
float v77; // s18
float v78; // s16
int v79; // r0
_BOOL4 m_isSwing; // r8
double v81; // d7
float v82; // s17
float v83; // s21
float v84; // s18
int v85; // r0
float v86; // s15
float v87; // s14
double v88; // d8
double v89; // d8
double v90; // d7
double v91; // d7
double v92; // r2
PlayerObject *v93; // r0
double v94; // r2
double v95; // r2
PlayerObject_vtbl *v96; // r3
GJRobotSprite *v97; // r7
GJSpiderSprite *m_spiderSprite; // r7
int v99; // [sp+0h] [bp-18h]
int v100; // [sp+0h] [bp-18h]
int v101; // [sp+0h] [bp-18h]
std::string v102; // [sp+10h] [bp-8h] BYREF
m_holdingLeft = a1->m_holdingLeft;
m_holdingRight = a1->m_holdingRight;
if ( a1->m_holdingLeft && a1->m_holdingRight )
{
if ( a1->m_leftPressedFirst )
m_holdingRight = 0;
else
m_holdingLeft = 0;
}
if ( a1->m_isPlatformer && a1->m_isOnSlope )
{
v8 = fabsf(a1->m_slopeAngleRadians * 57.296);
if ( v8 >= 80.0 || v8 >= 40.0 && a1->m_currentSlope->m_isIceBlock )
a1->m_isOnGround = 0;
}
if ( a1->m_isOnGround )
v9 = 213;
else
v9 = 0;
a1->m_jumpRelatedAC2.value = v9;
v10 = rand();
m_jumpBuffered = a1->m_jumpBuffered;
v12 = (int)(float)(vcvts_n_f32_s32(v10, 0x1Fu) * 1000.0);
a1->m_jumpRelatedAC2.seed = v12;
a1->m_jumpRelatedAC2.random = v12 + v9;
m_isOnGround = a1->m_isOnGround;
m_gravity = a1->m_gravity;
if ( a1->m_isRobot && !a1->m_stateRingJump )
m_jumpBuffered = 0;
if ( a1->m_isBall || PlayerObject::isFlying(a1) || a1->m_isSpider )
v15 = 0.9582;
else
v15 = m_gravity;
p_m_vehicleSize = &a1->m_vehicleSize;
m_gravityMod = a1->m_gravityMod;
v18 = 1.0;
v19 = m_gravityMod == 1.0;
if ( m_gravityMod != 1.0 )
v3 = v15 * m_gravityMod;
v20 = 0.8;
if ( v19 )
v3 = v15;
if ( a1->m_vehicleSize == 1.0 )
v20 = 1.0;
if ( PlayerObject::isFlying(a1) )
{
v58 = *p_m_vehicleSize;
p_m_yVelocity = &a1->m_yVelocity;
m_isUpsideDown = a1->m_isUpsideDown;
m_yVelocity = a1->m_yVelocity;
if ( *p_m_vehicleSize != 1.0 )
v20 = 0.85;
v62 = 8.0 / v20;
v63 = -6.4 / v20;
if ( a1->m_isUpsideDown )
{
if ( (m_yVelocity > 0.0 || m_yVelocity <= (float)-v62) && (m_yVelocity < 0.0 || m_yVelocity >= (float)-v63) )
{
LABEL_163:
if ( a1->m_isShip )
{
if ( a1->m_jumpBuffered && !a1->m_isAccelerating )
{
v64 = -1.0;
}
else
{
if ( a1->m_isAccelerating )
{
if ( m_isUpsideDown )
{
v64 = 0.8;
if ( *p_m_yVelocity > 0.0 )
v64 = -1.0;
}
else
{
v64 = 0.8;
if ( *p_m_yVelocity < 0.0 )
v64 = -1.0;
}
}
else
{
v64 = 0.8;
}
if ( !a1->m_jumpBuffered && !PlayerObject::playerIsFallingBugged(a1) )
v64 = 1.2;
}
if ( a1->m_isPlatformer )
v3 = v3 * 0.8;
if ( v64 >= 0.0 )
v15 = v3;
if ( a1->m_jumpBuffered && PlayerObject::playerIsFallingBugged(a1) )
v65 = 0.5;
else
v65 = 0.4;
v66 = PlayerObject::flipMod(a1);
PlayerObject::addToYVelocity(
a1,
(float)-(float)((float)((float)((float)((float)(v15 * a2) * (float)v66) * v64) * v65) / v20),
64);
v67 = a1->m_jumpBuffered;
if ( a1->m_jumpBuffered )
a1->m_isOnGround2 = 0;
if ( !a1->m_gameLayer || a1->m_wasJumpBuffered == v67 )
goto LABEL_236;
v68 = a1;
if ( v67 )
{
v69 = 16;
v67 = 0;
}
else
{
v69 = 17;
}
LABEL_234:
PlayerObject::gameEventTriggered(v68, v69, v67);
LABEL_236:
v76 = 0.8;
LABEL_237:
if ( !a1->m_isAccelerating && !a1->m_isDart )
{
v91 = *p_m_yVelocity;
if ( a1->m_isUpsideDown )
{
if ( v91 < (float)(-8.0 / v20) )
v95 = (float)(-8.0 / v20);
else
v95 = *p_m_yVelocity;
PlayerObject::setYVelocity(a1, v95, 15);
v93 = a1;
v101 = 16;
if ( *p_m_yVelocity > (float)((float)(v76 * 8.0) / v20) )
v94 = (float)((float)(v76 * 8.0) / v20);
else
v94 = *p_m_yVelocity;
}
else
{
if ( v91 < (float)((float)(v76 * -8.0) / v20) )
v92 = (float)((float)(v76 * -8.0) / v20);
else
v92 = *p_m_yVelocity;
PlayerObject::setYVelocity(a1, v92, 13);
v93 = a1;
v101 = 14;
if ( *p_m_yVelocity > (float)(8.0 / v20) )
v94 = (float)(8.0 / v20);
else
v94 = *p_m_yVelocity;
}
PlayerObject::setYVelocity(v93, v94, v101);
}
if ( PlayerObject::playerIsFallingBugged(a1) )
a1->m_maybeIsBoosted = 0;
goto LABEL_255;
}
m_isBird = a1->m_isBird;
if ( !a1->m_isBird )
{
m_isSwing = a1->m_isSwing;
if ( a1->m_isSwing )
{
if ( a1->m_stateRingJump && a1->m_jumpBuffered )
{
v81 = *p_m_yVelocity;
a1->m_stateRingJump = m_isBird;
PlayerObject::flipGravity(a1, !m_isUpsideDown, 1);
v82 = v81;
PlayerObject::setYVelocity(a1, (float)(v82 * 0.8), 10);
if ( a1->m_gameLayer )
PlayerObject::gameEventTriggered(a1, 20, m_isBird);
}
v83 = v3 * a2;
v84 = 0.6;
if ( *p_m_vehicleSize == 1.0 )
v84 = 0.4;
v85 = PlayerObject::flipMod(a1);
PlayerObject::addToYVelocity(a1, (float)-(float)(v84 * (float)(v83 * (float)v85)), 67);
if ( a1->m_jumpBuffered )
a1->m_isOnGround2 = 0;
v76 = 1.0;
v20 = 1.0;
goto LABEL_237;
}
v86 = 1.0;
v87 = (float)PlayerObject::flipMod(a1) * 8.0;
if ( !a1->m_jumpBuffered )
v86 = -1.0;
PlayerObject::setYVelocity(a1, (float)(v87 * v86), 11);
v88 = a1->m_playerSpeed * a1->m_speedMultiplier;
v89 = v88 * (double)PlayerObject::flipMod(a1);
v90 = 1.0;
if ( !a1->m_jumpBuffered )
v90 = -1.0;
PlayerObject::setYVelocity(a1, v89 * v90, 12);
if ( !a1->m_gameLayer )
goto LABEL_236;
v67 = a1->m_jumpBuffered;
if ( a1->m_wasJumpBuffered == v67 )
goto LABEL_236;
v68 = a1;
if ( a1->m_jumpBuffered )
{
v69 = 21;
v67 = m_isSwing;
}
else
{
v69 = 22;
}
goto LABEL_234;
}
if ( !a1->m_stateRingJump || !a1->m_jumpBuffered )
{
LABEL_212:
v76 = 0.8;
v77 = 1.2;
v78 = v3 * a2;
if ( PlayerObject::playerIsFallingBugged(a1) )
v77 = 0.8;
v79 = PlayerObject::flipMod(a1);
PlayerObject::addToYVelocity(
a1,
(float)-(float)((float)((float)((float)(v78 * (float)v79) * v77) * 0.5) / v20),
66);
if ( a1->m_jumpBuffered )
a1->m_isOnGround2 = 0;
goto LABEL_237;
}
a1->m_stateRingJump = 0;
v71 = 8.0;
if ( v58 == 1.0 )
v71 = 7.0;
v72 = (float)((float)(v71 * (float)PlayerObject::flipMod(a1)) * v20);
if ( a1->m_isUpsideDown )
{
if ( v72 >= *p_m_yVelocity )
goto LABEL_210;
}
else if ( v72 <= *p_m_yVelocity )
{
LABEL_210:
PlayerObject::playBurstEffect(a1);
if ( a1->m_gameLayer )
PlayerObject::gameEventTriggered(a1, 15, 0);
goto LABEL_212;
}
PlayerObject::setYVelocity(a1, v72, 7);
if ( a1->m_wasOnSlope || a1->m_isOnSlope )
{
m_slopeVelocity = a1->m_slopeVelocity;
if ( m_slopeVelocity > 0.0 )
{
v74 = *p_m_yVelocity * 1.39999998;
PlayerObject::addToYVelocity(a1, (float)(m_slopeVelocity * 0.5), 8);
if ( *p_m_yVelocity > v74 )
v75 = v74;
else
v75 = *p_m_yVelocity;
PlayerObject::setYVelocity(a1, v75, 9);
}
}
goto LABEL_210;
}
}
else if ( (m_yVelocity < 0.0 || m_yVelocity >= v62) && (m_yVelocity > 0.0 || m_yVelocity <= v63) )
{
goto LABEL_163;
}
a1->m_isAccelerating = 0;
goto LABEL_163;
}
if ( a1->m_isBall || a1->m_isSpider || a1->m_isSwing )
{
v18 = 0.6;
}
else if ( a1->m_isRobot )
{
v18 = 0.9;
}
m_platformerMovingLeft = a1->m_platformerMovingLeft;
if ( a1->m_platformerMovingLeft && !m_holdingLeft )
goto LABEL_258;
m_platformerMovingRight = a1->m_platformerMovingRight;
if ( a1->m_platformerMovingRight )
{
if ( m_holdingRight )
{
m_platformerMovingRight = 0;
goto LABEL_40;
}
LABEL_258:
if ( a1->m_isSlidingRight != m_platformerMovingLeft && !a1->m_slopeSlidingMaybeRotated )
a1->m_maybeSlidingTime = a1->m_slopeSlidingMaybeRotated;
m_platformerMovingRight = 1;
v23 = a1->m_maybeSlidingTime <= 1;
goto LABEL_41;
}
LABEL_40:
v23 = 1;
LABEL_41:
if ( m_jumpBuffered && a1->m_isOnGround )
{
if ( a1->m_isSpider && !a1->m_isDashing )
{
PlayerObject::spiderTestJump(a1, 0);
goto LABEL_255;
}
if ( !a1->m_isDashing )
{
m_isPlatformer = a1->m_isPlatformer;
if ( !a1->m_isPlatformer || v23 )
{
a1->m_maybeIsBoosted = 1;
a1->m_isOnGround2 = 0;
a1->m_isOnGround = 0;
a1->m_stateRingJump = 0;
a1->m_touchedPad = 0;
a1->m_accelerationOrSpeed = 0.0;
if ( !m_platformerMovingLeft && !a1->m_platformerMovingRight && a1->m_maybeSlidingTime > 0 )
{
a1->m_maybeSlidingTime = 0;
a1->m_maybeSlidingStartTime = a1->m_totalTime;
}
m_yStart = a1->m_yStart;
if ( a1->m_isRobot )
m_yStart = m_yStart * 0.5;
if ( a1->m_jumpRelatedAC2.random - a1->m_jumpRelatedAC2.seed == 213 )
{
v26 = 0;
}
else
{
v26 = 1;
m_yStart = 9999.0;
a1->m_isAccelerating = 1;
}
if ( m_isPlatformer && m_platformerMovingRight )
{
m_maybeSlidingTime = a1->m_maybeSlidingTime;
if ( a1->m_isMoving
&& (v28 = a1->m_playerSpeed * a1->m_speedMultiplier, v29 = fabs(a1->m_platformerXVelocity), v29 > v28) )
{
m_yStart = m_yStart + v29 / v28;
}
else if ( m_maybeSlidingTime > 0 )
{
m_yStart = m_yStart * (float)(1.0 - (float)((float)m_maybeSlidingTime * 0.3));
}
a1->m_maybeSlidingTime = m_maybeSlidingTime + 1;
}
v30 = PlayerObject::flipMod(a1);
PlayerObject::setYVelocity(a1, (float)((float)(m_yStart * (float)v30) * v20), 2);
if ( a1->m_wasOnSlope || (p_m_platformerXVelocity = (double *)a1->m_isOnSlope) != nullptr )
{
v35 = a1->m_slopeVelocity;
v31 = PlayerObject::flipMod(a1);
if ( (float)(v35 * (float)v31) > 0.0 )
{
if ( !a1->m_isPlatformer
|| (p_m_platformerXVelocity = &a1->m_platformerXVelocity, fabs(a1->m_platformerXVelocity) > 4.0) )
{
v36 = &a1->m_yVelocity;
v37 = a1->m_yVelocity * 1.39999998;
ModifiedSlopeYVel = PlayerObject::getModifiedSlopeYVel(a1);
if ( a1->m_isBall )
ModifiedSlopeYVel = a1->m_slopeVelocity;
PlayerObject::addToYVelocity(a1, (float)(ModifiedSlopeYVel * 0.25), 60);
if ( a1->m_isUpsideDown )
{
v99 = 4;
v39 = a1;
if ( *v36 < v37 )
v40 = v37;
else
v40 = *v36;
}
else
{
v99 = 3;
v39 = a1;
if ( *v36 > v37 )
v40 = v37;
else
v40 = *v36;
}
PlayerObject::setYVelocity(v39, v40, v99);
}
}
}
a1->m_shouldTryPlacingCheckpoint = 1;
sub_33C0D8(v31, v32, v33, (int)p_m_platformerXVelocity);
a1->m_lastJumpTime = v2;
PlayerObject::incrementJumps(a1);
if ( a1->m_isBall )
{
PlayerObject::flipGravity(a1, !a1->m_isUpsideDown, 1);
a1->m_yVelocity = a1->m_yVelocity * 0.600000024;
a1->m_isOnGround3 = 0;
a1->m_jumpBuffered = 0;
}
else if ( !a1->m_isRobot && !a1->m_isSpider )
{
PlayerObject::runRotateAction(a1, 1, 11);
}
if ( a1->m_isRobot )
{
m_robotSprite = a1->m_robotSprite;
sub_776584((int)&v102, "jump_loop");
CCAnimatedSprite::tweenToAnimation((int)m_robotSprite, &v102, 0.1);
sub_774008(&v102);
}
if ( !a1->m_gameLayer )
goto LABEL_92;
m_isRobot = PlayerObject::isInNormalMode(a1);
if ( m_isRobot )
{
v43 = a1;
v44 = 12;
m_isRobot = 0;
}
else if ( a1->m_isRobot )
{
v43 = a1;
v44 = 13;
}
else
{
if ( !a1->m_isBall )
goto LABEL_92;
v43 = a1;
v44 = 19;
m_isRobot = a1->m_isRobot;
}
PlayerObject::gameEventTriggered(v43, v44, m_isRobot);
LABEL_92:
if ( !v26 && !m_isOnGround )
{
v45 = GameManager::sharedState();
GameManager::setGameVariable(v45, "0055", 1);
}
if ( a1->m_isPlatformer )
PlayerObject::animatePlatformerJump(a1, 1.0);
goto LABEL_255;
}
}
}
v46 = v3 * a2;
if ( a1->m_maybeIsBoosted )
{
if ( a1->m_isRobot && a1->m_jumpBuffered && !a1->m_touchedPad )
{
m_accelerationOrSpeed = a1->m_accelerationOrSpeed;
if ( m_accelerationOrSpeed < 1.5 )
{
a1->m_accelerationOrSpeed = m_accelerationOrSpeed + (float)(a2 * 0.1);
v48 = PlayerObject::flipMod(a1);
PlayerObject::addToYVelocity(a1, (float)((float)(v46 * (float)v48) * v18), 61);
}
}
v49 = PlayerObject::flipMod(a1);
PlayerObject::addToYVelocity(a1, (float)-(float)(v18 * (float)(v46 * (float)v49)), 62);
if ( a1->m_isRobot && a1->m_touchedPad && !a1->m_wasRobotJump && a1->m_gameLayer )
PlayerObject::gameEventTriggered(a1, 14, a1->m_wasRobotJump);
if ( PlayerObject::playerIsFallingBugged(a1) || a1->m_isPlatformer && !PlayerObject::playerIsMovingUp(a1) )
{
a1->m_maybeIsBoosted = 0;
a1->m_isOnGround2 = 0;
v96 = a1->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_maybeIsFalling = 1;
a1->m_fallStartY = v96->getPosition(a1)->y;
if ( a1->m_isRobot )
{
v97 = a1->m_robotSprite;
sub_776584((int)&v102, "fall_loop");
CCAnimatedSprite::tweenToAnimation((int)v97, &v102, 0.1);
sub_774008(&v102);
if ( !a1->m_touchedPad && a1->m_gameLayer )
PlayerObject::gameEventTriggered(a1, 14, a1->m_touchedPad);
}
else if ( a1->m_isSpider )
{
m_spiderSprite = a1->m_spiderSprite;
sub_776584((int)&v102, "fall_loop");
CCAnimatedSprite::tweenToAnimation((int)m_spiderSprite, &v102, 0.1);
sub_774008(&v102);
}
}
goto LABEL_255;
}
if ( a1->m_isOnGround )
a1->m_fallStartY = a1->getPosition(a1)->y;
if ( PlayerObject::playerIsFallingBugged(a1)
&& (!a1->m_isPlatformer || a1->m_totalTime - a1->m_lastLandTime >= 0.0500000045 || !v23) )
{
a1->m_isOnGround = 0;
}
v50 = PlayerObject::flipMod(a1);
PlayerObject::addToYVelocity(a1, (float)-(float)(v18 * (float)(v46 * (float)v50)), 63);
v51 = a1->m_yVelocity;
if ( a1->m_isUpsideDown )
{
v100 = 6;
v52 = a1;
if ( v51 <= 15.0 )
v53 = a1->m_yVelocity;
else
v53 = 15.0;
}
else
{
v52 = a1;
v100 = 5;
if ( v51 >= -15.0 )
v53 = a1->m_yVelocity;
else
v53 = -15.0;
}
PlayerObject::setYVelocity(v52, v53, v100);
if ( PlayerObject::playerIsFalling(a1, -0.25)
&& !a1->m_isBall
&& !a1->m_isSpider
&& !a1->m_isRobot
&& !a1->m_isRotating
&& !a1->m_isOnSlope
&& !a1->m_isCollidingWithSlope
&& (!a1->m_isPlatformer || !a1->m_isOnGround2) )
{
PlayerObject::runRotateAction(a1, 1, 12);
}
if ( PlayerObject::playerIsFallingBugged(a1) )
{
v54 = a1->m_yVelocity;
if ( a1->m_isUpsideDown ? v54 > 4.0 : v54 < -4.0 )
{
if ( a1->m_isRobot && a1->m_isOnGround2 && !a1->m_maybeSpriteRelated )
{
v56 = a1->m_robotSprite;
sub_776584((int)&v102, "fall_loop");
CCAnimatedSprite::tweenToAnimation((int)v56, &v102, 0.1);
}
else
{
if ( !a1->m_isSpider || !a1->m_isOnGround2 || a1->m_maybeSpriteRelated )
goto LABEL_149;
v57 = a1->m_spiderSprite;
sub_776584((int)&v102, "fall_loop");
CCAnimatedSprite::tweenToAnimation((int)v57, &v102, 0.1);
}
sub_774008(&v102);
LABEL_149:
a1->m_isOnGround2 = 0;
}
}
LABEL_255:
a1->m_wasJumpBuffered = a1->m_jumpBuffered;
a1->m_wasRobotJump = a1->m_touchedPad;
}