//
// PlayerObject::toggleFlyMode from 0x759958 to 0x759c10 (696 bytes)
//
// 5 xrefs:
// > PlayerObject::switchedToMode @ 0x75951c
// > PlayerObject::copyAttributes @ 0x75d430
// > MenuGameLayer::resetPlayer @ 0x7da44c
// > GJBaseGameLayer::switchToFlyMode @ 0x99dca8
// > ??> @ 0x8d3e8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:52:59 +0000
//
__int64 __fastcall PlayerObject::toggleFlyMode(PlayerObject *this, unsigned __int8 a2, unsigned __int8 a3)
{
int v3; // w21
int v4; // w22
__int64 v6; // x1
__int64 v7; // x1
GameManager *v8; // x0
__int64 v9; // x0
__int64 v10; // x24
void (__fastcall *v11)(__int64, __int64 *); // x25
__int64 *v12; // x24
float v13; // s1
__int64 v14; // x1
void (__fastcall *v15)(__int64 *, __int64 *); // x25
__int64 v16; // x0
__int64 v18; // x0
__int64 v19; // x24
void (__fastcall *v20)(__int64, __int64 *); // x25
__int64 v21; // [xsp+50h] [xbp+50h] BYREF
v3 = a2;
v4 = a3;
if ( *((unsigned __int8 *)this + 2417) != a2 )
{
v6 = *((_QWORD *)this + 328);
*((_BYTE *)this + 2417) = v3;
*((_QWORD *)this + 245) = v6;
if ( v3 )
PlayerObject::switchedToMode(this, 5);
PlayerObject::stopRotation(this);
v7 = *(_QWORD *)this;
*((double *)this + 299) = *((double *)this + 299) * 0.5;
(*(void (__fastcall **)(PlayerObject *, float))(v7 + 360))(this, 0.0);
*((_BYTE *)this + 2500) = 0;
*((_BYTE *)this + 2425) = 0;
*((_BYTE *)this + 1971) = 0;
PlayerObject::removePendingCheckpoint((__int64)this);
if ( *((_BYTE *)this + 2417) )
{
PlayerObject::stopPlatformerJumpAnimation(this);
v8 = (GameManager *)*((unsigned __int8 *)this + 2832);
if ( *((_BYTE *)this + 2832) )
{
v18 = GameManager::sharedState(v8);
PlayerObject::updatePlayerJetpackFrame(this, *(_DWORD *)(v18 + 884) - *(_DWORD *)(v18 + 888));
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 225) + 160LL))(*((_QWORD *)this + 225), 0.6);
v19 = *((_QWORD *)this + 225);
v20 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v19 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v21, 6.0, 4.0);
v20(v19, &v21);
v12 = *((__int64 **)this + 229);
v14 = *v12;
v13 = 0.0;
}
else
{
v9 = GameManager::sharedState(v8);
PlayerObject::updatePlayerShipFrame(this, *(_DWORD *)(v9 + 728) - *(_DWORD *)(v9 + 732));
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 225) + 160LL))(*((_QWORD *)this + 225), 0.55);
v10 = *((_QWORD *)this + 225);
v11 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v10 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v21, 0.0, 5.0);
v11(v10, &v21);
v12 = *((__int64 **)this + 229);
v13 = -5.0;
v14 = *v12;
}
v15 = *(void (__fastcall **)(__int64 *, __int64 *))(v14 + 184);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v21, 0.0, v13);
v15(v12, &v21);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 229) + 344LL))(*((_QWORD *)this + 229), 1);
PlayerObject::updatePlayerGlow(this);
if ( !*((_BYTE *)this + 1787) )
{
cocos2d::CCParticleSystem::resetSystem(*((cocos2d::CCParticleSystem **)this + 271));
cocos2d::CCParticleSystem::resetSystem(*((cocos2d::CCParticleSystem **)this + 272));
}
cocos2d::CCParticleSystem::stopSystem(*((cocos2d::CCParticleSystem **)this + 272));
*((_BYTE *)this + 1975) = 0;
PlayerObject::deactivateParticle((cocos2d::CCParticleSystem **)this);
if ( !v4 )
{
LOWORD(v21) = 255;
BYTE2(v21) = -1;
PlayerObject::spawnPortalCircle((__int64)this, v21, 50.0);
}
PlayerObject::activateStreak((cocos2d::CCNode **)this);
PlayerObject::updatePlayerScale((GJActionManager **)this);
v16 = *((_QWORD *)this + 239);
if ( v16 && !*((_BYTE *)this + 2832) && !*((_BYTE *)this + 1787) )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v16 + 344LL))(v16, 1);
}
else
{
PlayerObject::resetPlayerIcon((cocos2d::CCParticleSystem **)this);
}
if ( v3 )
PlayerObject::modeDidChange(this);
}
return _stack_chk_guard;
}