//
// PlayerObject::toggleSwingMode from 0x10022a2b8 to 0x10022a4e0 (552 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::switchToFlyMode @ 0x1001e6574
// > PlayerObject::switchedToMode @ 0x100227124
// > PlayerObject::copyAttributes @ 0x10022d34c
// > MenuGameLayer::resetPlayer @ 0x10039b300
//
// 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)
{
_BOOL4 v4; // w20
GameManager *v6; // x0
__n128 v7; // q0
if ( a1->m_isSwing == a2 )
return;
v4 = a2;
a1->m_gameModeChangedTime = a1->m_totalTime;
a1->m_isSwing = a2;
if ( a2 )
PlayerObject::switchedToMode(a1, SwingPortal);
*(_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 *, float))a1->setRotation)(a1, 0.0);
a1->m_isOnGround2 = 0;
a1->m_isOnGround = 0;
a1->m_shouldTryPlacingCheckpoint = 0;
PlayerObject::removePendingCheckpoint(a1);
if ( a1->m_isSwing )
{
v6 = GameManager::sharedState();
PlayerObject::updatePlayerSwingFrame(a1, v6->m_playerSwing.random - v6->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);
PlayerFireBoostSprite::loopFireAnimation(a1->m_swingFireMiddle);
((void (__fastcall *)(PlayerFireBoostSprite *, float))a1->m_swingFireBottom->setScale)(a1->m_swingFireBottom, 0.01);
((void (__fastcall *)(PlayerFireBoostSprite *, float))a1->m_swingFireTop->setScale)(a1->m_swingFireTop, 0.01);
((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 ( !v4 )
return;
LABEL_16:
PlayerObject::updatePlayerArt(a1);
PlayerObject::updateDashArt(a1);
return;
}
PlayerObject::resetPlayerIcon(a1);
PlayerObject::updatePlayerFrame(a1, a1->m_maybeSavedPlayerFrame);
v7.n128_u32[0] = 1127481344;
if ( !a1->m_isUpsideDown )
v7.n128_f32[0] = 0.0;
((void (__fastcall *)(PlayerObject *, __n128))a1->setRotation)(a1, v7);
PlayerObject::disableSwingFire(a1);
if ( v4 )
goto LABEL_16;
}