//
// GJBaseGameLayer::playerWillSwitchMode from 0x5b8f04 to 0x5b903e (314 bytes)
//
// 9 xrefs:
// > GJBaseGameLayer::toggleDualMode @ 0x5b90e4
// > GJBaseGameLayer::collisionCheckObjects @ 0x5ba5b6
// > GJBaseGameLayer::collisionCheckObjects @ 0x5ba5fe
// > GJBaseGameLayer::collisionCheckObjects @ 0x5ba61a
// > GJBaseGameLayer::collisionCheckObjects @ 0x5ba660
// > GJBaseGameLayer::collisionCheckObjects @ 0x5ba6a6
// > GJBaseGameLayer::collisionCheckObjects @ 0x5ba6cc
// > GJBaseGameLayer::collisionCheckObjects @ 0x5baaa0
// > GJBaseGameLayer::collisionCheckObjects @ 0x5baaae
//
// 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:53:40 +0000
//
int __fastcall GJBaseGameLayer::playerWillSwitchMode(int this, PlayerObject *a2, GameObject *a3)
{
int v3; // r7
int v6; // r0
int v7; // r0
int v8; // r0
int v9; // r3
int v10; // r4
unsigned __int8 *OtherPlayer; // r6
unsigned int v12; // r0
v3 = this;
if ( a3 )
{
*(_DWORD *)(this + 840) = a3;
if ( *((_DWORD *)a3 + 271) == 1 )
GJBaseGameLayer::updateCameraMode((GJBaseGameLayer *)this, a3, 0);
v6 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a3 + 900))(a3);
GJBaseGameLayer::updateDualGround((GJBaseGameLayer *)v3, a2, v6, 0, 0.0);
v7 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a3 + 900))(a3);
v8 = GJBaseGameLayer::objectTypeToGameEvent((GJBaseGameLayer *)v3, v7);
GJBaseGameLayer::gameEventTriggered((int **)v3, v8, 0, 0);
this = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a3 + 900))(a3);
if ( this != 5 && this != 19 && this != 26 && this != 41 )
this = (*(int (__fastcall **)(int, _DWORD))(*(_DWORD *)v3 + 644))(v3, 0);
if ( *(_BYTE *)(v3 + 866) )
{
v9 = *(_DWORD *)(v3 + 2084);
v10 = *(unsigned __int8 *)(v9 + 280);
if ( !*(_BYTE *)(v9 + 280) )
{
OtherPlayer = (unsigned __int8 *)GJBaseGameLayer::getOtherPlayer((GJBaseGameLayer *)v3, a2);
v12 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a3 + 900))(a3);
if ( v12 == 19 )
{
this = OtherPlayer[1954];
goto LABEL_17;
}
if ( v12 <= 0x13 )
{
switch ( v12 )
{
case 6u:
this = PlayerObject::isFlying((PlayerObject *)OtherPlayer);
if ( this )
{
this = v10;
}
else if ( !OtherPlayer[1955] )
{
if ( OtherPlayer[1957] )
this = OtherPlayer[1955];
else
this = OtherPlayer[1958] ^ 1;
}
goto LABEL_17;
case 0x10u:
this = OtherPlayer[1955];
goto LABEL_17;
case 5u:
this = OtherPlayer[1953];
goto LABEL_17;
}
goto LABEL_28;
}
switch ( v12 )
{
case 0x21u:
this = OtherPlayer[1958];
break;
case 0x29u:
this = OtherPlayer[1964];
break;
case 0x1Bu:
this = OtherPlayer[1957];
break;
default:
LABEL_28:
this = 0;
break;
}
LABEL_17:
if ( !*(_BYTE *)(v3 + 1388) )
{
if ( this )
return (int)PlayerObject::flipGravity((unsigned __int8 *)a2, OtherPlayer[1959] ^ 1, 1);
}
}
}
}
return this;
}