//
// GameManager::loadGround from 0x5ec260 to 0x5ec37c (284 bytes)
//
// 3 xrefs:
// > GameManager::getGTexture @ 0x5ec668
// > LevelSettingsLayer::selectArtClosed @ 0xa34620
// > ??> @ 0xb4f90
//
// 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)
{
unsigned int v2; // w19
const char *m_loadedGroundID; // x1
cocos2d::CCString *v5; // x0
cocos2d::CCTextureCache *v6; // x0
cocos2d::CCTextureCache *v7; // x21
cocos2d::CCString *v8; // x0
const char *v9; // x0
cocos2d::CCString *v10; // x0
cocos2d::CCTextureCache *v11; // x0
cocos2d::CCTextureCache *v12; // x22
cocos2d::CCString *v13; // x0
const char *v14; // x0
char *v15; // [xsp+38h] [xbp+38h]
char *CString; // [xsp+38h] [xbp+38h]
if ( a2 <= 0 )
{
v2 = 1;
}
else if ( a2 > 22 )
{
v2 = 22;
}
else
{
v2 = a2;
}
m_loadedGroundID = (const char *)(unsigned int)a1->m_loadedGroundID;
if ( v2 != (_DWORD)m_loadedGroundID )
{
if ( (_DWORD)m_loadedGroundID )
{
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_001.png",
m_loadedGroundID);
CString = (char *)cocos2d::CCString::getCString(v10);
v11 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v11, CString);
if ( GameManager::groundHasSecondaryColor(a1, a1->m_loadedGroundID) )
{
v12 = cocos2d::CCTextureCache::sharedTextureCache();
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)(unsigned int)a1->m_loadedGroundID);
v14 = cocos2d::CCString::getCString(v13);
cocos2d::CCTextureCache::removeTextureForKey(v12, v14);
}
}
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_001.png",
(const char *)v2);
v15 = (char *)cocos2d::CCString::getCString(v5);
v6 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v6, v15, 0);
if ( GameManager::groundHasSecondaryColor(a1, v2) )
{
v7 = cocos2d::CCTextureCache::sharedTextureCache();
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)v2);
v9 = cocos2d::CCString::getCString(v8);
cocos2d::CCTextureCache::addImage(v7, v9, 0);
}
a1->m_loadedGroundID = v2;
}
}