//
// PlayerObject::toggleFlyMode from 0x100403110 to 0x100403560 (1104 bytes)
//
// 12 xrefs:
// > GJBaseGameLayer::setupLevelStart @ 0x100101501
// > GJBaseGameLayer::setupLevelStart @ 0x1001016ee
// > GJBaseGameLayer::switchToFlyMode @ 0x100101cb1
// > PlayerObject::switchedToMode @ 0x1003ffd91
// > PlayerObject::toggleBirdMode @ 0x100403c5e
// > PlayerObject::toggleSwingMode @ 0x100404358
// > PlayerObject::toggleDartMode @ 0x100404d68
// > PlayerObject::toggleRollMode @ 0x1004053a7
// > PlayerObject::toggleRobotMode @ 0x10040579a
// > PlayerObject::toggleSpiderMode @ 0x100405c0a
// > PlayerObject::copyAttributes @ 0x100408494
// > MenuGameLayer::resetPlayer @ 0x1004f9532
//
// 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 12:30:03 +0000
//
void __fastcall PlayerObject::toggleFlyMode(__int64 a1, char a2, char a3)
{
__int64 v3; // rax
__int64 v7; // rsi
__int64 v8; // xmm0_8
__int64 v9; // rdi
__int64 v10; // r12
char v11; // r12
__int64 v12; // r12
__int64 v13; // r12
_DWORD *v14; // rax
__int64 v15; // r12
__int64 v16; // r12
float v17; // xmm1_4
__int64 v18; // r12
__int64 v19; // rdi
float v20[12]; // [rsp+0h] [rbp-30h] BYREF
*(_QWORD *)v20 = v3;
if ( *(_BYTE *)(a1 + 2417) != a2 )
{
*(_QWORD *)(a1 + 1960) = *(_QWORD *)(a1 + 2624);
*(_BYTE *)(a1 + 2417) = a2;
if ( a2 )
{
PlayerObject::toggleBirdMode(a1, 0, 0);
if ( *(_BYTE *)(a1 + 2419) )
{
*(_QWORD *)(a1 + 1960) = *(_QWORD *)(a1 + 2624);
*(_BYTE *)(a1 + 2419) = 0;
if ( *(float *)(a1 + 2472) == 1.0 || (v7 = 0, !*(_BYTE *)(a1 + 2648)) )
v7 = *(unsigned int *)(a1 + 1560);
PlayerObject::updatePlayerFrame(a1, v7);
if ( *(_BYTE *)(a1 + 2423) )
v8 = 1127481344;
else
v8 = 0;
(*(void (__fastcall **)(__int64, double))(*(_QWORD *)a1 + 360LL))(a1, *(double *)&v8);
*(_WORD *)(a1 + 1784) = 0;
*(_BYTE *)(a1 + 1640) = 0;
*(_DWORD *)(a1 + 1776) = 0;
}
PlayerObject::toggleDartMode(a1, 0, 0);
PlayerObject::toggleRobotMode(a1, 0, 0);
PlayerObject::toggleSpiderMode(a1, 0, 0);
PlayerObject::toggleSwingMode(a1, 0, 0);
}
*(_WORD *)(a1 + 1784) = 0;
*(_BYTE *)(a1 + 1640) = 0;
*(_DWORD *)(a1 + 1776) = 0;
*(double *)(a1 + 2392) = *(double *)(a1 + 2392) * 0.5;
(*(void (__fastcall **)(__int64, double))(*(_QWORD *)a1 + 360LL))(a1, 0.0);
*(_BYTE *)(a1 + 2500) = 0;
*(_BYTE *)(a1 + 2425) = 0;
*(_BYTE *)(a1 + 1971) = 0;
v9 = *(_QWORD *)(a1 + 2120);
if ( v9 )
{
v10 = sub_1005DDE90(v9);
GameObject::removeGlow(v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v10 + 536LL))(v10);
cocos2d::CCObject::release(*(_QWORD *)(a1 + 2120));
*(_QWORD *)(a1 + 2120) = 0;
}
if ( *(_BYTE *)(a1 + 2417) == 1 )
{
v11 = *(_BYTE *)(a1 + 2832);
if ( v11 == 1 )
{
v12 = *(_QWORD *)(a1 + 1800);
cocos2d::CCNode::stopActionByTag(v12, 13);
cocos2d::CCNode::stopActionByTag(v12, 14);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v12 + 160LL))(v12, 1.0);
v13 = *(_QWORD *)(a1 + 1824);
cocos2d::CCNode::stopActionByTag(v13, 13);
cocos2d::CCNode::stopActionByTag(v13, 14);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v13 + 160LL))(v13, 1.0);
v11 = *(_BYTE *)(a1 + 2832);
}
v14 = (_DWORD *)GameManager::sharedState();
if ( (v11 & 1) != 0 )
{
PlayerObject::updatePlayerJetpackFrame(a1, (unsigned int)(v14[221] - v14[222]));
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 1800) + 160LL))(*(_QWORD *)(a1 + 1800), 0.60000002);
v15 = *(_QWORD *)(a1 + 1800);
sub_100278250(v20, 6.0, 4.0);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v15 + 184LL))(v15, v20);
v16 = *(_QWORD *)(a1 + 1832);
v17 = 0.0;
}
else
{
PlayerObject::updatePlayerShipFrame(a1, (unsigned int)(v14[182] - v14[183]));
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 1800) + 160LL))(*(_QWORD *)(a1 + 1800), 0.55000001);
v18 = *(_QWORD *)(a1 + 1800);
sub_100278250(v20, 0.0, 5.0);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v18 + 184LL))(v18, v20);
v16 = *(_QWORD *)(a1 + 1832);
v17 = -5.0;
}
sub_100278250(v20, 0.0, v17);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v16 + 184LL))(v16, v20);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1832) + 344LL))(*(_QWORD *)(a1 + 1832), 1);
PlayerObject::updatePlayerGlow(a1);
if ( !*(_BYTE *)(a1 + 1787) )
{
cocos2d::CCParticleSystem::resetSystem(*(_QWORD *)(a1 + 2168));
cocos2d::CCParticleSystem::resetSystem(*(_QWORD *)(a1 + 2176));
}
cocos2d::CCParticleSystem::stopSystem(*(_QWORD *)(a1 + 2176));
*(_BYTE *)(a1 + 1975) = 0;
if ( *(_BYTE *)(a1 + 1974) == 1 )
cocos2d::CCParticleSystem::stopSystem(*(_QWORD *)(a1 + 2160));
*(_BYTE *)(a1 + 1974) = 0;
if ( !a3 )
PlayerObject::spawnPortalCircle(a1, 16711935, 50.0);
PlayerObject::activateStreak(a1);
GJActionManager::stopInternalAction(*(_QWORD *)(a1 + 3032), 6);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)a1 + 128LL))(a1, *(float *)(a1 + 2472));
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)a1 + 144LL))(a1, *(float *)(a1 + 2472));
v19 = *(_QWORD *)(a1 + 1912);
if ( v19 && !*(_BYTE *)(a1 + 2832) && !*(_BYTE *)(a1 + 1787) )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v19 + 344LL))(v19, 1);
}
else
{
PlayerObject::resetPlayerIcon(a1);
}
if ( a2 )
{
PlayerObject::updatePlayerArt(a1);
PlayerObject::updateDashArt(a1);
}
}
}