//
// GJBaseGameLayer::playerWillSwitchMode from 0x100124a20 to 0x100124c4d (557 bytes)
//
// 9 xrefs:
// > GJBaseGameLayer::toggleDualMode @ 0x100124322
// > GJBaseGameLayer::collisionCheckObjects @ 0x100127193
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001271d9
// > GJBaseGameLayer::collisionCheckObjects @ 0x100127213
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001273eb
// > GJBaseGameLayer::collisionCheckObjects @ 0x1001275f6
// > GJBaseGameLayer::collisionCheckObjects @ 0x10012776f
// > GJBaseGameLayer::collisionCheckObjects @ 0x10012790d
// > GJBaseGameLayer::collisionCheckObjects @ 0x100127949
//
// 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 v4; // eax
GJGameEvent v5; // r12d
unsigned int v6; // eax
unsigned int v7; // eax
__int64 v8; // rcx
PlayerObject *v9; // r12
bool m_isShip; // al
if ( a3 )
{
a1->m_gameState.m_lastActivatedPortal1 = a3;
if ( a3->m_classType == Effect )
{
a1->m_gameState.m_isFreeMode = LOBYTE(a3[1].m_transformToBatch.tx);
a1->m_gameState.m_unkBool9 = a3[1].m_sBlendFunc.dst;
if ( BYTE1(a3[1].m_transformToBatch.tx) == 1 )
_mm_storel_ps(
(double *)&a1->m_gameState.m_unkFloat2,
_mm_min_ps(
(__m128)0x422000003F800000uLL,
_mm_max_ps(
(__m128)0x3F80000000000000uLL,
_mm_shuffle_ps(
(__m128)*(unsigned __int64 *)&a3[1].m_transformToBatch.ty,
(__m128)*(unsigned __int64 *)&a3[1].m_transformToBatch.ty,
225))));
}
v4 = ((__int64 (__fastcall *)(GameObject *))a3->getType)(a3);
v5 = 0;
GJBaseGameLayer::updateDualGround(a1, a2, v4, 0, 0.0);
v6 = ((__int64 (__fastcall *)(GameObject *))a3->getType)(a3) - 3;
if ( v6 <= 0x2B )
v5 = dword_100816BBC[v6];
GJBaseGameLayer::gameEventTriggered(a1, v5, 0, 0);
v7 = ((__int64 (__fastcall *)(GameObject *))a3->getType)(a3);
if ( v7 <= 0x29 && (v8 = 0x20004080020LL, _bittest64(&v8, v7)) )
{
if ( !a1->m_gameState.m_isDualMode )
return;
}
else
{
((void (__fastcall *)(GJBaseGameLayer *, _QWORD))a1->toggleGlitter)(a1, 0);
if ( !a1->m_gameState.m_isDualMode )
return;
}
if ( !a1->m_levelSettings->m_twoPlayerMode )
{
v9 = *(&a1->m_player1 + (a2->m_uniqueID == a1->m_player1->m_uniqueID));
switch ( ((unsigned int (__fastcall *)(GameObject *))a3->getType)(a3) )
{
case 5u:
m_isShip = v9->m_isShip;
goto LABEL_24;
case 6u:
if ( PlayerObject::isFlying(v9) || v9->m_isBall || v9->m_isRobot )
return;
m_isShip = !v9->m_isSpider;
LABEL_24:
if ( !a1->m_gameState.m_unkBool31 && m_isShip )
PlayerObject::flipGravity(a2, !v9->m_isUpsideDown, 1);
break;
case 0x10u:
m_isShip = v9->m_isBall;
goto LABEL_24;
case 0x13u:
m_isShip = v9->m_isBird;
goto LABEL_24;
case 0x1Bu:
m_isShip = v9->m_isRobot;
goto LABEL_24;
case 0x21u:
m_isShip = v9->m_isSpider;
goto LABEL_24;
case 0x29u:
m_isShip = v9->m_isSwing;
goto LABEL_24;
default:
return;
}
}
}
}