- add faction path when using xml tags for battlend end videos:
<?xml version="1.0" standalone="no"?> <faction battle-end-win-video="x_battle_end_win_video.avi" battle-end-lose-video="x__battle_end_lose_video.avi" >
This commit is contained in:
parent
2c2ce3a6b3
commit
4e3d27f8c0
|
@ -137,26 +137,28 @@ std::pair<string,string> BattleEnd::getBattleEndVideo(bool won) {
|
||||||
xmlTree.load(factionDefinitionXML, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
|
xmlTree.load(factionDefinitionXML, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
|
||||||
const XmlNode *factionNode= xmlTree.getRootNode();
|
const XmlNode *factionNode= xmlTree.getRootNode();
|
||||||
if(won == true) {
|
if(won == true) {
|
||||||
if(factionNode->hasAttribute("faction-battle-end-win-video") == true) {
|
if(factionNode->hasAttribute("battle-end-win-video") == true) {
|
||||||
factionVideoUrl = factionNode->getAttribute("faction-battle-end-win-video")->getValue();
|
factionVideoUrl = factionNode->getAttribute("battle-end-win-video")->getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(factionNode->hasAttribute("faction-battle-end-lose-video") == true) {
|
if(factionNode->hasAttribute("battle-end-lose-video") == true) {
|
||||||
factionVideoUrl = factionNode->getAttribute("faction-battle-end-lose-video")->getValue();
|
factionVideoUrl = factionNode->getAttribute("battle-end-lose-video")->getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string techTreePath = "";
|
if(factionVideoUrl != "" && fileExists(factionVideoUrl) == false) {
|
||||||
string factionPath = "";
|
string techTreePath = "";
|
||||||
std::vector<std::string> factionPartsList;
|
string factionPath = "";
|
||||||
Tokenize(factionDefinitionXML,factionPartsList,"factions/");
|
std::vector<std::string> factionPartsList;
|
||||||
if(factionPartsList.size() > 1) {
|
Tokenize(factionDefinitionXML,factionPartsList,"factions/");
|
||||||
techTreePath = factionPartsList[0];
|
if(factionPartsList.size() > 1) {
|
||||||
|
techTreePath = factionPartsList[0];
|
||||||
|
|
||||||
string factionPath = techTreePath + "factions/" + currentFactionName_factionPreview;
|
string factionPath = techTreePath + "factions/" + currentFactionName_factionPreview;
|
||||||
endPathWithSlash(factionPath);
|
endPathWithSlash(factionPath);
|
||||||
factionVideoUrl = factionPath + factionVideoUrl;
|
factionVideoUrl = factionPath + factionVideoUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(won == true) {
|
if(won == true) {
|
||||||
|
@ -167,7 +169,7 @@ std::pair<string,string> BattleEnd::getBattleEndVideo(bool won) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#3 factionVideoUrl [%s] factionVideoUrlFallback [%s]\n",factionVideoUrl.c_str(),factionVideoUrlFallback.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#3 factionVideoUrl [%s] factionVideoUrlFallback [%s]\n",factionVideoUrl.c_str(),factionVideoUrlFallback.c_str());
|
||||||
printf("#3 factionVideoUrl [%s] factionVideoUrlFallback [%s]\n",factionVideoUrl.c_str(),factionVideoUrlFallback.c_str());
|
//printf("#3 factionVideoUrl [%s] factionVideoUrlFallback [%s]\n",factionVideoUrl.c_str(),factionVideoUrlFallback.c_str());
|
||||||
|
|
||||||
if(factionVideoUrl == "") {
|
if(factionVideoUrl == "") {
|
||||||
factionVideoUrl = factionVideoUrlFallback;
|
factionVideoUrl = factionVideoUrlFallback;
|
||||||
|
@ -210,13 +212,27 @@ string BattleEnd::getBattleEndMusic(bool won) {
|
||||||
xmlTree.load(factionDefinitionXML, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
|
xmlTree.load(factionDefinitionXML, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
|
||||||
const XmlNode *factionNode= xmlTree.getRootNode();
|
const XmlNode *factionNode= xmlTree.getRootNode();
|
||||||
if(won == true) {
|
if(won == true) {
|
||||||
if(factionNode->hasAttribute("faction-battle-end-win-music") == true) {
|
if(factionNode->hasAttribute("battle-end-win-music") == true) {
|
||||||
result = factionNode->getAttribute("faction-battle-end-win-music")->getValue();
|
result = factionNode->getAttribute("battle-end-win-music")->getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(factionNode->hasAttribute("faction-battle-end-lose-music") == true) {
|
if(factionNode->hasAttribute("battle-end-lose-music") == true) {
|
||||||
result = factionNode->getAttribute("faction-battle-end-lose-music")->getValue();
|
result = factionNode->getAttribute("battle-end-lose-music")->getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result != "" && fileExists(result) == false) {
|
||||||
|
string techTreePath = "";
|
||||||
|
string factionPath = "";
|
||||||
|
std::vector<std::string> factionPartsList;
|
||||||
|
Tokenize(factionDefinitionXML,factionPartsList,"factions/");
|
||||||
|
if(factionPartsList.size() > 1) {
|
||||||
|
techTreePath = factionPartsList[0];
|
||||||
|
|
||||||
|
string factionPath = techTreePath + "factions/" + currentFactionName_factionPreview;
|
||||||
|
endPathWithSlash(factionPath);
|
||||||
|
result = factionPath + result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +244,7 @@ string BattleEnd::getBattleEndMusic(bool won) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#3 result [%s] resultFallback [%s]\n",result.c_str(),resultFallback.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#3 result [%s] resultFallback [%s]\n",result.c_str(),resultFallback.c_str());
|
||||||
|
//printf("#3 result [%s] resultFallback [%s]\n",result.c_str(),resultFallback.c_str());
|
||||||
|
|
||||||
if(result == "") {
|
if(result == "") {
|
||||||
result = resultFallback;
|
result = resultFallback;
|
||||||
|
@ -257,6 +274,8 @@ void BattleEnd::initBackgroundMusic() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(music != "" && fileExists(music) == true) {
|
if(music != "" && fileExists(music) == true) {
|
||||||
|
printf("music [%s] \n",music.c_str());
|
||||||
|
|
||||||
battleEndMusic.open(music);
|
battleEndMusic.open(music);
|
||||||
battleEndMusic.setNext(&battleEndMusic);
|
battleEndMusic.setNext(&battleEndMusic);
|
||||||
|
|
||||||
|
@ -303,6 +322,8 @@ void BattleEnd::initBackgroundVideo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fileExists(videoFile) || fileExists(videoFileFallback)) {
|
if(fileExists(videoFile) || fileExists(videoFileFallback)) {
|
||||||
|
printf("videoFile [%s] videoFileFallback [%s]\n",videoFile.c_str(),videoFileFallback.c_str());
|
||||||
|
|
||||||
Context *c= GraphicsInterface::getInstance().getCurrentContext();
|
Context *c= GraphicsInterface::getInstance().getCurrentContext();
|
||||||
SDL_Surface *screen = static_cast<ContextGl*>(c)->getPlatformContextGlPtr()->getScreen();
|
SDL_Surface *screen = static_cast<ContextGl*>(c)->getPlatformContextGlPtr()->getScreen();
|
||||||
|
|
||||||
|
@ -398,7 +419,9 @@ void BattleEnd::render() {
|
||||||
else {
|
else {
|
||||||
//printf("Rendering to texture!\n");
|
//printf("Rendering to texture!\n");
|
||||||
|
|
||||||
if(menuBackgroundVideo == NULL) renderer.beginRenderToTexture(&renderToTexture);
|
if(menuBackgroundVideo == NULL) {
|
||||||
|
renderer.beginRenderToTexture(&renderToTexture);
|
||||||
|
}
|
||||||
|
|
||||||
TextRenderer2D *textRenderer2D = renderer.getTextRenderer();
|
TextRenderer2D *textRenderer2D = renderer.getTextRenderer();
|
||||||
TextRenderer3D *textRenderer3D = renderer.getTextRenderer3D();
|
TextRenderer3D *textRenderer3D = renderer.getTextRenderer3D();
|
||||||
|
@ -715,7 +738,9 @@ void BattleEnd::render() {
|
||||||
renderer.renderMouse2d(mouseX, mouseY, mouse2d, 0.f);
|
renderer.renderMouse2d(mouseX, mouseY, mouse2d, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(menuBackgroundVideo == NULL) renderer.endRenderToTexture(&renderToTexture);
|
if(menuBackgroundVideo == NULL) {
|
||||||
|
renderer.endRenderToTexture(&renderToTexture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer.renderFPSWhenEnabled(lastFps);
|
renderer.renderFPSWhenEnabled(lastFps);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user