//
// GameManager::loadGround from 0x1003837e0 to 0x1003838f9 (281 bytes)
//
// 2 xrefs:
// > LevelSettingsLayer::selectArtClosed @ 0x10026f49b
// > GameManager::getGTexture @ 0x100383be0
//
// 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 GameManager::loadGround(GameManager *a1, int a2)
{
char v2; // al
int v3; // eax
int v4; // r14d
int m_loadedGroundID; // esi
cocos2d::CCString *v6; // rax
const char *CString; // r15
cocos2d::CCTextureCache *v8; // rax
cocos2d::CCTextureCache *v9; // r15
cocos2d::CCString *v10; // rax
const char *v11; // rax
cocos2d::CCString *v12; // rax
const char *v13; // r15
cocos2d::CCTextureCache *v14; // rax
cocos2d::CCTextureCache *v15; // r15
cocos2d::CCString *v16; // rax
const char *v17; // rax
char v18; // [rsp-8h] [rbp-20h]
char v19; // [rsp-8h] [rbp-20h]
v18 = v2;
v3 = 22;
if ( a2 < 22 )
v3 = a2;
v4 = 1;
if ( v3 >= 2 )
v4 = v3;
m_loadedGroundID = a1->m_loadedGroundID;
if ( v4 != m_loadedGroundID )
{
if ( m_loadedGroundID )
{
v6 = (cocos2d::CCString *)sub_1007AB580("groundSquare_%02d_001.png", v18);
CString = cocos2d::CCString::getCString(v6);
v8 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v8, CString);
if ( (a1->m_loadedGroundID & 0xFFFFFFFC) == 8 )
{
v9 = cocos2d::CCTextureCache::sharedTextureCache();
v10 = (cocos2d::CCString *)sub_1007AB580("groundSquare_%02d_2_001.png", v18);
v11 = cocos2d::CCString::getCString(v10);
cocos2d::CCTextureCache::removeTextureForKey(v9, v11);
}
}
v12 = (cocos2d::CCString *)sub_1007AB580("groundSquare_%02d_001.png", v18);
v13 = cocos2d::CCString::getCString(v12);
v14 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v14, v13, 0);
if ( (v4 & 0x7FFFFFFC) == 8 )
{
v15 = cocos2d::CCTextureCache::sharedTextureCache();
v16 = (cocos2d::CCString *)sub_1007AB580("groundSquare_%02d_2_001.png", v19);
v17 = cocos2d::CCString::getCString(v16);
cocos2d::CCTextureCache::addImage(v15, v17, 0);
}
a1->m_loadedGroundID = v4;
}
}