//
// GJBaseGameLayer::toggleFlipped from 0x5b9cf4 to 0x5b9e04 (272 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::setupLevelStart @ 0x5ba0de
// > GJBaseGameLayer::collisionCheckObjects @ 0x5bab02
// > GJBaseGameLayer::collisionCheckObjects @ 0x5bab4a
//
// 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
//
void __fastcall GJBaseGameLayer::toggleFlipped(GJBaseGameLayer *this, int a2, int a3)
{
int v6; // r0
float v7; // s16
int v8; // r3
float v9; // s14
int v10; // [sp+18h] [bp-8h]
int v11; // [sp+1Ch] [bp-4h]
if ( *((unsigned __int8 *)this + 856) == a2 )
return;
*((_BYTE *)this + 856) = a2;
PlayerObject::deactivateStreak(*((_DWORD *)this + 519), 1);
if ( a3 )
{
v7 = 0.0;
if ( a2 )
v7 = 1.0;
}
else
{
v6 = *((_DWORD *)this + 519);
if ( a2 )
{
LOWORD(v10) = -26881;
BYTE2(v10) = 0;
v7 = 1.0;
PlayerObject::spawnPortalCircle(v6, v10, (CCCircleWave *)0x42480000);
}
else
{
LOWORD(v11) = -256;
BYTE2(v11) = -1;
PlayerObject::spawnPortalCircle(v6, v11, (CCCircleWave *)0x42480000);
v7 = 0.0;
}
}
*((_BYTE *)this + 864) = 0;
if ( a3 )
{
*((float *)this + 215) = v7;
return;
}
if ( !GJBaseGameLayer::isFlipping(this) )
{
if ( v7 == 1.0 )
v8 = 925353388;
else
v8 = 1065353048;
*((_DWORD *)this + 215) = v8;
goto LABEL_20;
}
v9 = *((float *)this + 215);
if ( !*((_BYTE *)this + 856) )
{
if ( v9 <= 0.5 )
goto LABEL_20;
goto LABEL_19;
}
if ( v9 < 0.5 )
LABEL_19:
*((_BYTE *)this + 864) = 1;
LABEL_20:
PlayerObject::levelWillFlip(*((PlayerObject **)this + 519));
if ( *((_BYTE *)this + 866) )
PlayerObject::levelWillFlip(*((PlayerObject **)this + 520));
GJGameState::tweenValue((GJBaseGameLayer *)((char *)this + 328), *((float *)this + 215), v7, 7u, 0.4, 1, 1.2, -1, -1);
*((_BYTE *)this + 865) = 1;
}