//
// GJBaseGameLayer::createMiddleground from 0x1001de2b4 to 0x1001de33c (136 bytes)
//
// 6 xrefs:
// > PlayLayer::setupHasCompleted @ 0x100116a6c
// > LevelSettingsLayer::selectArtClosed @ 0x10017c2fc
// > GJBaseGameLayer::swapMiddleground @ 0x1001de270
// > GJBaseGameLayer::asyncMGLoaded @ 0x1001de34c
// > GJBaseGameLayer::syncBGTextures @ 0x1002021fc
// > LevelEditorLayer::init @ 0x1003575bc
//
// 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::createMiddleground(GJBaseGameLayer *a1, int a2)
{
__int64 v2; // x20
GJMGLayer *m_middleground; // x0
GJMGLayer *v5; // x0
LODWORD(v2) = a2;
m_middleground = a1->m_middleground;
if ( m_middleground )
{
((void (__fastcall *)(GJMGLayer *))m_middleground->removeFromParent)(m_middleground);
a1->m_middleground = nullptr;
}
if ( (int)v2 >= 1 )
{
if ( (unsigned int)v2 >= 3 )
v2 = 3;
else
v2 = (unsigned int)v2;
v5 = GJMGLayer::create(v2);
a1->m_middleground = v5;
((void (__fastcall *)(GJMGLayer *, __int64))v5->setTag)(v5, v2);
((void (__fastcall *)(cocos2d::CCNode *, GJMGLayer *, __int64))a1->m_objectParent->addChild_0)(
a1->m_objectParent,
a1->m_middleground,
4294967257LL);
}
}