//
// GJBaseGameLayer::swapMiddleground from 0x100278718 to 0x1002787cc (180 bytes)
//
// 1 xrefs:
// > ArtTriggerGameObject::triggerObject @ 0x10043e208
//
// 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 11:01:51 +0000
//
__int64 __fastcall GJBaseGameLayer::swapMiddleground(__int64 result, __int64 a2)
{
__int64 v3; // x19
__int64 v4; // x0
__int64 v5; // x0
*(_DWORD *)(result + 1908) = a2;
if ( (*(_BYTE *)(result + 12605) & 1) != 0 )
return result;
v3 = result;
result = GameManager::sharedState(result);
if ( *(_DWORD *)(result + 988) == (_DWORD)a2 )
{
if ( (int)a2 < 1 || *(_QWORD *)(v3 + 3976) )
return result;
LABEL_8:
v4 = GameManager::sharedState(result);
if ( *(_DWORD *)(v4 + 988) == (_DWORD)a2 )
{
GJBaseGameLayer::createMiddleground(v3);
return GJBaseGameLayer::updateLevelColors(v3);
}
else
{
v5 = GameManager::sharedState(v4);
return sub_1003B5494(v5, a2);
}
}
if ( (_DWORD)a2 )
goto LABEL_8;
result = *(_QWORD *)(v3 + 3976);
if ( result )
{
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)result + 520LL))(result);
*(_QWORD *)(v3 + 3976) = 0;
}
return result;
}