//
// PlayerObject::toggleBirdMode from 0x43eb50 to 0x43ed2e (478 bytes)
//
// 4 xrefs:
// > PlayerObject::switchedToMode @ 0x43e6d0
// > PlayerObject::copyAttributes @ 0x43f944
// > MenuGameLayer::resetPlayer @ 0x492820
// > GJBaseGameLayer::switchToFlyMode @ 0x58ee26
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:48:25 +0000
//
int __fastcall PlayerObject::toggleBirdMode(int this, int a2, int a3)
{
int v3; // r4
GameManager *v6; // r0
int v7; // r0
int v8; // r7
void (__fastcall *v9)(int, float *); // r8
int v10; // r7
void (__fastcall *v11)(int, float *); // r8
int v12; // r8
int v13; // s16
int v14; // r7
int v15; // r0
int v16; // [sp+0h] [bp-1Ch]
float v17[4]; // [sp+4h] [bp-18h] BYREF
v3 = this;
if ( *(unsigned __int8 *)(this + 1954) != a2 )
{
*(_QWORD *)(this + 1592) = *(_QWORD *)(this + 2128);
*(_BYTE *)(this + 1954) = a2;
if ( a2 )
PlayerObject::switchedToMode((char *)this, 19);
PlayerObject::stopRotation((PlayerObject *)v3, 0, 8);
*(double *)(v3 + 1928) = *(double *)(v3 + 1928) * 0.5;
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v3 + 180))(v3, 0);
*(_BYTE *)(v3 + 2036) = 0;
*(_BYTE *)(v3 + 1961) = 0;
*(_BYTE *)(v3 + 1603) = 0;
v6 = PlayerObject::removePendingCheckpoint((PlayerObject *)v3);
if ( *(_BYTE *)(v3 + 1954) )
{
v7 = GameManager::sharedState(v6);
PlayerObject::updatePlayerBirdFrame(
(PlayerObject *)v3,
(const char *)(*(_DWORD *)(v7 + 552) - *(_DWORD *)(v7 + 556)));
PlayerObject::stopPlatformerJumpAnimation(v3);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v3 + 1492) + 80))(*(_DWORD *)(v3 + 1492), 1057803469);
v8 = *(_DWORD *)(v3 + 1492);
v9 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v8 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, 0.0, 5.0);
v9(v8, v17);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v3 + 1508) + 172))(*(_DWORD *)(v3 + 1508), 1);
v10 = *(_DWORD *)(v3 + 1508);
v11 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v10 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, 0.0, -7.0);
v11(v10, v17);
PlayerObject::updatePlayerGlow((PlayerObject *)v3);
v12 = *(unsigned __int8 *)(v3 + 2110);
v13 = *(unsigned __int8 *)(v3 + 2109);
v14 = *(unsigned __int8 *)(v3 + 2111);
memset(v17, 0, sizeof(v17));
v15 = *(_DWORD *)(v3 + 1748);
v17[3] = 1.0;
v17[0] = (float)v13 / 255.0;
v17[1] = (float)v12 / 255.0;
v17[2] = (float)v14 / 255.0;
(*(void (__fastcall **)(int, float *))(*(_DWORD *)v15 + 680))(v15, v17);
(*(void (__fastcall **)(_DWORD, float *))(**(_DWORD **)(v3 + 1748) + 696))(*(_DWORD *)(v3 + 1748), v17);
if ( !*(_BYTE *)(v3 + 1483) )
cocos2d::CCParticleSystem::resetSystem(*(cocos2d::CCParticleSystem **)(v3 + 1748));
PlayerObject::deactivateParticle(v3);
if ( !a3 )
{
BYTE2(v16) = 0;
LOWORD(v16) = -14081;
PlayerObject::spawnPortalCircle(v3, v16, (CCCircleWave *)0x42480000);
}
PlayerObject::activateStreak((cocos2d::CCNode **)v3);
PlayerObject::updatePlayerScale((GJActionManager **)v3);
this = (*(int (__fastcall **)(_DWORD, int))(**(_DWORD **)(v3 + 1516) + 172))(*(_DWORD *)(v3 + 1516), 1);
}
else
{
this = PlayerObject::resetPlayerIcon((PlayerObject *)v3);
}
if ( a2 )
return PlayerObject::modeDidChange((PlayerObject *)v3);
}
return this;
}