From 999490e88bc699b671b94b88c9a4327d963db378 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Tue, 31 Dec 2013 16:58:21 +0100 Subject: Code for changing music in pause mode As requested by @Emxx52. Only code for now, we don't have the music yet. Temporairly in developements builds music will change to Prototype (in CBot editor) and Constructive Destruction (in SatCom) --- src/app/pausemanager.cpp | 49 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'src/app/pausemanager.cpp') diff --git a/src/app/pausemanager.cpp b/src/app/pausemanager.cpp index 847958d..761e158 100644 --- a/src/app/pausemanager.cpp +++ b/src/app/pausemanager.cpp @@ -15,6 +15,7 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. +#include "app/app.h" #include "app/pausemanager.h" #include "common/logger.h" @@ -25,18 +26,43 @@ template<> CPauseManager* CSingleton::m_instance = nullptr; CPauseManager::CPauseManager() { + m_sound = CApplication::GetInstancePointer()->GetSound(); + m_pause = PAUSE_NONE; } CPauseManager::~CPauseManager() { + m_sound = nullptr; } void CPauseManager::SetPause(PauseType pause) { if(pause != PAUSE_NONE) { - if(m_pause != pause) + 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; + } + } m_pause = pause; } else @@ -45,8 +71,10 @@ void CPauseManager::SetPause(PauseType pause) void CPauseManager::ClearPause() { - if(m_pause != PAUSE_NONE) + if(m_pause != PAUSE_NONE) { CLogger::GetInstancePointer()->Info("Game resumed\n"); + m_sound->StopPauseMusic(); + } m_pause = PAUSE_NONE; } @@ -70,14 +98,15 @@ std::string CPauseManager::GetPauseName(PauseType pause) { switch(pause) { - case PAUSE_NONE: return "None"; - case PAUSE_USER: return "User"; - case PAUSE_SATCOM: return "SatCom"; - case PAUSE_DIALOG: return "Dialog"; - case PAUSE_EDITOR: return "CBot editor"; - case PAUSE_VISIT: return "Visit"; - case PAUSE_CHEAT: return "Cheat console"; - case PAUSE_PHOTO: return "Photo mode"; + case PAUSE_NONE: return "None"; + case PAUSE_USER: return "User"; + case PAUSE_SATCOM: return "SatCom"; + case PAUSE_SATCOMMOVIE: return "SatCom opening animation"; + case PAUSE_DIALOG: return "Dialog"; + case PAUSE_EDITOR: return "CBot editor"; + case PAUSE_VISIT: return "Visit"; + case PAUSE_CHEAT: return "Cheat console"; + case PAUSE_PHOTO: return "Photo mode"; default: assert(false); // Should never happen } } -- cgit v1.2.3-1-g7c22