Added option to set pause audio in Scene
parent
2affc39b37
commit
bb2a9bcfd3
2
data
2
data
|
@ -1 +1 @@
|
|||
Subproject commit d58fb314ad6886f7bf57ece996861d050d993b1e
|
||||
Subproject commit 52a729007d3dbf6e05761a1aa4c932960490730f
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "common/logger.h"
|
||||
|
||||
#include "object/robotmain.h"
|
||||
|
||||
|
||||
template<> CPauseManager* CSingleton<CPauseManager>::m_instance = nullptr;
|
||||
|
||||
|
@ -41,27 +43,7 @@ void CPauseManager::SetPause(PauseType pause)
|
|||
if(pause != PAUSE_NONE) {
|
||||
if(m_pause != pause) {
|
||||
CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str());
|
||||
switch(pause) {
|
||||
case PAUSE_EDITOR:
|
||||
// TODO: We don't have this music yet
|
||||
// m_sound->PlayPauseMusic("");
|
||||
#if DEV_BUILD
|
||||
m_sound->PlayPauseMusic("Prototype.ogg");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case PAUSE_SATCOM:
|
||||
// TODO: We don't have this music yet
|
||||
// m_sound->PlayPauseMusic("");
|
||||
#if DEV_BUILD
|
||||
m_sound->PlayPauseMusic("Constructive.ogg");
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
// Don't change music
|
||||
break;
|
||||
}
|
||||
CRobotMain::GetInstancePointer()->StartPauseMusic(pause);
|
||||
}
|
||||
|
||||
m_pause = pause;
|
||||
|
|
|
@ -647,6 +647,10 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
m_visitArrow = 0;
|
||||
m_audioTrack = "";
|
||||
m_audioRepeat = true;
|
||||
m_satcomTrack = "";
|
||||
m_satcomRepeat = true;
|
||||
m_editorTrack = "";
|
||||
m_editorRepeat = true;
|
||||
m_delayWriteMessage = 0;
|
||||
m_selectObject = 0;
|
||||
m_infoUsed = 0;
|
||||
|
@ -3923,6 +3927,10 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
m_terrain->FlushMaterials();
|
||||
m_audioTrack = "";
|
||||
m_audioRepeat = true;
|
||||
m_satcomTrack = "";
|
||||
m_satcomRepeat = true;
|
||||
m_editorTrack = "";
|
||||
m_editorRepeat = true;
|
||||
m_displayText->SetDelay(1.0f);
|
||||
m_displayText->SetEnable(true);
|
||||
m_immediatSatCom = false;
|
||||
|
@ -4028,8 +4036,10 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
}
|
||||
}
|
||||
|
||||
if (Cmd(line, "MissionFile") && !resetObject)
|
||||
if (Cmd(line, "MissionFile") && !resetObject) {
|
||||
m_version = OpInt(line, "version", 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Fallback to an non-localized entry
|
||||
sprintf(op, "Title.%c", m_app->GetLanguageChar());
|
||||
|
@ -4165,15 +4175,27 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
filenameStr << "music" << std::setfill('0') << std::setw(3) << trackid << ".ogg";
|
||||
m_audioTrack = filenameStr.str();
|
||||
}
|
||||
m_audioRepeat = OpInt(line, "repeat", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
char trackname[100];
|
||||
OpString(line, "filename", trackname);
|
||||
|
||||
OpString(line, "main", trackname);
|
||||
m_audioTrack = trackname;
|
||||
m_audioRepeat = OpInt(line, "mainRepeat", 1);
|
||||
|
||||
OpString(line, "satcom", trackname);
|
||||
m_satcomTrack = trackname;
|
||||
m_satcomRepeat = OpInt(line, "satcomRepeat", 1);
|
||||
|
||||
OpString(line, "editor", trackname);
|
||||
m_editorTrack = trackname;
|
||||
m_editorRepeat = OpInt(line, "editorRepeat", 1);
|
||||
}
|
||||
m_audioRepeat = OpInt(line, "repeat", 1);
|
||||
if (m_audioTrack != "") m_sound->CacheMusic(m_audioTrack);
|
||||
if (m_satcomTrack != "") m_sound->CacheMusic(m_satcomTrack);
|
||||
if (m_editorTrack != "") m_sound->CacheMusic(m_editorTrack);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -7220,6 +7242,24 @@ void CRobotMain::StartMusic()
|
|||
}
|
||||
}
|
||||
|
||||
//! Starts pause music
|
||||
void CRobotMain::StartPauseMusic(PauseType pause)
|
||||
{
|
||||
switch(pause) {
|
||||
case PAUSE_EDITOR:
|
||||
m_sound->PlayPauseMusic(m_editorTrack, m_editorRepeat);
|
||||
break;
|
||||
|
||||
case PAUSE_SATCOM:
|
||||
m_sound->PlayPauseMusic(m_satcomTrack, m_satcomRepeat);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Don't change music
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//! Removes hilite and tooltip
|
||||
void CRobotMain::ClearInterface()
|
||||
{
|
||||
|
|
|
@ -340,6 +340,7 @@ public:
|
|||
float GetPersoAngle();
|
||||
|
||||
void StartMusic();
|
||||
void StartPauseMusic(PauseType pause);
|
||||
void ClearInterface();
|
||||
void ChangeColor();
|
||||
|
||||
|
@ -474,15 +475,19 @@ protected:
|
|||
bool m_showSoluce;
|
||||
bool m_showAll;
|
||||
bool m_cheatRadar;
|
||||
bool m_audioRepeat;
|
||||
bool m_shortCut;
|
||||
std::string m_audioTrack;
|
||||
bool m_audioRepeat;
|
||||
std::string m_satcomTrack;
|
||||
bool m_satcomRepeat;
|
||||
std::string m_editorTrack;
|
||||
bool m_editorRepeat;
|
||||
int m_delayWriteMessage;
|
||||
int m_movieInfoIndex;
|
||||
|
||||
CObject* m_controller;
|
||||
|
||||
//Level Checker flags
|
||||
// Level Checker flags
|
||||
bool m_beginObject;
|
||||
bool m_terrainGenerate;
|
||||
bool m_terrainInitTextures;
|
||||
|
|
|
@ -682,7 +682,7 @@ bool ALSound::PlayMusic(const std::string &filename, bool bRepeat, float fadeTim
|
|||
}
|
||||
|
||||
|
||||
bool ALSound::PlayPauseMusic(const std::string &filename)
|
||||
bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat)
|
||||
{
|
||||
if (m_previousMusic.fadeTime > 0.0f)
|
||||
{
|
||||
|
@ -703,7 +703,7 @@ bool ALSound::PlayPauseMusic(const std::string &filename)
|
|||
m_currentMusic = nullptr;
|
||||
}
|
||||
}
|
||||
return PlayMusic(filename, true);
|
||||
return PlayMusic(filename, repeat);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
void SuspendMusic();
|
||||
void StopMusic(float fadeTime=2.0f);
|
||||
bool IsPlayingMusic();
|
||||
bool PlayPauseMusic(const std::string &filename);
|
||||
bool PlayPauseMusic(const std::string &filename, bool repeat);
|
||||
void StopPauseMusic();
|
||||
|
||||
bool CheckChannel(int &channel);
|
||||
|
|
|
@ -59,12 +59,6 @@ void CSoundInterface::AddMusicFiles(const std::string &path)
|
|||
CacheMusic("Intro2.ogg");
|
||||
CacheMusic("music010.ogg");
|
||||
CacheMusic("music011.ogg");
|
||||
// TODO: Add pause music here
|
||||
// CacheMusic("");
|
||||
#if DEV_BUILD
|
||||
CacheMusic("Prototype.ogg");
|
||||
CacheMusic("Constructive.ogg");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CSoundInterface::Cache(Sound bSound, const std::string &bFile)
|
||||
|
@ -181,7 +175,7 @@ bool CSoundInterface::IsPlayingMusic()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CSoundInterface::PlayPauseMusic(const std::string &filename)
|
||||
bool CSoundInterface::PlayPauseMusic(const std::string &filename, bool repeat)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@ public:
|
|||
* \param filename - name of file to play
|
||||
* \return return true on success
|
||||
*/
|
||||
virtual bool PlayPauseMusic(const std::string &filename);
|
||||
virtual bool PlayPauseMusic(const std::string &filename, bool repeat);
|
||||
|
||||
/** Stop playing pause music and return to the mission music
|
||||
* \return nothing
|
||||
|
|
Loading…
Reference in New Issue