- disable main menu background video playback when showing faction preview video

This commit is contained in:
Mark Vejvoda 2012-06-09 02:59:46 +00:00
parent c629fae830
commit 90b0d96b5d
7 changed files with 46 additions and 6 deletions

View File

@ -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<string,int> 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<string,int>::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<string,int> 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) {

View File

@ -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

View File

@ -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

View File

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

View File

@ -214,6 +214,8 @@ public:
virtual void reloadUI();
virtual bool isVideoPlaying();
private:
bool hasNetworkGameSettings();

View File

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

View File

@ -223,6 +223,7 @@ public:
virtual bool isInSpecialKeyCaptureEvent();
virtual bool isMasterserverMode() const;
virtual bool isVideoPlaying();
private:
bool hasNetworkGameSettings();