//
// GJBaseGameLayer::swapMiddleground from 0x1001de200 to 0x1001de2b4 (180 bytes)
//
// 1 xrefs:
// > ArtTriggerGameObject::triggerObject @ 0x100397304
//
// 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::swapMiddleground(GJBaseGameLayer *a1, int a2)
{
GameManager *v4; // x0
GJMGLayer *m_middleground; // x0
a1->m_gameState.m_middleground = a2;
if ( a1->m_skipArtReload )
return;
if ( GameManager::sharedState()->m_loadedMG == a2 )
{
if ( a2 < 1 || a1->m_middleground )
return;
LABEL_8:
if ( GameManager::sharedState()->m_loadedMG == a2 )
{
GJBaseGameLayer::createMiddleground(a1, a2);
GJBaseGameLayer::updateLevelColors(a1);
}
else
{
v4 = GameManager::sharedState();
GameManager::loadMiddlegroundAsync(v4, a2);
}
return;
}
if ( a2 )
goto LABEL_8;
m_middleground = a1->m_middleground;
if ( m_middleground )
{
((void (__fastcall *)(GJMGLayer *))m_middleground->removeFromParent)(m_middleground);
a1->m_middleground = nullptr;
}
}