//
// GJBaseGameLayer::playerWillSwitchMode from 0x1001e698c to 0x1001e6b94 (520 bytes)
//
// 9 xrefs:
// > GJBaseGameLayer::toggleDualMode @ 0x1001e636c
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001e8414
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001e8454
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001e848c
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001e85ec
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001e87d0
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001e88fc
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001e8a3c
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001e8a78
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GJBaseGameLayer::playerWillSwitchMode(GJBaseGameLayer *a1, PlayerObject *a2, GameObject *a3)
{
int v6; // w0
GJBaseGameLayer *v7; // x0
GJGameEvent v8; // w0
unsigned int v9; // w0
__int64 v11; // x8
PlayerObject *v12; // x22
int v13; // w0
bool m_isShip; // w8
if ( a3 )
{
a1->m_gameState.m_lastActivatedPortal1 = a3;
if ( a3->m_classType == Effect )
GJBaseGameLayer::updateCameraMode(a1, (EffectGameObject *)a3, 0);
v6 = ((__int64 (__fastcall *)(GameObject *))a3->getType)(a3);
GJBaseGameLayer::updateDualGround(a1, a2, v6, 0, 0.0);
v7 = (GJBaseGameLayer *)((__int64 (__fastcall *)(GameObject *))a3->getType)(a3);
v8 = GJBaseGameLayer::objectTypeToGameEvent(v7, (int)v7);
GJBaseGameLayer::gameEventTriggered(a1, v8, 0, 0);
v9 = ((__int64 (__fastcall *)(GameObject *))a3->getType)(a3);
if ( v9 > 0x29 || ((1LL << v9) & 0x20004080020LL) == 0 )
((void (__fastcall *)(GJBaseGameLayer *, _QWORD))a1->toggleGlitter)(a1, 0);
if ( a1->m_gameState.m_isDualMode && !a1->m_levelSettings->m_twoPlayerMode )
{
v11 = 3272;
if ( a2->m_uniqueID == a1->m_player1->m_uniqueID )
v11 = 3280;
v12 = *(PlayerObject **)((char *)&a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable
+ v11);
v13 = ((__int64 (__fastcall *)(GameObject *))a3->getType)(a3);
if ( v13 <= 18 )
{
switch ( v13 )
{
case 5:
m_isShip = v12->m_isShip;
break;
case 6:
if ( PlayerObject::isFlying(v12) || v12->m_isBall || v12->m_isRobot )
return;
m_isShip = !v12->m_isSpider;
break;
case 16:
m_isShip = v12->m_isBall;
break;
default:
return;
}
}
else if ( v13 > 32 )
{
if ( v13 == 33 )
{
m_isShip = v12->m_isSpider;
}
else
{
if ( v13 != 41 )
return;
m_isShip = v12->m_isSwing;
}
}
else if ( v13 == 19 )
{
m_isShip = v12->m_isBird;
}
else
{
if ( v13 != 27 )
return;
m_isShip = v12->m_isRobot;
}
if ( !a1->m_gameState.m_unkBool31 && m_isShip )
PlayerObject::flipGravity(a2, !v12->m_isUpsideDown, 1);
}
}
}