diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 43491470..4f90a9a4 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -1869,7 +1869,7 @@ void runTechValidationForPath(string techPath, string techName, printf("\nWarning, duplicate files were detected - START:\n=====================\n"); } - printf("----- START duplicate files for CRC [%d] count [%d] first file is [%s]\n",iterMap->first,fileList.size(),fileList[0].c_str()); + printf("----- START duplicate files for CRC [%d] count [%lu] first file is [%s]\n",iterMap->first,fileList.size(),fileList[0].c_str()); map parentList; for(unsigned int idx = 0; idx < fileList.size(); ++idx) { @@ -1909,7 +1909,7 @@ void runTechValidationForPath(string techPath, string techName, //} } - printf("----- Finding parents for duplicate files [%d] first file is [%s]\n",fileList.size(),fileList[0].c_str()); + printf("----- Finding parents for duplicate files [%lu] first file is [%s]\n",fileList.size(),fileList[0].c_str()); for(map::iterator iterMap1 = parentList.begin(); iterMap1 != parentList.end(); ++iterMap1) { @@ -1923,7 +1923,7 @@ void runTechValidationForPath(string techPath, string techName, if(purgeDuplicateFiles == true) { //printf("\nPurge Duplicate Files detected - START:\n=====================\n"); - printf("----- move / remove duplicate files [%d] first file is [%s]\n",fileList.size(),fileList[0].c_str()); + printf("----- move / remove duplicate files [%lu] first file is [%s]\n",fileList.size(),fileList[0].c_str()); // First move first duplicate to commondata and delete all other copies string newCommonFileName = ""; for(unsigned int idx = 0; idx < fileList.size(); ++idx) { @@ -1932,7 +1932,7 @@ void runTechValidationForPath(string techPath, string techName, if(fileExt == "wav" || fileExt == "ogg") { off_t fileSize = getFileSize(duplicateFile); - printf("#1 [%d / %d] removing duplicate [%s]\n",idx,fileList.size(),duplicateFile.c_str()); + printf("#1 [%d / %lu] removing duplicate [%s]\n",idx,fileList.size(),duplicateFile.c_str()); if(idx == 0) { newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile); @@ -2000,7 +2000,7 @@ void runTechValidationForPath(string techPath, string techName, } } - printf("----- update XML files fpr duplicate files [%d] first file is [%s]\n",fileList.size(),fileList[0].c_str()); + printf("----- update XML files for duplicate files [%lu] first file is [%s]\n",fileList.size(),fileList[0].c_str()); std::map mapUniqueParentList; // Update the XML files to point to the new single copy in commondata @@ -2122,7 +2122,7 @@ void runTechValidationForPath(string techPath, string techName, } - printf("----- END duplicate files [%d] first file is [%s]\n",fileList.size(),fileList[0].c_str()); + printf("----- END duplicate files [%lu] first file is [%s]\n",fileList.size(),fileList[0].c_str()); } } if(foundDuplicates == true) { diff --git a/source/glest_game/menu/main_menu.cpp b/source/glest_game/menu/main_menu.cpp index d08f7c9c..d97f4fcc 100644 --- a/source/glest_game/menu/main_menu.cpp +++ b/source/glest_game/menu/main_menu.cpp @@ -103,6 +103,10 @@ MainMenu::~MainMenu() { void MainMenu::init() { Renderer::getInstance().initMenu(this); + initBackgroundVideo(); +} + +void MainMenu::initBackgroundVideo() { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && Shared::Graphics::VideoPlayer::hasBackEndVideoPlayer() == true && CoreData::getInstance().hasMainMenuVideoFilename() == true) { @@ -138,6 +142,19 @@ void MainMenu::render() { if(state->isMasterserverMode() == false) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) { + + if(state->isVideoPlaying() == true) { + if(menuBackgroundVideo != NULL) { + if(menuBackgroundVideo->isPlaying() == true) { + menuBackgroundVideo->closePlayer(); + delete menuBackgroundVideo; + menuBackgroundVideo = NULL; + } + } + } + else if(menuBackgroundVideo == NULL) { + initBackgroundVideo(); + } renderer.clearBuffers(); //3d diff --git a/source/glest_game/menu/main_menu.h b/source/glest_game/menu/main_menu.h index 86c70117..bf00cf03 100644 --- a/source/glest_game/menu/main_menu.h +++ b/source/glest_game/menu/main_menu.h @@ -59,6 +59,8 @@ private: int mouseX, mouseY; int mouse2dAnim; + void initBackgroundVideo(); + public: MainMenu(Program *program); ~MainMenu(); @@ -118,6 +120,8 @@ public: virtual bool isInSpecialKeyCaptureEvent() { return false; } virtual void consoleAddLine(string line); virtual void reloadUI(); + + virtual bool isVideoPlaying() { return false; }; }; }}//end namespace diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index e31eaa74..33515db7 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -1667,6 +1667,14 @@ void MenuStateConnectedGame::mouseMove(int x, int y, const MouseState *ms) { buttonRestoreLastSettings.mouseMove(x, y); } +bool MenuStateConnectedGame::isVideoPlaying() { + bool result = false; + if(factionVideo != NULL) { + result = factionVideo->isPlaying(); + } + return result; +} + void MenuStateConnectedGame::render() { try { Renderer &renderer= Renderer::getInstance(); diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index c8c09668..fc792264 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -214,6 +214,8 @@ public: virtual void reloadUI(); + virtual bool isVideoPlaying(); + private: bool hasNetworkGameSettings(); diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 8d808733..fabd5788 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -1736,6 +1736,14 @@ bool MenuStateCustomGame::isMasterserverMode() const { //return false; } +bool MenuStateCustomGame::isVideoPlaying() { + bool result = false; + if(factionVideo != NULL) { + result = factionVideo->isPlaying(); + } + return result; +} + void MenuStateCustomGame::render() { try { Renderer &renderer= Renderer::getInstance(); diff --git a/source/glest_game/menu/menu_state_custom_game.h b/source/glest_game/menu/menu_state_custom_game.h index 729713d5..4726c164 100644 --- a/source/glest_game/menu/menu_state_custom_game.h +++ b/source/glest_game/menu/menu_state_custom_game.h @@ -223,6 +223,7 @@ public: virtual bool isInSpecialKeyCaptureEvent(); virtual bool isMasterserverMode() const; + virtual bool isVideoPlaying(); private: bool hasNetworkGameSettings();