//
// GJBaseGameLayer::createMiddleground from 0x100114b20 to 0x100114bb2 (146 bytes)
//
// 3 xrefs:
// > PlayLayer::setupHasCompleted @ 0x1000adf35
// > LevelEditorLayer::init @ 0x1000dbf45
// > LevelSettingsLayer::selectArtClosed @ 0x10026f5b6
//
// 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)
{
GJMGLayer *m_middleground; // rdi
unsigned int v4; // r15d
GJMGLayer *v5; // rax
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);
}
}