//
// PlayerObject::update from 0x1002196c8 to 0x10021a3f0 (3368 bytes)
//
// 1 xrefs:
// > ??> @ 0x1007c3be0
//
// 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 PlayerObject::update(PlayerObject *a1, float a2)
{
cocos2d::ccColor3B *p_m_flashMainColor; // x24
double m_flashTime; // d0
double v6; // d8
double m_flashDuration; // d0
float v8; // s0
float v9; // s0
const cocos2d::ccColor3B *p_m_originalSecondColor; // x1
double m_yVelocity; // d1
double v12; // d0
double m_platformerXVelocity; // d1
double v14; // d0
const cocos2d::CCPoint *LastPosition; // x20
const cocos2d::CCPoint *v16; // x0
float v17; // s0
double *v18; // x0
float v19; // s10
bool m_isShip; // w8
float m_vehicleSize; // s2
float v22; // s0
float v23; // s1
float v24; // s2
float v25; // s2
double v26; // d3
double v27; // d4
_BOOL4 m_isUpsideDown; // w9
_BOOL4 v29; // w10
float v30; // s1
float v31; // s0
int v32; // w9
float v33; // s1
double v34; // d11
double v35; // d9
double v36; // d1
int v37; // w8
double v38; // d0
double v39; // d9
double v40; // d0
double m_dashX; // d2
double v42; // d1
double m_dashY; // d3
float v44; // s2
double v45; // d2
double v46; // d1
double v47; // d10
double v48; // d11
float32x2_t *v49; // x20
__n128 v50; // q0
__n128 v51; // q1
double v52; // d0
double m_maybeReverseSpeed; // d0
double v54; // d1
double v55; // d2
GameManager *v56; // x0
GameManager *v57; // x0
cocos2d::CCDelayTime *v58; // x20
char v59; // w0
__int64 v60; // x1
__int64 v61; // x2
__int64 v62; // x3
__int64 v63; // x4
__int64 v64; // x5
__int64 v65; // x6
__int64 v66; // x7
cocos2d::CCSequence *v67; // x20
double v68; // d0
HardStreak *m_waveTrail; // x20
cocos2d::CCDirector *v70; // x0
float v71; // s9
HardStreak *v72; // x20
float x; // s10
GameManager *v74; // x0
GameManager *v75; // x0
PlayerFireBoostSprite *m_robotFire; // x0
double m_accelerationOrSpeed; // d0
cocos2d::CCScaleTo *v78; // x20
char v79; // w21
__int64 v80; // x1
__int64 v81; // x2
__int64 v82; // x3
__int64 v83; // x4
__int64 v84; // x5
__int64 v85; // x6
__int64 v86; // x7
cocos2d::CCSequence *v87; // x0
cocos2d::CCScaleTo *v88; // x20
char v89; // w0
__int64 v90; // x1
__int64 v91; // x2
__int64 v92; // x3
__int64 v93; // x4
__int64 v94; // x5
__int64 v95; // x6
__int64 v96; // x7
cocos2d::CCSequence *v97; // x20
double v98; // d0
GhostTrailEffect *m_ghostTrail; // x20
__n128 v100; // q0
__n128 v101; // q1
GhostTrailEffect *v102; // x20
cocos2d::CCPoint *p_m_position; // x0
float32x2_t *v104; // x1
cocos2d::CCParticleSystemQuad *m_swingBurstParticles1; // x20
float v106; // s0
float v107; // s1
cocos2d::CCParticleSystemQuad *m_swingBurstParticles2; // x20
float v109; // s0
float v110; // s1
cocos2d::CCMotionStreak *m_shipStreak; // x20
cocos2d::CCTextureCache *v112; // x21
float m_totalTime; // s0
const char *v114; // x1
cocos2d::CCTexture2D *v115; // x0
DashRingObject *m_dashRing; // x8
float m_maxDuration; // s0
void *__p[2]; // [xsp+30h] [xbp-80h] BYREF
char v119; // [xsp+47h] [xbp-69h]
float32x2_t v120; // [xsp+48h] [xbp-68h] BYREF
cocos2d::SEL_CallFunc v121; // 0:x1.16
p_m_flashMainColor = &a1->m_flashMainColor;
m_flashTime = a1->m_flashTime;
if ( m_flashTime >= 0.0 )
{
v6 = a1->m_totalTime - m_flashTime - a1->m_flashDelay;
m_flashDuration = a1->m_flashDuration;
if ( v6 >= m_flashDuration )
{
a1->m_flashTime = -1.0;
((void (__fastcall *)(PlayerObject *, cocos2d::ccColor3B *))a1->setColor)(a1, &a1->m_originalMainColor);
p_m_originalSecondColor = &a1->m_originalSecondColor;
goto LABEL_6;
}
if ( v6 > 0.0 )
{
v8 = v6 / m_flashDuration;
*(cocos2d::ccColor3B *)__p = GameToolbox::multipliedColorValue(
(cocos2d::ccColor3B)(*(unsigned __int16 *)&a1->m_flashMainColor.r
| (a1->m_flashMainColor.b << 16)),
(cocos2d::ccColor3B)(*(unsigned __int16 *)&a1->m_originalMainColor.r
| (a1->m_originalMainColor.b << 16)),
v8);
((void (__fastcall *)(PlayerObject *, void **))a1->setColor)(a1, __p);
v9 = v6 / a1->m_flashDuration;
*(cocos2d::ccColor3B *)__p = GameToolbox::multipliedColorValue(
(cocos2d::ccColor3B)(*(unsigned __int16 *)&p_m_flashMainColor[1].r
| (p_m_flashMainColor[1].b << 16)),
(cocos2d::ccColor3B)(*(unsigned __int16 *)&p_m_flashMainColor[111].r
| (p_m_flashMainColor[111].b << 16)),
v9);
p_m_originalSecondColor = (const cocos2d::ccColor3B *)__p;
LABEL_6:
PlayerObject::setSecondColor(a1, p_m_originalSecondColor);
}
}
m_yVelocity = a1->m_yVelocity;
v12 = 1000.0;
if ( m_yVelocity > 1000.0 || (v12 = -1000.0, m_yVelocity < -1000.0) )
a1->m_yVelocity = v12;
if ( a1->m_isPlatformer )
{
m_platformerXVelocity = a1->m_platformerXVelocity;
v14 = 1000.0;
if ( m_platformerXVelocity > 1000.0 || (v14 = -1000.0, m_platformerXVelocity < -1000.0) )
a1->m_platformerXVelocity = v14;
}
if ( !a1->m_isDead )
{
LastPosition = GameObject::getLastPosition(a1);
v16 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1);
v17 = cocos2d::ccpDistance(LastPosition, v16);
v18 = (double *)((__int64 (__fastcall *)(PlayerObject *, float))a1->getPosition)(a1, v17);
sub_1000229D0(&a1->m_lastPosition, v18);
a1->m_yVelocityRelated3 = 0.0;
if ( a1->m_isLocked )
goto LABEL_104;
v19 = a2 * 0.9;
PlayerObject::updateJump(a1, a2 * 0.9);
if ( a1->m_stateForce < 1 )
{
LABEL_66:
if ( a1->m_isDashing )
{
a1->m_yVelocity = 0.0;
v34 = 0.0;
}
else
{
v34 = a1->m_yVelocity;
}
v35 = a2;
if ( a1->m_isPlatformer && (PlayerObject::updateMove(a1, v19), a1->m_isPlatformer) )
{
v36 = a1->m_platformerXVelocity;
v37 = 1;
}
else
{
v37 = 0;
v36 = a1->m_speedMultiplier * a1->m_playerSpeed;
}
v38 = v19;
v39 = v36 * v35;
if ( a1->m_isDart )
{
if ( !a1->m_isDashing )
{
v40 = fabs(v39);
if ( a1->m_isUpsideDown )
v40 = -v40;
if ( !a1->m_jumpBuffered )
v40 = -v40;
if ( a1->m_vehicleSize != 1.0 )
v40 = v40 + v40;
goto LABEL_87;
}
}
else if ( !a1->m_isDashing )
{
v40 = v34 * v38;
goto LABEL_87;
}
if ( v37 )
{
m_dashX = a1->m_dashX;
v42 = m_dashX * v38;
m_dashY = a1->m_dashY;
v40 = m_dashY * v38;
a1->m_platformerXVelocity = m_dashX;
a1->m_yVelocity = m_dashY;
LABEL_88:
v44 = v40;
a1->m_yVelocityRelated3 = v44;
v45 = -v42;
if ( v37 )
v45 = v42;
if ( a1->m_isGoingLeft )
v42 = v45;
v46 = a1->m_maybeReverseAcceleration + v42;
if ( a1->m_isSideways )
v47 = v40;
else
v47 = v46;
if ( a1->m_isSideways )
v48 = v46;
else
v48 = v40;
v49 = (float32x2_t *)((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1);
v50.n128_f32[0] = v47;
v51.n128_f32[0] = v48;
sub_100022980(v50, v51, &v120);
*(float32x2_t *)&v52 = sub_1000229DC(v49, &v120, (float32x2_t *)__p);
((void (__fastcall *)(PlayerObject *, void **, double))a1->setPosition)(a1, __p, v52);
a1->m_maybeReverseAcceleration = 0.0;
m_maybeReverseSpeed = a1->m_maybeReverseSpeed;
if ( m_maybeReverseSpeed != 0.0 )
{
v54 = v39 * 0.0199999996;
v55 = fabs(m_maybeReverseSpeed);
if ( v55 < v39 * 0.0199999996 )
v54 = v55;
if ( m_maybeReverseSpeed <= 0.0 )
v54 = -v54;
a1->m_maybeReverseAcceleration = v54;
a1->m_maybeReverseSpeed = m_maybeReverseSpeed - v54;
}
LABEL_104:
if ( a1->m_isShip )
{
if ( !a1->m_jumpBuffered
|| a1->m_playEffects && (v56 = GameManager::sharedState(), GJBaseGameLayer::isFlipping(v56->m_playLayer))
|| a1->m_isHidden )
{
if ( a1->m_hasShipParticles )
cocos2d::CCParticleSystem::stopSystem(a1->m_shipClickParticles);
a1->m_hasShipParticles = 0;
}
else
{
if ( !a1->m_hasShipParticles )
cocos2d::CCParticleSystem::resumeSystem(a1->m_shipClickParticles);
a1->m_hasShipParticles = 1;
}
}
else if ( !a1->m_isBird && !a1->m_isDart && !a1->m_isSwing )
{
if ( !a1->m_isOnGround2
|| a1->m_playEffects && (v57 = GameManager::sharedState(), GJBaseGameLayer::isFlipping(v57->m_playLayer))
|| a1->m_isLocked
|| a1->m_isHidden
|| a1->m_isPlatformer && fabs(a1->m_platformerXVelocity) <= 2.5 )
{
if ( a1->m_hasGroundParticles && !cocos2d::CCNode::getActionByTag(a1, 3) )
{
v58 = cocos2d::CCDelayTime::create(0.06);
v121.ptr = (void (*)(void))PlayerObject::deactivateParticle;
v121.adj = 0;
v59 = (unsigned __int8)cocos2d::CCCallFunc::create(a1, v121);
v67 = sub_10018A494(v58, v60, v61, v62, v63, v64, v65, v66, v59);
((void (__fastcall *)(cocos2d::CCSequence *, __int64))v67->setTag)(v67, 3);
cocos2d::CCNode::runAction(a1, v67);
}
}
else
{
if ( !a1->m_hasGroundParticles )
cocos2d::CCParticleSystem::resumeSystem(a1->m_playerGroundParticles);
a1->m_hasGroundParticles = 1;
cocos2d::CCNode::stopActionByTag(a1, 3);
}
goto LABEL_135;
}
if ( a1->m_isDart || !a1->m_isOnGround2 )
goto LABEL_134;
v68 = a1->m_yVelocity;
if ( a1->m_isUpsideDown )
{
if ( v68 >= 1.0 )
goto LABEL_134;
}
else if ( v68 <= -1.0 )
{
LABEL_134:
cocos2d::CCParticleSystem::stopSystem(a1->m_vehicleGroundParticles);
goto LABEL_135;
}
if ( a1->m_isLocked
|| a1->m_isHidden
|| a1->m_isPlatformer
&& !a1->m_holdingLeft
&& !a1->m_holdingRight
&& !a1->m_platformerMovingLeft
&& !a1->m_platformerMovingRight )
{
goto LABEL_134;
}
cocos2d::CCParticleSystem::resumeSystem(a1->m_vehicleGroundParticles);
LABEL_135:
m_waveTrail = a1->m_waveTrail;
m_waveTrail->m_pulseSize = (float)((float)(a1->m_audioScale + -0.1) * 2.1) + 0.4;
if ( a1->m_playEffects )
{
if ( a1->m_isGoingLeft )
{
v70 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v70);
v71 = *(float *)__p;
v72 = a1->m_waveTrail;
x = GameManager::sharedState()->m_playLayer->m_gameState.m_cameraPosition2.x;
v74 = GameManager::sharedState();
HardStreak::clearAboveXPos(v72, x + (float)(v71 / v74->m_playLayer->m_gameState.m_cameraZoom));
}
else
{
v75 = GameManager::sharedState();
HardStreak::clearBehindXPos(m_waveTrail, v75->m_playLayer->m_gameState.m_cameraPosition2.x);
}
}
m_robotFire = a1->m_robotFire;
if ( m_robotFire )
{
if ( a1->m_isRobot
&& a1->m_jumpBuffered
&& !a1->m_touchedPad
&& a1->m_maybeIsBoosted
&& (m_accelerationOrSpeed = a1->m_accelerationOrSpeed, m_accelerationOrSpeed > 0.270000011)
&& m_accelerationOrSpeed < 1.5 )
{
if ( (((__int64 (__fastcall *)(PlayerFireBoostSprite *))m_robotFire->isVisible)(m_robotFire) & 1) == 0 )
{
cocos2d::CCNode::stopAllActions(a1->m_robotFire);
((void (__fastcall *)(PlayerFireBoostSprite *, float))a1->m_robotFire->setScale)(a1->m_robotFire, 0.1);
((void (__fastcall *)(PlayerFireBoostSprite *, __int64))a1->m_robotFire->setVisible)(a1->m_robotFire, 1);
v78 = cocos2d::CCScaleTo::create(0.05, 1.44, 0.9);
v79 = (unsigned __int8)cocos2d::CCScaleTo::create(0.05, 0.72, 1.35);
cocos2d::CCScaleTo::create(0.05, 1.8, 0.9);
cocos2d::CCScaleTo::create(0.05, 0.9, 1.35);
cocos2d::CCScaleTo::create(0.05, 1.8, 0.9);
v87 = sub_10018A494(v78, v80, v81, v82, v83, v84, v85, v86, v79);
cocos2d::CCNode::runAction(a1->m_robotFire, v87);
cocos2d::CCParticleSystem::resumeSystem(a1->m_robotBurstParticles);
}
}
else if ( ((unsigned int (__fastcall *)(PlayerFireBoostSprite *))m_robotFire->isVisible)(m_robotFire)
&& !cocos2d::CCNode::getActionByTag(a1->m_robotFire, 9) )
{
cocos2d::CCNode::stopAllActions(a1->m_robotFire);
v88 = cocos2d::CCScaleTo::create(0.15, 0.05, 0.1);
v89 = (unsigned __int8)cocos2d::CCHide::create();
v97 = sub_10018A494(v88, v90, v91, v92, v93, v94, v95, v96, v89);
((void (__fastcall *)(cocos2d::CCSequence *, __int64))v97->setTag)(v97, 9);
cocos2d::CCNode::runAction(a1->m_robotFire, v97);
cocos2d::CCParticleSystem::stopSystem(a1->m_robotBurstParticles);
}
}
if ( a1->m_isRobot
&& a1->m_jumpBuffered
&& !a1->m_touchedPad
&& a1->m_maybeIsBoosted
&& (v98 = a1->m_accelerationOrSpeed, v98 > 0.100000001)
&& v98 < 1.5
&& !a1->m_isHidden )
{
if ( (((__int64 (__fastcall *)(cocos2d::CCParticleSystemQuad *))a1->m_robotBurstParticles->isActive)(a1->m_robotBurstParticles)
& 1) == 0 )
cocos2d::CCParticleSystem::resumeSystem(a1->m_robotBurstParticles);
}
else if ( ((unsigned int (__fastcall *)(cocos2d::CCParticleSystemQuad *))a1->m_robotBurstParticles->isActive)(a1->m_robotBurstParticles) )
{
cocos2d::CCParticleSystem::stopSystem(a1->m_robotBurstParticles);
}
a1->m_maybeSpriteRelated = 0;
m_ghostTrail = a1->m_ghostTrail;
if ( !m_ghostTrail )
goto LABEL_168;
if ( a1->m_isRobot )
{
v100.n128_u32[0] = *(_DWORD *)(((__int64 (__fastcall *)(CCSpritePart *))a1->m_robotSprite->m_headSprite->getPosition)(a1->m_robotSprite->m_headSprite)
+ 4);
v101.n128_u32[0] = 7.0;
}
else
{
if ( !a1->m_isSpider )
{
sub_1000229B8((__int64 *)__p, (__int64 *)&stru_10086CBF0);
p_m_position = &m_ghostTrail->m_position;
v104 = (float32x2_t *)__p;
goto LABEL_167;
}
v100.n128_u32[0] = *(_DWORD *)(((__int64 (__fastcall *)(CCSpritePart *))a1->m_spiderSprite->m_headSprite->getPosition)(a1->m_spiderSprite->m_headSprite)
+ 4);
v101.n128_u32[0] = 2.0;
}
v101.n128_f32[0] = v101.n128_f32[0] + (float)(v100.n128_f32[0] * 0.4);
v100.n128_u32[0] = 0;
sub_100022980(v100, v101, __p);
v102 = a1->m_ghostTrail;
sub_1000229B8((__int64 *)&v120, (__int64 *)__p);
p_m_position = &v102->m_position;
v104 = &v120;
LABEL_167:
sub_1000229D0(p_m_position, (double *)v104);
LABEL_168:
if ( a1->m_isDashing )
PlayerObject::updateDashAnimation(a1);
if ( a1->m_isSwing )
{
m_swingBurstParticles1 = a1->m_swingBurstParticles1;
v106 = (float)(45.0 - ((float (__fastcall *)(PlayerObject *))a1->getRotation)(a1)) + -180.0;
v107 = 90.0;
if ( !a1->m_isGoingLeft )
v107 = 0.0;
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, float))m_swingBurstParticles1->setAngle)(
m_swingBurstParticles1,
v106 + v107);
m_swingBurstParticles2 = a1->m_swingBurstParticles2;
v109 = (float)(-45.0 - ((float (__fastcall *)(PlayerObject *))a1->getRotation)(a1)) + -180.0;
v110 = -90.0;
if ( !a1->m_isGoingLeft )
v110 = 0.0;
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, float))m_swingBurstParticles2->setAngle)(
m_swingBurstParticles2,
v109 + v110);
}
*(_WORD *)&a1->m_stateJumpBuffered = *(_WORD *)&a1->m_jumpBuffered;
*(_DWORD *)&p_m_flashMainColor[115].b = 0;
PlayerObject::updateStateVariables(a1);
m_shipStreak = a1->m_shipStreak;
if ( m_shipStreak )
{
v112 = cocos2d::CCTextureCache::sharedTextureCache();
m_totalTime = a1->m_totalTime;
sub_10021717C((unsigned int)a1->m_shipStreakType, __p, m_totalTime);
v114 = v119 >= 0 ? (const char *)__p : (const char *)__p[0];
v115 = cocos2d::CCTextureCache::addImage(v112, v114, 0);
((void (__fastcall *)(cocos2d::CCMotionStreak *, cocos2d::CCTexture2D *))m_shipStreak->setTexture)(
m_shipStreak,
v115);
if ( v119 < 0 )
operator delete(__p[0]);
}
if ( a1->m_isPlatformer && a1->m_isDashing )
{
m_dashRing = a1->m_dashRing;
if ( m_dashRing )
{
m_maxDuration = m_dashRing->m_maxDuration;
if ( m_maxDuration > 0.0 && a1->m_totalTime - a1->m_dashStartTime > m_maxDuration )
{
PlayerObject::stopDashing(a1);
a1->m_jumpBuffered = 0;
}
}
}
return;
}
v40 = v39 * a1->m_dashY;
LABEL_87:
v42 = v39;
goto LABEL_88;
}
m_isShip = a1->m_isShip;
if ( m_isShip )
{
m_vehicleSize = a1->m_vehicleSize;
v22 = 1.0;
if ( m_vehicleSize != 1.0 )
{
v23 = 0.5875;
LABEL_37:
v22 = m_vehicleSize;
goto LABEL_38;
}
v23 = 0.47;
}
else
{
if ( !a1->m_isBird )
{
if ( a1->m_isSwing )
{
v24 = 0.4;
}
else
{
v24 = 0.6;
if ( !a1->m_isBall && !a1->m_isSpider )
{
if ( a1->m_isRobot )
v24 = 0.9;
else
v24 = 1.0;
}
}
v22 = a1->m_vehicleSize;
if ( v22 == 1.0 )
{
v23 = v24;
}
else
{
v23 = 0.61538;
if ( !a1->m_isSwing )
v23 = v24;
}
goto LABEL_38;
}
m_vehicleSize = a1->m_vehicleSize;
v22 = 1.0;
if ( m_vehicleSize != 1.0 )
{
v23 = 0.725;
goto LABEL_37;
}
v23 = 0.58;
}
LABEL_38:
v25 = v23 * (float)(v19 * a1->m_stateForceVector.y);
v26 = a1->m_yVelocity + v25;
v27 = (double)(int)v26;
if ( v26 != v27 )
v26 = round((v26 - v27) * 1000.0) / 1000.0 + v27;
a1->m_yVelocity = v26;
if ( v25 != 0.0 )
a1->m_isAccelerating = 1;
m_isUpsideDown = a1->m_isUpsideDown;
v29 = v25 > 0.0;
if ( a1->m_isUpsideDown )
v29 = v25 < 0.0;
if ( v29 )
a1->m_accelerationOrSpeed = a1->m_accelerationOrSpeed + v25 / 12.9399996 * 1.5;
if ( a1->m_isPlatformer )
{
v30 = a1->m_stateForceVector.x;
a1->m_platformerXVelocity = a1->m_platformerXVelocity + (float)(v19 * v30);
if ( v30 != 0.0 )
a1->m_affectedByForces = 1;
if ( !m_isShip
&& !a1->m_isBird
&& !a1->m_isDart
&& !a1->m_isSwing
&& !a1->m_isBall
&& !a1->m_isRobot
&& !a1->m_isSpider
&& fabsf(v30) > 0.1
&& !a1->m_isRotating )
{
v31 = flt_10063A7F0[v22 == 1.0];
if ( m_isUpsideDown )
v32 = -180;
else
v32 = 180;
if ( a1->m_isGoingLeft )
v32 = -v32;
v33 = (float)v32;
if ( a1->m_isSideways )
v33 = -(float)v32;
a1->m_rotationSpeed = (float)(a1->m_gravityMod * v33) / v31;
a1->m_isRotating = 1;
}
}
goto LABEL_66;
}
}