//
// PlayerObject::toggleFlyMode from 0x1404f8790 to 0x1404f8ac7 (823 bytes)
//
// 23 xrefs:
// > GJBaseGameLayer::setupLevelStart @ 0x1403195a8
// > GJBaseGameLayer::setupLevelStart @ 0x140319603
// > GJBaseGameLayer::setupLevelStart @ 0x14031962a
// > GJBaseGameLayer::setupLevelStart @ 0x1403196d7
// > GJBaseGameLayer::setupLevelStart @ 0x1403199e6
// > GJBaseGameLayer::setupLevelStart @ 0x140319a93
// > GJBaseGameLayer::setupLevelStart @ 0x140319b35
// > GJBaseGameLayer::setupLevelStart @ 0x140319be2
// > sub_140319F40 @ 0x140319f60
// > sub_14031A030 @ 0x14031a050
// > sub_14031A120 @ 0x14031a140
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c269
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c388
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c549
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c708
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c802
// > MenuGameLayer::resetPlayer @ 0x140471003
// > MenuGameLayer::resetPlayer @ 0x140471471
// > PlayerObject::resetObject @ 0x1404f55e7
// > PlayerObject::switchedToMode @ 0x1404fa169
// > PlayerObject::copyAttributes @ 0x1404feaeb
// > PlayerObject::loadFromCheckpoint @ 0x1405011d5
// > ??> @ 0x14092a254
//
// This function is hookable on this platform (idp: pc, 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 11:33:21 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall PlayerObject::toggleFlyMode(__int64 a1, char a2, char a3)
{
_DWORD *v6; // rax
__int64 v7; // rdi
__int64 v8; // rbx
__int64 v9; // rax
float v10; // xmm2_4
__int64 v11; // rdi
__int64 v12; // rbx
__int64 v13; // rax
__int64 v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rdx
__int64 v18; // rdx
__int64 v19; // rcx
void *v20; // [rsp+40h] [rbp+8h] BYREF
__int16 v21; // [rsp+48h] [rbp+10h]
if ( *(_BYTE *)(a1 + 2497) != a2 )
{
*(_QWORD *)(a1 + 2016) = *(_QWORD *)(a1 + 2728);
*(_BYTE *)(a1 + 2497) = a2;
if ( a2 )
PlayerObject::switchedToMode(a1, 5);
*(_WORD *)(a1 + 1840) = 0;
*(_BYTE *)(a1 + 1648) = 0;
*(_DWORD *)(a1 + 1832) = 0;
*(double *)(a1 + 2472) = *(double *)(a1 + 2472) * 0.5;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 352LL))(a1);
*(_BYTE *)(a1 + 2580) = 0;
*(_BYTE *)(a1 + 2505) = 0;
*(_BYTE *)(a1 + 2027) = 0;
PlayerObject::removePendingCheckpoint(a1);
if ( *(_BYTE *)(a1 + 2497) )
{
PlayerObject::stopPlatformerJumpAnimation(a1);
v6 = (_DWORD *)qword_14090BFD0;
if ( *(_BYTE *)(a1 + 2936) )
{
if ( !qword_14090BFD0 )
{
v20 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v6 = (_DWORD *)qword_14090BFD0;
}
PlayerObject::updatePlayerJetpackFrame(a1, (unsigned int)(v6[229] - v6[230]));
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1856) + 160LL))(*(_QWORD *)(a1 + 1856));
v11 = **(_QWORD **)(a1 + 1856);
v12 = *(_QWORD *)(a1 + 1856);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v20, 6.0, 4.0);
(*(void (__fastcall **)(__int64, __int64))(v11 + 184))(v12, v13);
v10 = 0.0;
}
else
{
if ( !qword_14090BFD0 )
{
v20 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v6 = (_DWORD *)qword_14090BFD0;
}
PlayerObject::updatePlayerShipFrame(a1, (unsigned int)(v6[190] - v6[191]));
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1856) + 160LL))(*(_QWORD *)(a1 + 1856));
v7 = **(_QWORD **)(a1 + 1856);
v8 = *(_QWORD *)(a1 + 1856);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v20, 0.0, 5.0);
(*(void (__fastcall **)(__int64, __int64))(v7 + 184))(v8, v9);
v10 = -5.0;
}
v14 = **(_QWORD **)(a1 + 1888);
v15 = *(_QWORD *)(a1 + 1888);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v20, 0.0, v10);
(*(void (__fastcall **)(__int64, __int64))(v14 + 184))(v15, v16);
LOBYTE(v17) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1888) + 336LL))(*(_QWORD *)(a1 + 1888), v17);
PlayerObject::updatePlayerGlow(a1);
if ( !*(_BYTE *)(a1 + 1843) )
{
cocos2d::CCParticleSystem::resetSystem(*(cocos2d::CCParticleSystem **)(a1 + 2248));
cocos2d::CCParticleSystem::resetSystem(*(cocos2d::CCParticleSystem **)(a1 + 2256));
}
cocos2d::CCParticleSystem::stopSystem(*(cocos2d::CCParticleSystem **)(a1 + 2256));
*(_BYTE *)(a1 + 2031) = 0;
if ( *(_BYTE *)(a1 + 2030) )
cocos2d::CCParticleSystem::stopSystem(*(cocos2d::CCParticleSystem **)(a1 + 2240));
*(_BYTE *)(a1 + 2030) = 0;
if ( !a3 )
{
v21 = 255;
LOWORD(v20) = 255;
BYTE2(v20) = -1;
PlayerObject::spawnPortalCircle(a1, (__int64)&v20);
}
PlayerObject::activateStreak(a1);
PlayerObject::updatePlayerScale(a1);
v19 = *(_QWORD *)(a1 + 1968);
if ( v19 && !*(_BYTE *)(a1 + 2936) && !*(_BYTE *)(a1 + 1843) )
{
LOBYTE(v18) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v19 + 336LL))(v19, v18);
}
}
else
{
PlayerObject::resetPlayerIcon(a1);
}
if ( a2 )
{
PlayerObject::updatePlayerArt(a1);
PlayerObject::updateDashArt(a1);
}
}
}