//
// PlayerObject::toggleSwingMode from 0x100417450 to 0x100417889 (1081 bytes)
//
// 12 xrefs:
// > GJBaseGameLayer::setupLevelStart @ 0x100123e6f
// > GJBaseGameLayer::setupLevelStart @ 0x100123f64
// > GJBaseGameLayer::switchToFlyMode @ 0x10012441d
// > PlayerObject::switchedToMode @ 0x100412d44
// > PlayerObject::toggleFlyMode @ 0x100416353
// > PlayerObject::toggleBirdMode @ 0x100416e56
// > PlayerObject::toggleDartMode @ 0x100417f63
// > PlayerObject::toggleRollMode @ 0x100418593
// > PlayerObject::toggleRobotMode @ 0x100418a6c
// > PlayerObject::toggleSpiderMode @ 0x100418ee4
// > PlayerObject::copyAttributes @ 0x10041b690
// > MenuGameLayer::resetPlayer @ 0x1004fab03
//
// 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::toggleSwingMode(PlayerObject *a1, bool a2, bool a3)
{
int m_maybeSavedPlayerFrame; // esi
__int64 v7; // xmm0_8
CheckpointObject *m_pendingCheckpoint; // rdi
GameObject *Object; // r12
GameManager *v10; // rax
PlayerFireBoostSprite *m_swingFireMiddle; // r15
cocos2d::CCScaleTo *v12; // r12
cocos2d::CCScaleTo *v13; // rax
cocos2d::CCSequence *v14; // rax
cocos2d::CCRepeatForever *v15; // rsi
__int64 v16; // xmm0_8
if ( a1->m_isSwing == a2 )
return;
a1->m_gameModeChangedTime = a1->m_totalTime;
a1->m_isSwing = a2;
if ( a2 )
{
PlayerObject::toggleFlyMode(a1, 0, 0);
PlayerObject::toggleBirdMode(a1, 0, 0);
if ( a1->m_isBall )
{
a1->m_gameModeChangedTime = a1->m_totalTime;
a1->m_isBall = 0;
if ( a1->m_vehicleSize == 1.0 || (m_maybeSavedPlayerFrame = 0, !a1->m_defaultMiniIcon) )
m_maybeSavedPlayerFrame = a1->m_maybeSavedPlayerFrame;
PlayerObject::updatePlayerFrame(a1, m_maybeSavedPlayerFrame);
if ( a1->m_isUpsideDown )
v7 = 1127481344;
else
v7 = 0;
((void (__fastcall *)(PlayerObject *, double))a1->setRotation)(a1, *(double *)&v7);
*(_WORD *)&a1->m_isRotating = 0;
a1->m_isBallRotating = 0;
a1->m_rotationSpeed = 0.0;
}
PlayerObject::toggleDartMode(a1, 0, 0);
PlayerObject::toggleRobotMode(a1, 0, 0);
PlayerObject::toggleSpiderMode(a1, 0, 0);
}
*(_WORD *)&a1->m_isRotating = 0;
a1->m_isBallRotating = 0;
a1->m_rotationSpeed = 0.0;
a1->m_yVelocity = a1->m_yVelocity * 0.5;
((void (__fastcall *)(PlayerObject *, double))a1->setRotation)(a1, 0.0);
a1->m_isOnGround2 = 0;
a1->m_isOnGround = 0;
a1->m_shouldTryPlacingCheckpoint = 0;
m_pendingCheckpoint = a1->m_pendingCheckpoint;
if ( m_pendingCheckpoint )
{
Object = CheckpointObject::getObject(m_pendingCheckpoint);
GameObject::removeGlow(Object);
((void (__fastcall *)(GameObject *))Object->removeMeAndCleanup)(Object);
cocos2d::CCObject::release(a1->m_pendingCheckpoint);
a1->m_pendingCheckpoint = nullptr;
}
if ( !a1->m_isSwing )
{
PlayerObject::resetPlayerIcon(a1);
PlayerObject::updatePlayerFrame(a1, a1->m_maybeSavedPlayerFrame);
if ( a1->m_isUpsideDown )
v16 = 1127481344;
else
v16 = 0;
((void (__fastcall *)(PlayerObject *, double))a1->setRotation)(a1, *(double *)&v16);
((void (__fastcall *)(PlayerFireBoostSprite *, _QWORD))a1->m_swingFireMiddle->setVisible)(a1->m_swingFireMiddle, 0);
cocos2d::CCNode::stopAllActions(a1->m_swingFireMiddle);
((void (__fastcall *)(PlayerFireBoostSprite *, _QWORD))a1->m_swingFireBottom->setVisible)(a1->m_swingFireBottom, 0);
cocos2d::CCNode::stopAllActions(a1->m_swingFireBottom);
((void (__fastcall *)(PlayerFireBoostSprite *, _QWORD))a1->m_swingFireTop->setVisible)(a1->m_swingFireTop, 0);
cocos2d::CCNode::stopAllActions(a1->m_swingFireTop);
cocos2d::CCParticleSystem::stopSystem(a1->m_swingBurstParticles1);
cocos2d::CCParticleSystem::stopSystem(a1->m_swingBurstParticles2);
if ( !a2 )
return;
LABEL_27:
PlayerObject::updatePlayerArt(a1);
PlayerObject::updateDashArt(a1);
return;
}
v10 = GameManager::sharedState();
PlayerObject::updatePlayerSwingFrame(a1, v10->m_playerSwing.random - v10->m_playerSwing.seed);
if ( !a3 )
PlayerObject::spawnPortalCircle(a1, (cocos2d::ccColor3B)51455, 50.0);
if ( !a1->m_isHidden )
{
cocos2d::CCParticleSystem::resetSystem(a1->m_trailingParticles);
cocos2d::CCParticleSystem::resetSystem(a1->m_shipClickParticles);
}
cocos2d::CCParticleSystem::stopSystem(a1->m_shipClickParticles);
a1->m_hasShipParticles = 0;
if ( a1->m_hasGroundParticles )
cocos2d::CCParticleSystem::stopSystem(a1->m_playerGroundParticles);
a1->m_hasGroundParticles = 0;
PlayerObject::activateStreak(a1);
((void (__fastcall *)(PlayerFireBoostSprite *, __int64))a1->m_swingFireMiddle->setVisible)(a1->m_swingFireMiddle, 1);
m_swingFireMiddle = a1->m_swingFireMiddle;
cocos2d::CCNode::stopAllActions(m_swingFireMiddle);
v12 = cocos2d::CCScaleTo::create(0.059999999, 1.2 * m_swingFireMiddle->m_size, m_swingFireMiddle->m_size);
v13 = cocos2d::CCScaleTo::create(0.059999999, 0.60000002 * m_swingFireMiddle->m_size, m_swingFireMiddle->m_size * 1.5);
v14 = sub_1003B5760(v12, v13, 0);
v15 = cocos2d::CCRepeatForever::create(v14);
cocos2d::CCNode::runAction(m_swingFireMiddle, v15);
((void (__fastcall *)(PlayerFireBoostSprite *, float))a1->m_swingFireBottom->setScale)(
a1->m_swingFireBottom,
0.0099999998);
((void (__fastcall *)(PlayerFireBoostSprite *, float))a1->m_swingFireTop->setScale)(a1->m_swingFireTop, 0.0099999998);
((void (__fastcall *)(PlayerFireBoostSprite *, __int64))a1->m_swingFireBottom->setVisible)(a1->m_swingFireBottom, 1);
((void (__fastcall *)(PlayerFireBoostSprite *, __int64))a1->m_swingFireTop->setVisible)(a1->m_swingFireTop, 1);
cocos2d::CCParticleSystem::resetSystem(a1->m_swingBurstParticles1);
cocos2d::CCParticleSystem::resetSystem(a1->m_swingBurstParticles2);
cocos2d::CCParticleSystem::stopSystem(a1->m_swingBurstParticles1);
cocos2d::CCParticleSystem::stopSystem(a1->m_swingBurstParticles2);
PlayerObject::updateSwingFire(a1);
if ( a2 )
goto LABEL_27;
}