loading screens for the factions

its possible to define a loading screen for a techtree too.
This commit is contained in:
Titus Tscharntke
2010-04-06 20:15:06 +00:00
parent 40f5097a07
commit 1f76690cf5

View File

@@ -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<string> 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<string> 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<string> 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);