Updated screen loading feature to support all supported image types

This commit is contained in:
Mark Vejvoda 2010-04-05 21:41:33 +00:00
parent b7a5970a3c
commit ec7e741ad3
1 changed files with 32 additions and 17 deletions

View File

@ -106,36 +106,51 @@ void Game::load(){
scenarioDir = scenarioDir.erase(scenarioDir.size() - gameSettings.getScenario().size(), gameSettings.getScenario().size() + 1); scenarioDir = scenarioDir.erase(scenarioDir.size() - gameSettings.getScenario().size(), gameSettings.getScenario().size() + 1);
} }
// use a scenario based loading screen // use a scenario based loading screen
string senarioLogo = scenarioDir + "/" + "loading_screen.jpg"; vector<string> loadScreenList;
if(fileExists(senarioLogo) == true) { findAll(scenarioDir + "/" + "loading_screen.*", loadScreenList, false, false);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,senarioLogo.c_str()); if(loadScreenList.size() > 0) {
//string senarioLogo = scenarioDir + "/" + "loading_screen.jpg";
string senarioLogo = scenarioDir + "/" + loadScreenList[0];
if(fileExists(senarioLogo) == true) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found scenario loading screen '%s'\n",__FILE__,__FUNCTION__,senarioLogo.c_str());
logger.loadLoadingScreen(senarioLogo); logger.loadLoadingScreen(senarioLogo);
scenarioLoadingImageUsed=true; scenarioLoadingImageUsed=true;
}
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] gameSettings.getScenarioDir() = [%s] gameSettings.getScenario() = [%s] scenarioDir = [%s]\n",__FILE__,__FUNCTION__,__LINE__,gameSettings.getScenarioDir().c_str(),gameSettings.getScenario().c_str(),scenarioDir.c_str()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] gameSettings.getScenarioDir() = [%s] gameSettings.getScenario() = [%s] scenarioDir = [%s]\n",__FILE__,__FUNCTION__,__LINE__,gameSettings.getScenarioDir().c_str(),gameSettings.getScenario().c_str(),scenarioDir.c_str());
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for loading screen\n",__FILE__,__FUNCTION__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for loading screen\n",__FILE__,__FUNCTION__);
if(!scenarioLoadingImageUsed){ if(scenarioLoadingImageUsed == false){
// try to use a faction related loading screen // try to use a faction related loading screen
for ( int i=0; i < gameSettings.getFactionCount(); ++i ) { for ( int i=0; i < gameSettings.getFactionCount(); ++i ) {
if(gameSettings.getFactionControl(i)==ctHuman){ if(gameSettings.getFactionControl(i)==ctHuman){
vector<string> pathList=config.getPathListForType(ptTechs,scenarioDir); vector<string> pathList=config.getPathListForType(ptTechs,scenarioDir);
for(int idx = 0; idx < pathList.size(); idx++) { for(int idx = 0; idx < pathList.size(); idx++) {
const string path = pathList[idx]+ "/" +techName+ "/"+ "factions"+ "/"+ gameSettings.getFactionTypeName(i); const string path = pathList[idx]+ "/" +techName+ "/"+ "factions"+ "/"+ gameSettings.getFactionTypeName(i);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] possible loading screen dir '%s'\n",__FILE__,__FUNCTION__,path.c_str()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] possible loading screen dir '%s'\n",__FILE__,__FUNCTION__,path.c_str());
if(isdir(path.c_str()) == true) { if(isdir(path.c_str()) == true) {
string factionLogo = path + "/" + "loading_screen.jpg"; vector<string> loadScreenList;
findAll(path + "/" + "loading_screen.*", loadScreenList, false, false);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); if(loadScreenList.size() > 0) {
//string factionLogo = path + "/" + "loading_screen.jpg";
if(fileExists(factionLogo) == true) { string factionLogo = path + "/" + loadScreenList[0];
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str());
logger.loadLoadingScreen(factionLogo);
break; if(fileExists(factionLogo) == true) {
} SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str());
logger.loadLoadingScreen(factionLogo);
scenarioLoadingImageUsed = true;
break;
}
}
}
if(scenarioLoadingImageUsed == true) {
break;
} }
} }
break; break;