//
// GameManager::loadMiddleground from 0x140182a00 to 0x140182b07 (263 bytes)
//
// 5 xrefs:
// > GJMGLayer::init @ 0x14027f0ee
// > LevelSettingsLayer::selectArtClosed @ 0x1403220f7
// > ??> @ 0x140677ae4
// > ??> @ 0x140677af4
// > ??> @ 0x1406cb4b4
//
// 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 GameManager::loadMiddleground(GameManager *a1, int a2)
{
int v2; // eax
int m_loadedMG; // edx
int v5; // edi
cocos2d::CCString *v6; // rax
const char *CString; // rbx
cocos2d::CCTextureCache *v8; // rax
cocos2d::CCString *v9; // rax
const char *v10; // rbx
cocos2d::CCTextureCache *v11; // rax
cocos2d::CCString *v12; // rax
const char *v13; // rbx
cocos2d::CCTextureCache *v14; // rax
cocos2d::CCString *v15; // rax
const char *v16; // rbx
cocos2d::CCTextureCache *v17; // rax
v2 = 3;
if ( a2 < 3 )
v2 = a2;
m_loadedMG = a1->m_loadedMG;
v5 = 0;
if ( v2 > 0 )
v5 = v2;
if ( v5 != m_loadedMG )
{
v6 = cocos2d::CCString::createWithFormat("fg_%02d_001.png", m_loadedMG);
CString = cocos2d::CCString::getCString(v6);
v8 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v8, CString);
v9 = cocos2d::CCString::createWithFormat("fg_%02d_2_001.png", a1->m_loadedMG);
v10 = cocos2d::CCString::getCString(v9);
v11 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v11, v10);
if ( v5 > 0 )
{
v12 = cocos2d::CCString::createWithFormat("fg_%02d_001.png", v5);
v13 = cocos2d::CCString::getCString(v12);
v14 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v14, v13, 0);
v15 = cocos2d::CCString::createWithFormat("fg_%02d_2_001.png", v5);
v16 = cocos2d::CCString::getCString(v15);
v17 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v17, v16, 0);
}
a1->m_loadedMG = v5;
}
}