//
// GJBaseGameLayer::swapMiddleground from 0x100114a00 to 0x100114b1f (287 bytes)
//
// 1 xrefs:
// > ArtTriggerGameObject::triggerObject @ 0x1001ed62d
//
// 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)
{
GJMGLayer *m_middleground; // rdi
unsigned int v4; // r15d
GJMGLayer *v5; // rax
GameManager *v6; // rax
GJMGLayer *v7; // rdi
a1->m_gameState.m_middleground = a2;
if ( a1->m_skipArtReload )
return;
if ( GameManager::sharedState()->m_loadedMG == a2 )
{
if ( a2 <= 0 || a1->m_middleground )
return;
goto LABEL_8;
}
if ( a2 )
{
LABEL_8:
if ( GameManager::sharedState()->m_loadedMG == a2 )
{
m_middleground = a1->m_middleground;
if ( m_middleground )
{
((void (__fastcall *)(GJMGLayer *))m_middleground->removeFromParent)(m_middleground);
a1->m_middleground = nullptr;
}
if ( a2 > 0 )
{
v4 = 3;
if ( (unsigned int)a2 < 3 )
v4 = a2;
v5 = GJMGLayer::create(v4);
a1->m_middleground = v5;
((void (__fastcall *)(GJMGLayer *, _QWORD))v5->setTag)(v5, v4);
((void (__fastcall *)(cocos2d::CCNode *, GJMGLayer *, __int64))a1->m_objectParent->addChild_0)(
a1->m_objectParent,
a1->m_middleground,
4294967257LL);
}
GJBaseGameLayer::updateLevelColors(a1);
}
else
{
v6 = GameManager::sharedState();
GameManager::loadMiddlegroundAsync(v6, a2);
}
return;
}
v7 = a1->m_middleground;
if ( v7 )
{
((void (__fastcall *)(GJMGLayer *))v7->removeFromParent)(v7);
a1->m_middleground = nullptr;
}
}