From 1f76690cf5423b23b56811a21187fce9e4e81aa2 Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Tue, 6 Apr 2010 20:15:06 +0000 Subject: [PATCH] loading screens for the factions its possible to define a loading screen for a techtree too. --- source/glest_game/game/game.cpp | 47 +++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index ec8ef5e2e..580e4f4cc 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -85,7 +85,7 @@ void Game::load(){ string tilesetName= gameSettings.getTileset(); string techName= gameSettings.getTech(); string scenarioName= gameSettings.getScenario(); - bool scenarioLoadingImageUsed=false; + bool loadingImageUsed=false; logger.setState(Lang::getInstance().get("Loading")); @@ -115,15 +115,15 @@ void Game::load(){ SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found scenario loading screen '%s'\n",__FILE__,__FUNCTION__,senarioLogo.c_str()); logger.loadLoadingScreen(senarioLogo); - scenarioLoadingImageUsed=true; + loadingImageUsed=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__); - if(scenarioLoadingImageUsed == false){ + + if(loadingImageUsed == false){ // try to use a faction related loading screen + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for faction loading screen\n",__FILE__,__FUNCTION__); for ( int i=0; i < gameSettings.getFactionCount(); ++i ) { if(gameSettings.getFactionControl(i)==ctHuman){ vector pathList=config.getPathListForType(ptTechs,scenarioDir); @@ -143,13 +143,13 @@ void Game::load(){ SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); logger.loadLoadingScreen(factionLogo); - scenarioLoadingImageUsed = true; + loadingImageUsed = true; break; } } } - if(scenarioLoadingImageUsed == true) { + if(loadingImageUsed == true) { break; } } @@ -157,6 +157,37 @@ void Game::load(){ } } } + if(loadingImageUsed == false){ + // try to use a tech related loading screen + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for tech loading screen\n",__FILE__,__FUNCTION__); + + vector pathList=config.getPathListForType(ptTechs,scenarioDir); + for(int idx = 0; idx < pathList.size(); idx++) { + const string path = pathList[idx]+ "/" +techName; + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] possible loading screen dir '%s'\n",__FILE__,__FUNCTION__,path.c_str()); + if(isdir(path.c_str()) == true) { + vector loadScreenList; + findAll(path + "/" + "loading_screen.*", loadScreenList, false, false); + if(loadScreenList.size() > 0) { + //string factionLogo = path + "/" + "loading_screen.jpg"; + string factionLogo = path + "/" + loadScreenList[0]; + + 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); + loadingImageUsed = true; + break; + } + } + } + if(loadingImageUsed == true) { + break; + } + } + } @@ -170,7 +201,7 @@ void Game::load(){ //tech, load before map because of resources world.loadTech(config.getPathListForType(ptTechs,scenarioDir), techName, factions, &checksum); - + //map world.loadMap(Map::getMapPath(mapName,scenarioDir), &checksum);