//
// PlayerObject::updateMove from 0x342e00 to 0x343c92 (3730 bytes)
//
// 1 xrefs:
// > PlayerObject::update @ 0x34f2bc
//
// 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::updateMove(PlayerObject *a1, float a2)
{
_BOOL4 m_isOnSlope; // r8
double v5; // d10
double *p_m_platformerXVelocity; // r7
_BOOL4 m_holdingLeft; // r6
_BOOL4 m_holdingRight; // r5
double m_platformerXVelocity; // d11
float v10; // s18
_BOOL4 v11; // r3
_BOOL4 m_isOnGround2; // r3
int v13; // r1
double v14; // d12
double v15; // d13
double v16; // d9
_BOOL4 m_platformerMovingRight; // r2
double v18; // d7
double m_yVelocityBeforeSlope; // d6
double *p_m_maybeSlopeForce; // r0
double v21; // d7
GJRobotSprite *v22; // r9
double v23; // d7
_BOOL4 m_isRobot; // r8
_BOOL4 v25; // r8
GJRobotSprite *m_robotSprite; // r9
GJSpiderSprite *m_spiderSprite; // r9
float v28; // s13
float m_platformerVelocityRelated; // s12
float v30; // s14
double v31; // d5
_BOOL4 m_maybeGoingCorrectSlopeDirection; // r1
_BOOL4 m_platformerMovingLeft; // r2
float v34; // s7
double v35; // d6
double v36; // d6
double v37; // d8
double v38; // d4
double v39; // d6
double v40; // d4
double v41; // d6
double v42; // d5
double v43; // d6
double v44; // d5
double v45; // d4
double v46; // d6
double m_xVelocityRelated; // d8
double v48; // d12
double v49; // d9
float v50; // s16
_BOOL4 m_isGoingLeft; // r8
PlayerObject *v52; // r0
bool v53; // r1
float v54; // r0
float v55; // s14
float v56; // s14
_BOOL4 v57; // r0
float *p_m_somethingPlayerSpeedTime; // r8
float v59; // s14
_BOOL4 v60; // r3
float v61; // s14
GJRobotSprite *v62; // r9
GJSpiderSprite *v63; // r9
double v64; // d6
float v65; // s16
float v66; // s12
float *p_m_xVelocityRelated2; // r8
float v68; // s14
float v69; // s15
float v70; // s14
float v71; // s15
float v72; // s15
double v73; // d8
float m_slopeRotation; // s15
void (__fastcall *v75)(PlayerObject *__hidden, float); // r5
float v76; // s15
float v77; // s14
double v78; // d7
void (__fastcall *setRotation)(PlayerObject *__hidden, float); // r8
float v80; // s14
PlayerObject *v81; // r0
float v82; // r1
float v83; // r0
_BOOL4 v84; // [sp+4h] [bp-38h]
double *p_m_totalTime; // [sp+8h] [bp-34h]
_BYTE v86[4]; // [sp+24h] [bp-18h] BYREF
_BYTE v87[4]; // [sp+28h] [bp-14h] BYREF
_BYTE v88[4]; // [sp+2Ch] [bp-10h] BYREF
std::string v89; // [sp+30h] [bp-Ch] BYREF
m_isOnSlope = a1->m_isOnSlope;
v5 = a1->m_playerSpeed * a1->m_speedMultiplier;
if ( a1->m_isOnSlope && !a1->m_slopeFlipGravityRelated && !a1->m_maybeUpsideDownSlope )
v5 = v5 * cosf(a1->m_slopeAngle);
p_m_platformerXVelocity = &a1->m_platformerXVelocity;
m_holdingLeft = a1->m_holdingLeft;
m_holdingRight = a1->m_holdingRight;
m_platformerXVelocity = a1->m_platformerXVelocity;
v10 = 1.0;
if ( a1->m_isOnIce )
v10 = 0.2;
v11 = a1->m_holdingLeft || a1->m_holdingRight || a1->m_platformerMovingLeft || a1->m_platformerMovingRight;
v84 = v11;
m_isOnGround2 = a1->m_isOnGround2;
p_m_totalTime = &a1->m_totalTime;
if ( a1->m_holdingLeft && (!a1->m_holdingRight || a1->m_leftPressedFirst) )
{
if ( a1->m_isOnIce )
{
m_holdingRight = 0;
goto LABEL_299;
}
m_holdingRight = 0;
LABEL_289:
if ( !a1->m_isOnGround2 && a1->m_isSlidingRight != m_holdingLeft )
{
if ( a1->m_maybeSlidingTime > 0 )
{
v10 = 0.2;
}
else
{
v78 = *p_m_totalTime - a1->m_maybeSlidingStartTime;
if ( v78 < 0.5 )
v10 = (v78 + v78) * 0.800000012 + 0.200000003;
}
}
if ( !m_holdingLeft )
goto LABEL_17;
LABEL_299:
m_holdingLeft = 1;
v13 = -1;
goto LABEL_18;
}
if ( !a1->m_isOnIce )
{
m_holdingLeft = 0;
goto LABEL_289;
}
m_holdingLeft = 0;
LABEL_17:
v13 = 1;
LABEL_18:
v14 = a2;
v15 = a2 * 0.5;
v16 = v15 * v10;
if ( !a1->m_platformerMovingLeft || !m_holdingLeft )
{
m_platformerMovingRight = a1->m_platformerMovingRight;
if ( !a1->m_platformerMovingRight )
goto LABEL_28;
if ( !m_holdingRight )
{
m_platformerMovingRight = 0;
goto LABEL_28;
}
}
if ( fabs(m_platformerXVelocity) < v5 * 0.949999988 )
m_platformerMovingRight = 0;
else
m_platformerMovingRight = m_isOnSlope && !a1->m_maybeUpsideDownSlope;
LABEL_28:
if ( a1->m_isSliding || m_platformerMovingRight )
{
v18 = 1.0;
m_yVelocityBeforeSlope = a1->m_yVelocityBeforeSlope;
if ( m_yVelocityBeforeSlope < 0.0 )
v18 = m_yVelocityBeforeSlope / -15.0 * 0.300000012 + 1.0;
p_m_maybeSlopeForce = &a1->m_maybeSlopeForce;
if ( m_platformerMovingRight )
*p_m_maybeSlopeForce = *p_m_maybeSlopeForce + (float)(a2 * 0.25) * v18;
v21 = *p_m_maybeSlopeForce;
a1->m_isSliding = 1;
v5 = v5 + v21;
}
if ( m_holdingLeft )
{
if ( m_platformerXVelocity > 0.0 )
{
LABEL_39:
v16 = v16 * 1.5;
goto LABEL_40;
}
if ( !m_holdingRight )
goto LABEL_42;
}
else if ( !m_holdingRight )
{
goto LABEL_54;
}
if ( m_platformerXVelocity < 0.0 )
goto LABEL_39;
LABEL_40:
if ( !m_holdingLeft && !m_holdingRight )
{
LABEL_54:
if ( m_isOnGround2 )
{
m_isRobot = a1->m_isRobot;
if ( a1->m_isRobot )
{
sub_775C20(v86, &a1->m_robotSprite->m_animationManager->m_currentAnimation);
sub_776584((int)v87, "idle01");
if ( sub_774DBC(v86, v87) )
{
sub_775C20(v88, &a1->m_robotSprite->m_animationManager->m_currentAnimation);
sub_776584((int)&v89, "idle02");
v25 = sub_774DBC(v88, &v89) != 0;
sub_774008(&v89);
sub_774008(v88);
}
else
{
v25 = 0;
}
sub_774008(v87);
sub_774008(v86);
if ( !v25 )
goto LABEL_67;
m_robotSprite = a1->m_robotSprite;
sub_776584((int)&v89, "idle01");
CCAnimatedSprite::tweenToAnimation((int)m_robotSprite, &v89, 0.2);
}
else
{
if ( !a1->m_isSpider )
goto LABEL_67;
sub_775C20(v86, &a1->m_spiderSprite->m_animationManager->m_currentAnimation);
sub_776584((int)v87, "idle01");
if ( sub_774DBC(v86, v87) )
{
sub_775C20(v88, &a1->m_spiderSprite->m_animationManager->m_currentAnimation);
sub_776584((int)&v89, "idle02");
m_isRobot = sub_774DBC(v88, &v89) != 0;
sub_774008(&v89);
sub_774008(v88);
}
sub_774008(v87);
sub_774008(v86);
if ( !m_isRobot )
goto LABEL_67;
m_spiderSprite = a1->m_spiderSprite;
sub_776584((int)&v89, "idle01");
CCAnimatedSprite::tweenToAnimation((int)m_spiderSprite, &v89, 0.2);
}
sub_774008(&v89);
}
LABEL_67:
if ( a1->m_isOnIce )
{
v23 = 0.200000003;
}
else
{
v28 = 0.2;
m_platformerVelocityRelated = a1->m_platformerVelocityRelated;
v30 = m_platformerVelocityRelated + 0.2;
if ( (float)(m_platformerVelocityRelated + 0.2) >= 1.0 )
v30 = 1.0;
v23 = v30;
if ( !a1->m_isOnGround2 )
{
if ( a1->m_isShip || a1->m_isBall || a1->m_isBird )
{
v28 = 0.02;
}
else if ( a1->m_isRobot )
{
v28 = 0.1;
}
else
{
v28 = 0.1;
if ( !a1->m_isSpider )
v28 = 0.05;
}
}
a1->m_platformerVelocityRelated = m_platformerVelocityRelated + (float)(a2 * v28);
}
m_isOnGround2 = 1;
goto LABEL_84;
}
LABEL_42:
a1->m_platformerVelocityRelated = 0.0;
if ( m_holdingLeft && m_platformerXVelocity > -v5 || m_holdingRight && m_platformerXVelocity < v5 )
*p_m_platformerXVelocity = m_platformerXVelocity + v16 * (double)v13;
if ( m_isOnGround2 )
{
if ( a1->m_isRobot )
{
v22 = a1->m_robotSprite;
sub_775C20(&v89, &a1->m_currentRobotAnimation);
CCAnimatedSprite::runAnimation((int)v22, (int)&v89);
sub_774008(&v89);
LABEL_50:
v23 = 0.0500000007;
m_isOnGround2 = 0;
goto LABEL_84;
}
m_isOnGround2 = a1->m_isSpider;
if ( a1->m_isSpider )
{
PlayerObject::playDynamicSpiderRun(a1);
goto LABEL_50;
}
}
v23 = 0.0500000007;
LABEL_84:
v31 = *p_m_platformerXVelocity;
if ( fabs(*p_m_platformerXVelocity) < 0.5 )
a1->m_affectedByForces = 0;
if ( a1->m_affectedByForces )
{
m_isOnGround2 = 1;
}
else if ( a1->m_isMoving )
{
m_isOnGround2 = 1;
}
m_maybeGoingCorrectSlopeDirection = a1->m_maybeGoingCorrectSlopeDirection;
if ( (a1->m_maybeHasStopped || a1->m_affectedByForces || a1->m_isMoving) && !a1->m_isOnIce )
{
if ( a1->m_decreaseBoostSlide )
{
v23 = 0.0500000007;
}
else
{
v23 = 0.200000003;
if ( v84 )
v23 = 0.0500000007;
}
}
else if ( a1->m_maybeGoingCorrectSlopeDirection && !a1->m_isOnIce )
{
v23 = 0.100000001;
}
m_platformerMovingLeft = a1->m_platformerMovingLeft;
if ( a1->m_platformerMovingLeft || a1->m_platformerMovingRight )
{
a1->m_isSlidingRight = m_platformerMovingLeft;
if ( m_platformerMovingLeft )
{
v34 = -1.0;
if ( !m_holdingLeft )
{
LABEL_110:
if ( !a1->m_currentSlope )
goto LABEL_117;
v35 = fabsf(a1->m_slopeAngleRadians * 57.296);
if ( v35 > 80.0 )
{
v35 = 80.0;
goto LABEL_118;
}
if ( v35 > 40.0 )
{
if ( v35 > 80.0 )
v35 = 80.0;
}
else
{
LABEL_117:
v35 = 40.0;
}
LABEL_118:
v36 = (v35 - 40.0) / 40.0;
v37 = v15 * (v36 * 0.5 + 0.5) * 0.400000006;
if ( a1->m_isShip )
v37 = v37 * 0.699999988;
if ( m_platformerMovingLeft && v31 > 0.0 )
{
LABEL_124:
v38 = v36 * 0.699999988 + 1.35000002;
if ( a1->m_isShip )
{
v39 = 0.25;
}
else if ( a1->m_isBall )
{
v39 = 0.280000001;
}
else
{
if ( !a1->m_isSpider )
{
LABEL_131:
if ( a1->m_isOnIce )
v38 = v38 * 4.0;
if ( m_platformerMovingLeft && !m_holdingRight || a1->m_platformerMovingRight && !m_holdingLeft )
v38 = v38 * 0.800000012;
v40 = v16 * v38;
if ( fabs(v40) > fabs(v37) )
v37 = v40;
goto LABEL_143;
}
v39 = 0.200000003;
}
v38 = v38 - v39;
goto LABEL_131;
}
if ( a1->m_platformerMovingRight )
{
if ( v31 < 0.0 )
goto LABEL_124;
if ( (!m_platformerMovingLeft || !m_holdingRight) && !m_holdingLeft )
{
LABEL_143:
if ( a1->m_isOnSlope && !a1->m_isOnGround4 && a1->m_maybeSlidingTime > 0 && !a1->m_maybeUpsideDownSlope )
*p_m_platformerXVelocity = v31 * 0.800000012;
m_isOnGround2 = 0;
*p_m_platformerXVelocity = *p_m_platformerXVelocity + v37 * v34;
goto LABEL_149;
}
}
else if ( !m_platformerMovingLeft || !m_holdingRight )
{
goto LABEL_143;
}
v37 = v37 + v16;
goto LABEL_143;
}
}
else
{
v34 = 1.0;
}
if ( !a1->m_platformerMovingRight || m_holdingRight )
goto LABEL_149;
goto LABEL_110;
}
LABEL_149:
if ( !m_maybeGoingCorrectSlopeDirection )
goto LABEL_158;
if ( a1->m_isOnIce )
{
if ( m_isOnGround2 )
{
v41 = *p_m_platformerXVelocity;
v42 = -(v23 * *p_m_platformerXVelocity) * v14;
goto LABEL_170;
}
goto LABEL_161;
}
if ( !m_platformerMovingLeft && !a1->m_platformerMovingRight )
{
if ( a1->m_isSlidingRight )
{
if ( *p_m_platformerXVelocity <= 0.0 )
goto LABEL_163;
}
else if ( *p_m_platformerXVelocity >= 0.0 )
{
goto LABEL_163;
}
a1->m_maybeGoingCorrectSlopeDirection = 0;
LABEL_158:
if ( m_isOnGround2 )
goto LABEL_159;
goto LABEL_161;
}
LABEL_163:
if ( m_isOnGround2 )
{
v41 = *p_m_platformerXVelocity;
v42 = -(v23 * *p_m_platformerXVelocity) * v14;
goto LABEL_165;
}
LABEL_161:
v43 = *p_m_platformerXVelocity;
v44 = fabs(*p_m_platformerXVelocity);
if ( v44 <= v5 )
{
if ( a1->m_isPlatformer
&& (v44 < 0.00999999978 || m_platformerXVelocity > 0.0 && v43 < 0.0 || m_platformerXVelocity < 0.0 && v43 > 0.0) )
{
goto LABEL_184;
}
goto LABEL_185;
}
LABEL_159:
v41 = *p_m_platformerXVelocity;
v42 = -(v23 * *p_m_platformerXVelocity) * v14;
if ( a1->m_isOnIce )
{
LABEL_170:
v45 = 0.150000006;
goto LABEL_171;
}
LABEL_165:
v45 = 0.150000006;
if ( !a1->m_isMoving )
v45 = 1.0;
LABEL_171:
v46 = v41 + v42 * v45;
*p_m_platformerXVelocity = v46;
if ( fabs(v46) < 0.00999999978
|| a1->m_isPlatformer && (m_platformerXVelocity > 0.0 && v46 < 0.0 || m_platformerXVelocity < 0.0 && v46 > 0.0) )
{
*p_m_platformerXVelocity = 0.0;
LABEL_184:
a1->m_maybeHasStopped = 0;
a1->m_affectedByForces = 0;
a1->m_maybeGoingCorrectSlopeDirection = 0;
a1->m_isMoving = 0;
}
LABEL_185:
if ( a1->m_maybeHasStopped )
{
m_xVelocityRelated = a1->m_xVelocityRelated;
v48 = -(v23 * m_xVelocityRelated) * v14;
if ( a1->m_isOnIce )
{
v49 = 0.150000006;
}
else
{
v49 = 1.0;
if ( a1->m_isMoving )
v49 = 0.150000006;
}
v50 = m_xVelocityRelated + v48 * v49;
a1->m_xVelocityRelated = v50;
if ( fabsf(v50) < 1.0 )
a1->m_maybeHasStopped = 0;
}
if ( a1->m_isDashing )
{
*p_m_platformerXVelocity = v5;
goto LABEL_209;
}
m_isGoingLeft = a1->m_isGoingLeft;
if ( !m_holdingLeft )
{
if ( !m_holdingRight || !a1->m_isGoingLeft )
goto LABEL_202;
LABEL_200:
v52 = a1;
v53 = 0;
goto LABEL_201;
}
if ( !a1->m_isGoingLeft )
{
v52 = a1;
v53 = 1;
LABEL_201:
PlayerObject::doReversePlayer(v52, v53);
goto LABEL_202;
}
if ( m_holdingRight )
goto LABEL_200;
LABEL_202:
if ( a1->m_isGoingLeft == m_isGoingLeft )
goto LABEL_209;
PlayerObject::exitPlatformerAnimateJump(a1);
if ( !PlayerObject::isInNormalMode(a1) || a1->m_isRotating )
{
if ( a1->m_isShip || a1->m_isBird )
{
setRotation = a1->setRotation;
LODWORD(v82) = ((int (__fastcall *)(PlayerObject *))a1->getRotation)(a1) ^ 0x80000000;
v81 = a1;
goto LABEL_310;
}
}
else
{
v54 = COERCE_FLOAT(((int (__fastcall *)(PlayerObject *))a1->getRotation)(a1));
v55 = v54;
if ( a1->m_isOnSlope )
v55 = v54 - a1->m_slopeRotation * 57.2957802;
v56 = fabsf(v55);
if ( v56 > 45.0 && v56 < 135.0 || v56 > 225.0 && v56 < 315.0 )
{
setRotation = a1->setRotation;
v80 = COERCE_FLOAT(((int (__fastcall *)(PlayerObject *))a1->getRotation)(a1));
v81 = a1;
v82 = v80 + 180.0;
LABEL_310:
((void (__fastcall *)(PlayerObject *, _DWORD))setRotation)(v81, LODWORD(v82));
}
}
LABEL_209:
v57 = PlayerObject::isInNormalMode(a1);
if ( !v57 || *p_m_platformerXVelocity == 0.0 || a1->m_isRotating || !v84 || fabs(a1->m_yVelocity) <= 1.0 )
{
if ( !a1->m_isOnSlope
&& !a1->m_wasOnSlope
&& v57
&& !v84
&& !a1->m_isOnGround2
&& !a1->m_isRotating
&& (int)a1->getRotation(a1) % 90 )
{
v83 = PlayerObject::convertToClosestRotation(a1, 0.0);
PlayerObject::updateRotation(a1, a2, v83);
}
}
else
{
PlayerObject::runRotateAction(a1, 1, 10);
PlayerObject::exitPlatformerAnimateJump(a1);
}
p_m_somethingPlayerSpeedTime = &a1->m_somethingPlayerSpeedTime;
if ( m_holdingLeft || m_holdingRight || !a1->m_isOnGround2 )
{
v59 = *p_m_totalTime;
*p_m_somethingPlayerSpeedTime = v59;
}
else if ( *p_m_totalTime - *p_m_somethingPlayerSpeedTime > a1->m_playerSpeedAC )
{
a1->m_playerSpeedAC = (float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 10.0) + 5.0;
v60 = a1->m_isRobot;
v61 = *p_m_totalTime;
*p_m_somethingPlayerSpeedTime = v61;
if ( v60 )
{
v62 = a1->m_robotSprite;
sub_776584((int)&v89, "idle02");
CCAnimatedSprite::runAnimation((int)v62, (int)&v89);
}
else
{
if ( !a1->m_isSpider )
goto LABEL_233;
v63 = a1->m_spiderSprite;
sub_776584((int)&v89, "idle02");
CCAnimatedSprite::runAnimation((int)v63, (int)&v89);
}
sub_774008(&v89);
}
LABEL_233:
if ( !a1->m_isBall || a1->m_isBallRotating2 || a1->m_isDashing )
goto LABEL_286;
v64 = *p_m_platformerXVelocity;
v65 = -1.0;
if ( !a1->m_isSideways )
v65 = 1.0;
if ( a1->m_isOnIce )
{
p_m_xVelocityRelated2 = &a1->m_xVelocityRelated2;
if ( v64 >= 0.0 || (v68 = *p_m_xVelocityRelated2, *p_m_xVelocityRelated2 <= 0.0) )
{
if ( v64 <= 0.0 )
{
LABEL_247:
v68 = *p_m_xVelocityRelated2;
if ( *p_m_xVelocityRelated2 <= 0.0 )
{
if ( *p_m_xVelocityRelated2 >= 0.0 )
{
v69 = 0.1;
goto LABEL_256;
}
goto LABEL_252;
}
goto LABEL_248;
}
}
else
{
if ( m_holdingLeft )
goto LABEL_255;
if ( v64 <= 0.0 )
{
LABEL_248:
if ( v64 <= v68 )
{
if ( v68 >= 0.0 )
{
v69 = 0.1;
LABEL_257:
if ( v64 > v68 && m_holdingRight )
{
if ( !m_holdingLeft )
{
v69 = 0.3;
goto LABEL_272;
}
goto LABEL_268;
}
LABEL_259:
if ( v68 >= 0.0 || v64 >= v68 )
{
if ( m_holdingLeft )
goto LABEL_269;
LABEL_264:
if ( !m_holdingRight )
{
if ( !a1->m_platformerMovingLeft && v64 >= v68 )
{
if ( a1->m_platformerMovingRight || v64 > v68 )
goto LABEL_272;
if ( v68 <= 0.0 )
{
if ( v68 >= 0.0 )
{
LABEL_282:
v66 = cocos2d::clampf(*p_m_xVelocityRelated2, -5.0, 5.0);
*p_m_xVelocityRelated2 = v66;
goto LABEL_283;
}
v72 = (float)(a2 * v69) * 0.5;
if ( (float)-v68 <= v72 )
v72 = -v68;
v70 = v68 + v72;
}
else
{
v71 = (float)(a2 * v69) * 0.5;
if ( v68 <= v71 )
v71 = v68;
v70 = v68 - v71;
}
LABEL_281:
*p_m_xVelocityRelated2 = v70;
goto LABEL_282;
}
LABEL_269:
v70 = v68 - (float)(a2 * v69);
goto LABEL_281;
}
LABEL_272:
v70 = v68 + (float)(a2 * v69);
goto LABEL_281;
}
if ( !m_holdingLeft )
goto LABEL_264;
LABEL_268:
v69 = 0.3;
goto LABEL_269;
}
LABEL_252:
v69 = 0.1;
if ( v64 < v68 )
v69 = 0.2;
LABEL_256:
v68 = *p_m_xVelocityRelated2;
if ( *p_m_xVelocityRelated2 <= 0.0 )
goto LABEL_259;
goto LABEL_257;
}
LABEL_255:
v69 = 0.2;
goto LABEL_256;
}
}
if ( *p_m_xVelocityRelated2 < 0.0 && m_holdingRight )
goto LABEL_255;
goto LABEL_247;
}
v66 = v64;
LABEL_283:
v73 = (float)((float)((float)((float)(v66 * a2) * (float)PlayerObject::flipMod(a1)) * v65) * 2.8);
if ( a1->m_isOnSlope )
{
m_slopeRotation = a1->m_slopeRotation;
v73 = v73 / cosf(m_slopeRotation);
}
v75 = a1->setRotation;
v76 = COERCE_FLOAT(((int (__fastcall *)(PlayerObject *))a1->getRotation)(a1)) + v73;
((void (__fastcall *)(PlayerObject *, _DWORD))v75)(a1, LODWORD(v76));
LABEL_286:
if ( !a1->m_isOnIce )
{
v77 = *p_m_platformerXVelocity;
a1->m_xVelocityRelated2 = v77;
}
}