summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-07-01 12:15:38 +0200
committerkrzys-h <krzys_h@interia.pl>2014-07-01 12:16:32 +0200
commitd9fee8b2adad613cf8c10d153cd5cd7b261b7863 (patch)
treef6b71cc2daa719c10c1ce31cf738e1c6ec934a73 /src/app
parent0f2adf05fd2b2b38c2b84aa8d72b3fd756dcfcd4 (diff)
parent1835d2ae580525603308206f7b8e6b4552b3ca0f (diff)
downloadcolobot-d9fee8b2adad613cf8c10d153cd5cd7b261b7863.tar.gz
colobot-d9fee8b2adad613cf8c10d153cd5cd7b261b7863.tar.bz2
colobot-d9fee8b2adad613cf8c10d153cd5cd7b261b7863.zip
Release 0.1.3-alpha
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app.cpp184
-rw-r--r--src/app/app.h29
-rw-r--r--src/app/gamedata.cpp136
-rw-r--r--src/app/gamedata.h66
-rw-r--r--src/app/pausemanager.cpp94
-rw-r--r--src/app/pausemanager.h62
6 files changed, 416 insertions, 155 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 4484e2a..8b310c9 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -19,6 +19,7 @@
#include "app/app.h"
+#include "app/gamedata.h"
#include "app/system.h"
#include "common/logger.h"
@@ -100,6 +101,7 @@ CApplication::CApplication()
m_objMan = new CObjectManager();
m_eventQueue = new CEventQueue();
m_profile = new CProfile();
+ m_gameData = new CGameData();
m_engine = nullptr;
m_device = nullptr;
@@ -112,7 +114,7 @@ CApplication::CApplication()
m_debugModes = 0;
m_customDataPath = false;
- m_windowTitle = "COLOBOT";
+ m_windowTitle = "COLOBOT GOLD";
m_simulationSuspended = false;
@@ -149,29 +151,17 @@ CApplication::CApplication()
m_dataPath = GetSystemUtils()->GetDataPath();
m_langPath = GetSystemUtils()->GetLangPath();
- m_texPackPath = "";
m_runSceneName = "";
m_runSceneRank = 0;
+
+ m_sceneTest = false;
m_language = LANGUAGE_ENV;
m_lowCPU = true;
m_protoMode = false;
-
- for (int i = 0; i < DIR_MAX; ++i)
- m_standardDataDirs[i] = nullptr;
-
- m_standardDataDirs[DIR_AI] = "ai";
- m_standardDataDirs[DIR_FONT] = "fonts";
- m_standardDataDirs[DIR_HELP] = "help";
- m_standardDataDirs[DIR_ICON] = "icons";
- m_standardDataDirs[DIR_LEVEL] = "levels";
- m_standardDataDirs[DIR_MODEL] = "models";
- m_standardDataDirs[DIR_MUSIC] = "music";
- m_standardDataDirs[DIR_SOUND] = "sounds";
- m_standardDataDirs[DIR_TEXTURE] = "textures";
}
CApplication::~CApplication()
@@ -190,6 +180,9 @@ CApplication::~CApplication()
delete m_iMan;
m_iMan = nullptr;
+
+ delete m_gameData;
+ m_gameData = nullptr;
GetSystemUtils()->DestroyTimeStamp(m_baseTimeStamp);
GetSystemUtils()->DestroyTimeStamp(m_curTimeStamp);
@@ -210,12 +203,6 @@ CEventQueue* CApplication::GetEventQueue()
CSoundInterface* CApplication::GetSound()
{
return m_sound;
-
- for (int i = 0; i < PCNT_MAX; ++i)
- {
- GetSystemUtils()->DestroyTimeStamp(m_performanceCounters[i][0]);
- GetSystemUtils()->DestroyTimeStamp(m_performanceCounters[i][1]);
- }
}
ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
@@ -225,13 +212,13 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
OPT_HELP = 1,
OPT_DEBUG,
OPT_RUNSCENE,
+ OPT_SCENETEST,
OPT_LOGLEVEL,
OPT_LANGUAGE,
OPT_DATADIR,
+ OPT_MOD,
OPT_LANGDIR,
- OPT_TEXPACK,
- OPT_VBO,
- OPT_PROTO
+ OPT_VBO
};
option options[] =
@@ -239,13 +226,13 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
{ "help", no_argument, nullptr, OPT_HELP },
{ "debug", required_argument, nullptr, OPT_DEBUG },
{ "runscene", required_argument, nullptr, OPT_RUNSCENE },
+ { "scenetest", no_argument, nullptr, OPT_SCENETEST },
{ "loglevel", required_argument, nullptr, OPT_LOGLEVEL },
{ "language", required_argument, nullptr, OPT_LANGUAGE },
{ "datadir", required_argument, nullptr, OPT_DATADIR },
+ { "mod", required_argument, nullptr, OPT_MOD },
{ "langdir", required_argument, nullptr, OPT_LANGDIR },
- { "texpack", required_argument, nullptr, OPT_TEXPACK },
{ "vbo", required_argument, nullptr, OPT_VBO },
- { "proto", no_argument, nullptr, OPT_PROTO },
{ nullptr, 0, nullptr, 0}
};
@@ -279,13 +266,13 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
GetLogger()->Message(" -help this help\n");
GetLogger()->Message(" -debug modes enable debug modes (more info printed in logs; see code for reference of modes)\n");
GetLogger()->Message(" -runscene sceneNNN run given scene on start\n");
+ GetLogger()->Message(" -scenetest win every mission right after it's loaded\n");
GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n");
GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl, ru)\n");
GetLogger()->Message(" -datadir path set custom data directory path\n");
+ GetLogger()->Message(" -mod path run mod\n");
GetLogger()->Message(" -langdir path set custom language directory path\n");
- GetLogger()->Message(" -texpack path set path to custom texture pack\n");
GetLogger()->Message(" -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n");
- GetLogger()->Message(" -proto show prototype levels\n");
return PARSE_ARGS_HELP;
}
case OPT_DEBUG:
@@ -316,6 +303,11 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
GetLogger()->Info("Running scene '%s%d' on start\n", m_runSceneName.c_str(), m_runSceneRank);
break;
}
+ case OPT_SCENETEST:
+ {
+ m_sceneTest = true;
+ break;
+ }
case OPT_LOGLEVEL:
{
LogLevel logLevel;
@@ -346,19 +338,19 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
{
m_dataPath = optarg;
m_customDataPath = true;
- GetLogger()->Info("Using custom datadir or running mod: '%s'\n", m_dataPath.c_str());
+ GetLogger()->Info("Using datadir: '%s'\n", optarg);
break;
}
- case OPT_LANGDIR:
+ case OPT_MOD:
{
- m_langPath = optarg;
- GetLogger()->Info("Using custom language dir: '%s'\n", m_langPath.c_str());
+ m_gameData->AddMod(std::string(optarg));
+ GetLogger()->Info("Running mod from path: '%s'\n", optarg);
break;
}
- case OPT_TEXPACK:
+ case OPT_LANGDIR:
{
- m_texPackPath = optarg;
- GetLogger()->Info("Using texturepack: '%s'\n", m_texPackPath.c_str());
+ m_langPath = optarg;
+ GetLogger()->Info("Using language dir: '%s'\n", m_langPath.c_str());
break;
}
case OPT_VBO:
@@ -379,11 +371,6 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
break;
}
- case OPT_PROTO:
- {
- m_protoMode = true;
- break;
- }
default:
assert(false); // should never get here
}
@@ -420,11 +407,19 @@ bool CApplication::Create()
m_exitCode = 1;
return false;
}
-
-#if !defined(PLATFORM_MACOSX)
- // On Mac OSX, the bundle can potentially change place, it doesn't make sense to cache it to the configuration file
- GetProfile().SetLocalProfileString("Resources", "Data", m_dataPath);
-#endif
+
+ m_gameData->SetDataDir(std::string(m_dataPath));
+ m_gameData->Init();
+
+ if (GetProfile().GetLocalProfileString("Language", "Lang", path)) {
+ Language language;
+ if (ParseLanguage(path, language)) {
+ m_language = language;
+ GetLogger()->Info("Setting language '%s' from ini file\n", path.c_str());
+ } else {
+ GetLogger()->Error("Invalid language '%s' in ini file\n", path.c_str());
+ }
+ }
SetLanguage(m_language);
@@ -436,36 +431,9 @@ bool CApplication::Create()
m_sound = new CSoundInterface();
#endif
- m_sound->Create(true);
-
-#if !defined(PLATFORM_MACOSX)
- // On Mac OSX, the bundle can potentially change place, it doesn't make sense to cache it to the configuration file
-
- // Cache sound files
- if (defaultValues)
- {
- GetProfile().SetLocalProfileString("Resources", "Sound", GetDataSubdirPath(DIR_SOUND));
- GetProfile().SetLocalProfileString("Resources", "Music", GetDataSubdirPath(DIR_MUSIC));
- }
-#endif
-
- if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Sound", path))
- {
- m_sound->CacheAll(path);
- }
- else
- {
- m_sound->CacheAll(GetDataSubdirPath(DIR_SOUND));
- }
-
- if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Music", path))
- {
- m_sound->AddMusicFiles(path);
- }
- else
- {
- m_sound->AddMusicFiles(GetDataSubdirPath(DIR_MUSIC));
- }
+ m_sound->Create();
+ m_sound->CacheAll();
+ m_sound->AddMusicFiles();
GetLogger()->Info("CApplication created successfully\n");
@@ -962,15 +930,15 @@ int CApplication::Run()
{
LogEvent(event);
- StartPerformanceCounter(PCNT_UPDATE_ENGINE);
- m_engine->FrameUpdate();
- StopPerformanceCounter(PCNT_UPDATE_ENGINE);
-
m_sound->FrameMove(m_relTime);
StartPerformanceCounter(PCNT_UPDATE_GAME);
m_robotMain->ProcessEvent(event);
StopPerformanceCounter(PCNT_UPDATE_GAME);
+
+ StartPerformanceCounter(PCNT_UPDATE_ENGINE);
+ m_engine->FrameUpdate();
+ StopPerformanceCounter(PCNT_UPDATE_ENGINE);
}
StopPerformanceCounter(PCNT_UPDATE_ALL);
@@ -1608,59 +1576,6 @@ bool CApplication::GetJoystickEnabled() const
return m_joystickEnabled;
}
-std::string CApplication::GetDataDirPath() const
-{
- return m_dataPath;
-}
-
-std::string CApplication::GetDataSubdirPath(DataDir stdDir) const
-{
- int index = static_cast<int>(stdDir);
- assert(index >= 0 && index < DIR_MAX);
- std::stringstream str;
- str << m_dataPath;
- str << "/";
- str << m_standardDataDirs[index];
- return str.str();
-}
-
-std::string CApplication::GetDataFilePath(DataDir stdDir, const std::string& subpath) const
-{
- int index = static_cast<int>(stdDir);
- assert(index >= 0 && index < DIR_MAX);
- std::stringstream str;
- str << m_dataPath;
- str << "/";
- str << m_standardDataDirs[index];
- if (stdDir == DIR_HELP)
- {
- str << "/";
- str << GetLanguageChar();
- }
- str << "/";
- str << subpath;
- return str.str();
-}
-
-std::string CApplication::GetTexPackFilePath(const std::string& textureName) const
-{
- std::stringstream str;
-
- if (! m_texPackPath.empty())
- {
- str << m_texPackPath;
- str << "/";
- str << textureName;
- if (! boost::filesystem::exists(str.str()))
- {
- GetLogger()->Trace("Texture '%s' not in texpack\n", textureName.c_str());
- str.str("");
- }
- }
-
- return str.str();
-}
-
Language CApplication::GetLanguage() const
{
return m_language;
@@ -1868,8 +1783,7 @@ void CApplication::UpdatePerformanceCountersData()
}
}
-bool CApplication::GetProtoMode() const
+bool CApplication::GetSceneTestMode()
{
- return m_protoMode;
+ return m_sceneTest;
}
-
diff --git a/src/app/app.h b/src/app/app.h
index 6b02f67..86a757f 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -42,6 +42,7 @@ class CInstanceManager;
class CEventQueue;
class CRobotMain;
class CSoundInterface;
+class CGameData;
namespace Gfx {
class CModelManager;
@@ -328,18 +329,6 @@ public:
static bool ParseDebugModes(const std::string& str, int& debugModes);
//@}
- //! Returns the full path to data directory
- std::string GetDataDirPath() const;
-
- //! Returns the full path to a standard dir in data directory
- std::string GetDataSubdirPath(DataDir stdDir) const;
-
- //! Returns the full path to a file in data directory given standard dir and subpath
- std::string GetDataFilePath(DataDir stdDir, const std::string &subpath) const;
-
- //! Returns the full path to a file in texture pack directory
- std::string GetTexPackFilePath(const std::string& textureName) const;
-
//! Management of language
//@{
Language GetLanguage() const;
@@ -360,8 +349,8 @@ public:
void StopPerformanceCounter(PerformanceCounter counter);
float GetPerformanceCounterData(PerformanceCounter counter) const;
//@}
-
- bool GetProtoMode() const;
+
+ bool GetSceneTestMode();
protected:
//! Creates the window's SDL_Surface
@@ -413,6 +402,8 @@ protected:
CRobotMain* m_robotMain;
//! Profile (INI) reader/writer
CProfile* m_profile;
+ //! Game data
+ CGameData* m_gameData;
//! Code to return at exit
int m_exitCode;
@@ -485,17 +476,15 @@ protected:
//! Path to directory with language files
std::string m_langPath;
-
- //! Path to directory with user texture pack
- std::string m_texPackPath;
-
+
//@{
//! Scene to run on startup
std::string m_runSceneName;
int m_runSceneRank;
//@}
-
- const char* m_standardDataDirs[DIR_MAX];
+
+ //! Scene test mode
+ bool m_sceneTest;
//! Application language
Language m_language;
diff --git a/src/app/gamedata.cpp b/src/app/gamedata.cpp
new file mode 100644
index 0000000..ceeb7b3
--- /dev/null
+++ b/src/app/gamedata.cpp
@@ -0,0 +1,136 @@
+// * This file is part of the COLOBOT source code
+// * Copyright (C) 2014, Polish Portal of Colobot (PPC)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * 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/gamedata.h"
+
+
+#include "app/app.h"
+
+#include <boost/filesystem.hpp>
+
+template<> CGameData* CSingleton<CGameData>::m_instance = nullptr;
+
+CGameData::CGameData()
+{
+ m_dataDirSet = false;
+
+ for (int i = 0; i < DIR_MAX; ++i)
+ m_standardDataDirs[i] = nullptr;
+
+ m_standardDataDirs[DIR_AI] = "ai";
+ m_standardDataDirs[DIR_FONT] = "fonts";
+ m_standardDataDirs[DIR_HELP] = "help";
+ m_standardDataDirs[DIR_ICON] = "icons";
+ m_standardDataDirs[DIR_LEVEL] = "levels";
+ m_standardDataDirs[DIR_MODEL] = "models";
+ m_standardDataDirs[DIR_MUSIC] = "music";
+ m_standardDataDirs[DIR_SOUND] = "sounds";
+ m_standardDataDirs[DIR_TEXTURE] = "textures";
+}
+
+CGameData::~CGameData()
+{
+}
+
+void CGameData::SetDataDir(std::string path)
+{
+ assert(!m_dataDirSet);
+ m_dataDirSet = true;
+
+ m_dataDirs.insert(m_dataDirs.begin(), path);
+}
+
+void CGameData::AddMod(std::string path)
+{
+ m_dataDirs.push_back(path);
+}
+
+void CGameData::Init()
+{
+ std::string out = "Using datadirs: ";
+ bool first = true;
+ for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
+ if(!first) out += ", ";
+ first = false;
+ out += *rit;
+ }
+ out += "\n";
+ CLogger::GetInstancePointer()->Info(out.c_str());
+}
+
+std::string CGameData::GetFilePath(DataDir dir, const std::string& subpath)
+{
+ int index = static_cast<int>(dir);
+ assert(index >= 0 && index < DIR_MAX);
+
+ for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
+ std::stringstream str;
+
+ if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot
+ str << *rit;
+ str << "/";
+ str << m_standardDataDirs[index];
+
+ if (dir == DIR_HELP)
+ {
+ str << "/";
+ str << CApplication::GetInstancePointer()->GetLanguageChar();
+ }
+ str << "/";
+ }
+
+ str << subpath;
+
+ boost::filesystem::path path(str.str());
+ if(boost::filesystem::exists(path))
+ {
+ return str.str();
+ }
+ }
+
+ if(m_dataDirs.size() > 0) {
+ std::stringstream str;
+ if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot
+ str << m_dataDirs[0];
+ str << "/";
+ str << m_standardDataDirs[index];
+
+ if (dir == DIR_HELP)
+ {
+ str << "/";
+ str << CApplication::GetInstancePointer()->GetLanguageChar();
+ }
+ str << "/";
+ }
+ str << subpath;
+ return str.str();
+ }
+
+ return subpath;
+}
+
+std::string CGameData::GetDataPath(const std::string &subpath)
+{
+ for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
+ std::string path = *rit + "/" + subpath;
+ boost::filesystem::path boostPath(path);
+ if(boost::filesystem::exists(boostPath))
+ {
+ return path;
+ }
+ }
+ return m_dataDirs[0] + "/" + subpath;
+}
diff --git a/src/app/gamedata.h b/src/app/gamedata.h
new file mode 100644
index 0000000..b7536a2
--- /dev/null
+++ b/src/app/gamedata.h
@@ -0,0 +1,66 @@
+// * This file is part of the COLOBOT source code
+// * Copyright (C) 2014, Polish Portal of Colobot (PPC)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+/**
+ * \file app/gamedata.h
+ * \brief Game data
+ */
+
+#pragma once
+
+#include "common/singleton.h"
+
+#include <string>
+#include <vector>
+
+/**
+ * \enum DataDir
+ * \brief Directories in data directory
+ */
+enum DataDir
+{
+ DIR_AI, //! < ai scripts
+ DIR_FONT, //! < fonts
+ DIR_HELP, //! < help files
+ DIR_ICON, //! < icons & images
+ DIR_LEVEL, //! < levels
+ DIR_MODEL, //! < models
+ DIR_MUSIC, //! < music
+ DIR_SOUND, //! < sounds
+ DIR_TEXTURE, //! < textures
+
+ DIR_MAX //! < number of dirs
+};
+
+class CGameData : public CSingleton<CGameData>
+{
+public:
+ CGameData();
+ ~CGameData();
+
+ void Init();
+ void SetDataDir(std::string path);
+ void AddMod(std::string path);
+
+ std::string GetFilePath(DataDir dir, const std::string &subpath);
+ std::string GetDataPath(const std::string &subpath);
+
+private:
+ bool m_dataDirSet;
+ std::vector<std::string> m_dataDirs;
+ const char* m_standardDataDirs[DIR_MAX];
+};
+
diff --git a/src/app/pausemanager.cpp b/src/app/pausemanager.cpp
new file mode 100644
index 0000000..d357bba
--- /dev/null
+++ b/src/app/pausemanager.cpp
@@ -0,0 +1,94 @@
+// * This file is part of the COLOBOT source code
+// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * 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"
+
+#include "object/robotmain.h"
+
+
+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) {
+ CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str());
+ CRobotMain::GetInstancePointer()->StartPauseMusic(pause);
+ }
+
+ m_pause = pause;
+ } else
+ ClearPause();
+}
+
+void CPauseManager::ClearPause()
+{
+ if(m_pause != PAUSE_NONE) {
+ CLogger::GetInstancePointer()->Info("Game resumed\n");
+ m_sound->StopPauseMusic();
+ }
+
+ m_pause = PAUSE_NONE;
+}
+
+bool CPauseManager::GetPause()
+{
+ return m_pause != PAUSE_NONE;
+}
+
+bool CPauseManager::GetPause(PauseType pause)
+{
+ return m_pause == pause;
+}
+
+PauseType CPauseManager::GetPauseType()
+{
+ return m_pause;
+}
+
+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_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
new file mode 100644
index 0000000..fefc4a5
--- /dev/null
+++ b/src/app/pausemanager.h
@@ -0,0 +1,62 @@
+// * This file is part of the COLOBOT source code
+// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+/**
+ * \file app/pausemanager.h
+ * \brief Management of pause modes
+ */
+#pragma once
+
+#include "common/singleton.h"
+#include "sound/sound.h"
+
+#include <string>
+
+
+enum PauseType {
+ PAUSE_NONE = 0,
+ PAUSE_USER,
+ PAUSE_SATCOM,
+ PAUSE_SATCOMMOVIE,
+ PAUSE_DIALOG,
+ PAUSE_EDITOR,
+ PAUSE_VISIT,
+ PAUSE_CHEAT,
+ PAUSE_PHOTO
+};
+
+class CPauseManager : public CSingleton<CPauseManager>
+{
+public:
+ CPauseManager();
+ ~CPauseManager();
+
+ void SetPause(PauseType pause);
+ void ClearPause();
+ bool GetPause();
+ bool GetPause(PauseType pause);
+ PauseType GetPauseType();
+
+private:
+ std::string GetPauseName(PauseType pause);
+
+private:
+ CSoundInterface* m_sound;
+
+ PauseType m_pause;
+};
+