//
// GameManager::loadGround from 0x3229e4 to 0x322a8e (170 bytes)
//
// 2 xrefs:
// > GameManager::getGTexture @ 0x322c70
// > LevelSettingsLayer::selectArtClosed @ 0x56f9c0
//
// 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)
{
const char *v3; // r4
const char *m_loadedGroundID; // r1
cocos2d::CCString *v5; // r0
const char *CString; // r6
cocos2d::CCTextureCache *v7; // r0
cocos2d::CCTextureCache *v8; // r6
cocos2d::CCString *v9; // r0
const char *v10; // r0
cocos2d::CCString *v11; // r0
const char *v12; // r6
cocos2d::CCTextureCache *v13; // r0
cocos2d::CCTextureCache *v14; // r6
cocos2d::CCString *v15; // r0
const char *v16; // r0
if ( a2 <= 0 )
{
v3 = (_BYTE *)(&dword_0 + 1);
}
else
{
if ( a2 >= 22 )
a2 = (int)&dword_14 + 2;
v3 = (const char *)a2;
}
m_loadedGroundID = (const char *)a1->m_loadedGroundID;
if ( v3 != m_loadedGroundID )
{
if ( m_loadedGroundID )
{
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_001.png",
m_loadedGroundID);
CString = cocos2d::CCString::getCString(v5);
v7 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v7, CString);
if ( GameManager::groundHasSecondaryColor(a1, a1->m_loadedGroundID) )
{
v8 = cocos2d::CCTextureCache::sharedTextureCache();
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)a1->m_loadedGroundID);
v10 = cocos2d::CCString::getCString(v9);
cocos2d::CCTextureCache::removeTextureForKey(v8, v10);
}
}
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"groundSquare_%02d_001.png", v3);
v12 = cocos2d::CCString::getCString(v11);
v13 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v13, v12, 0);
if ( GameManager::groundHasSecondaryColor(a1, (int)v3) )
{
v14 = cocos2d::CCTextureCache::sharedTextureCache();
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
v3);
v16 = cocos2d::CCString::getCString(v15);
cocos2d::CCTextureCache::addImage(v14, v16, 0);
}
a1->m_loadedGroundID = (int)v3;
}
}