//
// GJBaseGameLayer::toggleFlipped from 0x9e7e64 to 0x9e7ff4 (400 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::setupLevelStart @ 0x9e821c
// > GJBaseGameLayer::collisionCheckObjects @ 0x9e9240
// > GJBaseGameLayer::collisionCheckObjects @ 0x9e92e0
// > ??> @ 0x783a0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:59:01 +0000
//
__int64 __fastcall GJBaseGameLayer::toggleFlipped(__int64 this, unsigned __int8 a2, unsigned __int8 a3)
{
int v3; // w20
int v4; // w21
__int64 v5; // x19
cocos2d::CCMotionStreak **v6; // x0
float v7; // s0
float v8; // s8
float v9; // s1
int v10; // [xsp+30h] [xbp+30h]
int v11; // [xsp+38h] [xbp+38h]
v3 = a2;
v4 = a3;
if ( *(unsigned __int8 *)(this + 1000) == a2 )
return this;
v5 = this;
v6 = *(cocos2d::CCMotionStreak ***)(this + 3256);
*(_BYTE *)(v5 + 1000) = a2;
this = PlayerObject::deactivateStreak(v6, 1u);
if ( v4 )
{
if ( v3 )
v7 = 1.0;
else
v7 = 0.0;
*(_BYTE *)(v5 + 1008) = 0;
*(float *)(v5 + 1004) = v7;
return this;
}
if ( v3 )
{
LOBYTE(v10) = -1;
*(_WORD *)((char *)&v10 + 1) = 150;
PlayerObject::spawnPortalCircle(*(_QWORD *)(v5 + 3256), v10, 50.0);
*(_BYTE *)(v5 + 1008) = 0;
if ( !(unsigned __int8)GJBaseGameLayer::isFlipping((GJBaseGameLayer *)v5) )
{
v8 = 1.0;
*(_DWORD *)(v5 + 1004) = 925353388;
goto LABEL_10;
}
v8 = 1.0;
LABEL_17:
v9 = *(float *)(v5 + 1004);
if ( *(_BYTE *)(v5 + 1000) )
{
if ( v9 >= 0.5 )
goto LABEL_10;
}
else if ( v9 <= 0.5 )
{
goto LABEL_10;
}
*(_BYTE *)(v5 + 1008) = 1;
goto LABEL_10;
}
LOWORD(v11) = -256;
BYTE2(v11) = -1;
PlayerObject::spawnPortalCircle(*(_QWORD *)(v5 + 3256), v11, 50.0);
*(_BYTE *)(v5 + 1008) = 0;
if ( (unsigned __int8)GJBaseGameLayer::isFlipping((GJBaseGameLayer *)v5) )
{
v8 = 0.0;
goto LABEL_17;
}
v8 = 0.0;
*(_DWORD *)(v5 + 1004) = 1065353048;
LABEL_10:
PlayerObject::levelWillFlip(*(PlayerObject **)(v5 + 3256));
if ( *(_BYTE *)(v5 + 1010) )
PlayerObject::levelWillFlip(*(PlayerObject **)(v5 + 3264));
GJGameState::tweenValue((GJGameState *)(v5 + 424), *(float *)(v5 + 1004), v8, 7, 0.4, 1, 1.2, -1, -1);
*(_BYTE *)(v5 + 1009) = 1;
return 1;
}