//
// PlayerObject::toggleFlyMode from 0x630f50 to 0x631208 (696 bytes)
//
// 5 xrefs:
// > PlayerObject::switchedToMode @ 0x630a90
// > PlayerObject::copyAttributes @ 0x631d74
// > MenuGameLayer::resetPlayer @ 0x6c941c
// > GJBaseGameLayer::switchToFlyMode @ 0x859ca8
// > ??> @ 0x68310
//
// 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::toggleFlyMode(PlayerObject *a1, bool a2, bool a3)
{
_BOOL4 v3; // w21
_BOOL4 v4; // w22
double m_totalTime; // x1
void (__fastcall *setRotation)(PlayerObject *__hidden, float); // x1
GameManager *v8; // x0
cocos2d::CCSprite *v9; // x24
void (__fastcall *v10)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCSprite *m_vehicleSprite; // x24
float v12; // s1
cocos2d::CCSprite_vtbl *v13; // x1
void (__fastcall *v14)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCMotionStreak *m_shipStreak; // x0
GameManager *v16; // x0
cocos2d::CCSprite *m_iconSprite; // x24
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCPoint v19; // [xsp+50h] [xbp+50h] BYREF
v3 = a2;
v4 = a3;
if ( a1->m_isShip != a2 )
{
m_totalTime = a1->m_totalTime;
a1->m_isShip = v3;
a1->m_gameModeChangedTime = m_totalTime;
if ( v3 )
PlayerObject::switchedToMode(a1, ShipPortal);
PlayerObject::stopRotation(a1, 0, 7);
setRotation = a1->setRotation;
a1->m_yVelocity = a1->m_yVelocity * 0.5;
setRotation(a1, 0.0);
a1->m_isOnGround2 = 0;
a1->m_isOnGround = 0;
a1->m_shouldTryPlacingCheckpoint = 0;
PlayerObject::removePendingCheckpoint(a1);
if ( a1->m_isShip )
{
PlayerObject::stopPlatformerJumpAnimation(a1);
if ( a1->m_isPlatformer )
{
v16 = GameManager::sharedState();
PlayerObject::updatePlayerJetpackFrame(a1, v16->m_playerJetpack.random - v16->m_playerJetpack.seed);
a1->m_iconSprite->setScale(a1->m_iconSprite, 0.6);
m_iconSprite = a1->m_iconSprite;
setPosition = m_iconSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v19, 6.0, 4.0);
setPosition(m_iconSprite, &v19);
m_vehicleSprite = a1->m_vehicleSprite;
v13 = m_vehicleSprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v12 = 0.0;
}
else
{
v8 = GameManager::sharedState();
PlayerObject::updatePlayerShipFrame(a1, v8->m_playerShip.random - v8->m_playerShip.seed);
a1->m_iconSprite->setScale(a1->m_iconSprite, 0.55);
v9 = a1->m_iconSprite;
v10 = v9->setPosition;
cocos2d::CCPoint::CCPoint(&v19, 0.0, 5.0);
v10(v9, &v19);
m_vehicleSprite = a1->m_vehicleSprite;
v12 = -5.0;
v13 = m_vehicleSprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
}
v14 = v13->setPosition;
cocos2d::CCPoint::CCPoint(&v19, 0.0, v12);
v14(m_vehicleSprite, &v19);
a1->m_vehicleSprite->setVisible(a1->m_vehicleSprite, 1);
PlayerObject::updatePlayerGlow(a1);
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;
PlayerObject::deactivateParticle(a1);
if ( !v4 )
{
LOWORD(v19.x) = 255;
BYTE2(v19.x) = -1;
PlayerObject::spawnPortalCircle(a1, *(cocos2d::ccColor3B *)&v19.x, 50.0);
}
PlayerObject::activateStreak(a1);
PlayerObject::updatePlayerScale(a1);
m_shipStreak = a1->m_shipStreak;
if ( m_shipStreak && !a1->m_isPlatformer && !a1->m_isHidden )
m_shipStreak->setVisible(m_shipStreak, 1);
}
else
{
PlayerObject::resetPlayerIcon(a1);
}
if ( v3 )
PlayerObject::modeDidChange(a1);
}
}