//
// GameManager::loadGround from 0x140182c50 to 0x140182d6a (282 bytes)
//
// 5 xrefs:
// > GJGroundLayer::init @ 0x14027e2d3
// > LevelSettingsLayer::selectArtClosed @ 0x140321ff8
// > ??> @ 0x140677b2c
// > ??> @ 0x140677b3c
// > ??> @ 0x1406cb514
//
// 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::loadGround(GameManager *a1, int a2)
{
int v2; // eax
int v3; // edi
int m_loadedGroundID; // edx
cocos2d::CCString *v6; // rax
const char *CString; // rbx
cocos2d::CCTextureCache *v8; // rax
int v9; // edx
cocos2d::CCString *v10; // rax
const char *v11; // rbx
cocos2d::CCTextureCache *v12; // rax
cocos2d::CCString *v13; // rax
const char *v14; // rbx
cocos2d::CCTextureCache *v15; // rax
cocos2d::CCString *v16; // rax
const char *v17; // rbx
cocos2d::CCTextureCache *v18; // rax
v2 = 22;
v3 = 1;
if ( a2 < 22 )
v2 = a2;
m_loadedGroundID = a1->m_loadedGroundID;
if ( v2 > 1 )
v3 = v2;
if ( v3 != m_loadedGroundID )
{
if ( m_loadedGroundID )
{
v6 = cocos2d::CCString::createWithFormat("groundSquare_%02d_001.png", m_loadedGroundID);
CString = cocos2d::CCString::getCString(v6);
v8 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v8, CString);
v9 = a1->m_loadedGroundID;
if ( (unsigned int)(v9 - 8) <= 3 )
{
v10 = cocos2d::CCString::createWithFormat("groundSquare_%02d_2_001.png", v9);
v11 = cocos2d::CCString::getCString(v10);
v12 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v12, v11);
}
}
v13 = cocos2d::CCString::createWithFormat("groundSquare_%02d_001.png", v3);
v14 = cocos2d::CCString::getCString(v13);
v15 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v15, v14, 0);
if ( (unsigned int)(v3 - 8) <= 3 )
{
v16 = cocos2d::CCString::createWithFormat("groundSquare_%02d_2_001.png", v3);
v17 = cocos2d::CCString::getCString(v16);
v18 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v18, v17, 0);
}
a1->m_loadedGroundID = v3;
}
}