//
// GJBaseGameLayer::playerWillSwitchMode from 0x88a16c to 0x88a348 (476 bytes)
//
// 10 xrefs:
// > GJBaseGameLayer::toggleDualMode @ 0x88a564
// > GJBaseGameLayer::collisionCheckObjects @ 0x88bd0c
// > GJBaseGameLayer::collisionCheckObjects @ 0x88bd80
// > GJBaseGameLayer::collisionCheckObjects @ 0x88bf68
// > GJBaseGameLayer::collisionCheckObjects @ 0x88bfb4
// > GJBaseGameLayer::collisionCheckObjects @ 0x88c1ec
// > GJBaseGameLayer::collisionCheckObjects @ 0x88c354
// > GJBaseGameLayer::collisionCheckObjects @ 0x88c510
// > GJBaseGameLayer::collisionCheckObjects @ 0x88c584
// > ??> @ 0x778b0
//
// 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 GJBaseGameLayer::playerWillSwitchMode(GJBaseGameLayer *a1, PlayerObject *a2, GameObject *a3)
{
GameObjectClassType m_classType; // w1
GameObjectType v7; // w0
GameObjectType v8; // w0
GJGameEvent v9; // w0
GameObjectType v10; // w0
PlayerObject *OtherPlayer; // x22
int v12; // w0
unsigned int m_isShip; // w1
if ( a3 )
{
m_classType = a3->m_classType;
a1->m_gameState.m_lastActivatedPortal1 = a3;
if ( m_classType == Effect )
GJBaseGameLayer::updateCameraMode(a1, (EffectGameObject *)a3, 0);
v7 = a3->getType(a3);
GJBaseGameLayer::updateDualGround(a1, a2, v7, 0, 0.0);
v8 = a3->getType(a3);
v9 = GJBaseGameLayer::objectTypeToGameEvent(a1, v8);
GJBaseGameLayer::gameEventTriggered(a1, v9, 0, 0);
v10 = a3->getType(a3);
if ( v10 == ShipPortal || v10 == UfoPortal || v10 == WavePortal || v10 == SwingPortal )
{
if ( !a1->m_gameState.m_isDualMode )
return;
}
else
{
a1->toggleGlitter(a1, 0);
if ( !a1->m_gameState.m_isDualMode )
return;
}
if ( !a1->m_levelSettings->m_twoPlayerMode )
{
OtherPlayer = GJBaseGameLayer::getOtherPlayer(a1, a2);
v12 = ((__int64 (__fastcall *)(GameObject *))a3->getType)(a3) - 5;
switch ( v12 )
{
case 0:
m_isShip = OtherPlayer->m_isShip;
goto LABEL_16;
case 1:
if ( PlayerObject::isFlying(OtherPlayer)
|| OtherPlayer->m_isBall
|| OtherPlayer->m_isRobot
|| OtherPlayer->m_isSpider
|| a1->m_gameState.m_unkBool31 )
{
return;
}
goto LABEL_17;
case 11:
m_isShip = OtherPlayer->m_isBall;
goto LABEL_16;
case 14:
m_isShip = OtherPlayer->m_isBird;
goto LABEL_16;
case 22:
m_isShip = OtherPlayer->m_isRobot;
goto LABEL_16;
case 28:
m_isShip = OtherPlayer->m_isSpider;
goto LABEL_16;
case 36:
m_isShip = OtherPlayer->m_isSwing;
LABEL_16:
if ( a1->m_gameState.m_unkBool31 < m_isShip )
LABEL_17:
PlayerObject::flipGravity(a2, !OtherPlayer->m_isUpsideDown, 1);
break;
default:
return;
}
}
}
}