diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 897272622..e3e4a8959 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -85,6 +85,7 @@ void Game::load(){ string tilesetName= gameSettings.getTileset(); string techName= gameSettings.getTech(); string scenarioName= gameSettings.getScenario(); + bool scenarioLoadingImageUsed=false; logger.setState(Lang::getInstance().get("Loading")); @@ -104,33 +105,43 @@ void Game::load(){ scenarioDir = scenarioDir.erase(scenarioDir.size() - 4, 4); scenarioDir = scenarioDir.erase(scenarioDir.size() - gameSettings.getScenario().size(), gameSettings.getScenario().size() + 1); } + // use a scenario based loading screen + string senarioLogo = scenarioDir + "/" + "loading_screen.jpg"; + if(fileExists(senarioLogo) == true) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,senarioLogo.c_str()); + logger.loadLoadingScreen(senarioLogo); + 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] Searching for loading screen\n",__FILE__,__FUNCTION__); - for ( int i=0; i < gameSettings.getFactionCount(); ++i ) { - if(gameSettings.getFactionControl(i)==ctHuman){ - vector pathList=config.getPathListForType(ptTechs,scenarioDir); - for(int idx = 0; idx < pathList.size(); idx++) { - 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()); - if(isdir(path.c_str()) == true) { - string factionLogo = path + "/" + "loading_screen.tga"; - - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); - - if(fileExists(factionLogo) == true) { - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); - - logger.loadLoadingScreen(factionLogo); - break; - } - } - } - break; - } - } + if(!scenarioLoadingImageUsed){ + // try to use a faction related loading screen + for ( int i=0; i < gameSettings.getFactionCount(); ++i ) { + if(gameSettings.getFactionControl(i)==ctHuman){ + vector pathList=config.getPathListForType(ptTechs,scenarioDir); + for(int idx = 0; idx < pathList.size(); idx++) { + 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()); + if(isdir(path.c_str()) == true) { + string factionLogo = path + "/" + "loading_screen.jpg"; + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); + + if(fileExists(factionLogo) == true) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); + + logger.loadLoadingScreen(factionLogo); + break; + } + } + } + break; + } + } + }