//
// PlayerObject::toggleBirdMode from 0x759c1c to 0x759ea4 (648 bytes)
//
// 6 xrefs:
// > PlayerObject::switchedToMode @ 0x759578
// > PlayerObject::switchedToMode @ 0x75958c
// > PlayerObject::copyAttributes @ 0x75d440
// > MenuGameLayer::resetPlayer @ 0x7da584
// > GJBaseGameLayer::switchToFlyMode @ 0x99dcdc
// > ??> @ 0xe57f8
//
// 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::toggleBirdMode(PlayerObject *this, unsigned __int8 a2, unsigned __int8 a3)
{
int v3; // w21
int v4; // w23
__int64 v6; // x1
__int64 v7; // x1
__int64 v8; // x0
__int64 v9; // x24
void (__fastcall *v10)(__int64, float *); // x25
__int64 v11; // x24
void (__fastcall *v12)(__int64, float *); // x25
float v13; // s1
float v14; // s0
__int64 v15; // x0
float v16; // s2
int v18; // [xsp+50h] [xbp+50h]
float v19[4]; // [xsp+58h] [xbp+58h] BYREF
v3 = a2;
v4 = a3;
if ( *((unsigned __int8 *)this + 2418) == a2 )
return _stack_chk_guard;
v6 = *((_QWORD *)this + 328);
*((_BYTE *)this + 2418) = v3;
*((_QWORD *)this + 245) = v6;
if ( v3 )
PlayerObject::switchedToMode(this, 19);
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 + 2418) )
{
v8 = GameManager::sharedState((GameManager *)*((unsigned __int8 *)this + 2418));
PlayerObject::updatePlayerBirdFrame(this, *(_DWORD *)(v8 + 752) - *(_DWORD *)(v8 + 756));
PlayerObject::stopPlatformerJumpAnimation(this);
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 225) + 160LL))(*((_QWORD *)this + 225), 0.55);
v9 = *((_QWORD *)this + 225);
v10 = *(void (__fastcall **)(__int64, float *))(*(_QWORD *)v9 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v19, 0.0, 5.0);
v10(v9, v19);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 229) + 344LL))(*((_QWORD *)this + 229), 1);
v11 = *((_QWORD *)this + 229);
v12 = *(void (__fastcall **)(__int64, float *))(*(_QWORD *)v11 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v19, 0.0, -7.0);
v12(v11, v19);
PlayerObject::updatePlayerGlow(this);
v13 = (float)*((unsigned __int8 *)this + 2607);
v14 = (float)*((unsigned __int8 *)this + 2605);
v15 = *((_QWORD *)this + 271);
v16 = (float)*((unsigned __int8 *)this + 2606) / 255.0;
v19[3] = 1.0;
v19[1] = v16;
v19[2] = v13 / 255.0;
v19[0] = v14 / 255.0;
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v15 + 1360LL))(v15, v19);
(*(void (__fastcall **)(_QWORD, float *))(**((_QWORD **)this + 271) + 1392LL))(*((_QWORD *)this + 271), v19);
if ( *((_BYTE *)this + 1787) )
{
PlayerObject::deactivateParticle((cocos2d::CCParticleSystem **)this);
if ( v4 )
{
LABEL_7:
PlayerObject::activateStreak((cocos2d::CCNode **)this);
PlayerObject::updatePlayerScale((GJActionManager **)this);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 231) + 344LL))(*((_QWORD *)this + 231), 1);
goto LABEL_8;
}
}
else
{
cocos2d::CCParticleSystem::resetSystem(*((cocos2d::CCParticleSystem **)this + 271));
PlayerObject::deactivateParticle((cocos2d::CCParticleSystem **)this);
if ( v4 )
goto LABEL_7;
}
LOWORD(v18) = -14081;
BYTE2(v18) = 0;
PlayerObject::spawnPortalCircle((__int64)this, v18, 50.0);
goto LABEL_7;
}
PlayerObject::resetPlayerIcon((cocos2d::CCParticleSystem **)this);
LABEL_8:
if ( v3 )
PlayerObject::modeDidChange(this);
return _stack_chk_guard;
}