summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2013-12-31 16:58:21 +0100
committerkrzys-h <krzys_h@interia.pl>2013-12-31 16:58:21 +0100
commit999490e88bc699b671b94b88c9a4327d963db378 (patch)
treed2f27e5c80fe00358e5759e9ee40b2fd11d1ccff /src/app
parent4a237f5925eb0d371e097416b17dd5e919cd2258 (diff)
downloadcolobot-999490e88bc699b671b94b88c9a4327d963db378.tar.gz
colobot-999490e88bc699b671b94b88c9a4327d963db378.tar.bz2
colobot-999490e88bc699b671b94b88c9a4327d963db378.zip
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)
Diffstat (limited to 'src/app')
-rw-r--r--src/app/pausemanager.cpp49
-rw-r--r--src/app/pausemanager.h5
2 files changed, 44 insertions, 10 deletions
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<CPauseManager>::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
}
}
diff --git a/src/app/pausemanager.h b/src/app/pausemanager.h
index d2c0eab..fefc4a5 100644
--- a/src/app/pausemanager.h
+++ b/src/app/pausemanager.h
@@ -22,6 +22,7 @@
#pragma once
#include "common/singleton.h"
+#include "sound/sound.h"
#include <string>
@@ -30,6 +31,7 @@ enum PauseType {
PAUSE_NONE = 0,
PAUSE_USER,
PAUSE_SATCOM,
+ PAUSE_SATCOMMOVIE,
PAUSE_DIALOG,
PAUSE_EDITOR,
PAUSE_VISIT,
@@ -52,6 +54,9 @@ public:
private:
std::string GetPauseName(PauseType pause);
+private:
+ CSoundInterface* m_sound;
+
PauseType m_pause;
};