summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2013-12-31 12:58:45 +0100
committerkrzys-h <krzys_h@interia.pl>2013-12-31 13:24:09 +0100
commit4a237f5925eb0d371e097416b17dd5e919cd2258 (patch)
tree9ce5e9347d0e0a655b247c530c8264581f19036a
parent3536f1c7cc52792a7d833b4f823aa515dc00d933 (diff)
downloadcolobot-4a237f5925eb0d371e097416b17dd5e919cd2258.tar.gz
colobot-4a237f5925eb0d371e097416b17dd5e919cd2258.tar.bz2
colobot-4a237f5925eb0d371e097416b17dd5e919cd2258.zip
CPauseManager
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/app/pausemanager.cpp83
-rw-r--r--src/app/pausemanager.h57
-rw-r--r--src/graphics/engine/engine.cpp13
-rw-r--r--src/graphics/engine/engine.h10
-rw-r--r--src/object/robotmain.cpp44
-rw-r--r--src/object/robotmain.h6
-rw-r--r--src/script/script.cpp11
-rw-r--r--src/script/script.h3
-rw-r--r--src/ui/displayinfo.cpp11
-rw-r--r--src/ui/displayinfo.h19
-rw-r--r--src/ui/maindialog.cpp7
-rw-r--r--src/ui/maindialog.h33
-rw-r--r--src/ui/studio.cpp13
-rw-r--r--src/ui/studio.h13
15 files changed, 239 insertions, 85 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c32f054..8d6b14c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -65,6 +65,7 @@ app/main.cpp
app/system.cpp
app/${SYSTEM_CPP_MODULE}
app/system_other.cpp
+app/pausemanager.cpp
common/event.cpp
common/image.cpp
common/iman.cpp
diff --git a/src/app/pausemanager.cpp b/src/app/pausemanager.cpp
new file mode 100644
index 0000000..847958d
--- /dev/null
+++ b/src/app/pausemanager.cpp
@@ -0,0 +1,83 @@
+// * 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/pausemanager.h"
+
+#include "common/logger.h"
+
+
+template<> CPauseManager* CSingleton<CPauseManager>::m_instance = nullptr;
+
+
+CPauseManager::CPauseManager()
+{
+ m_pause = PAUSE_NONE;
+}
+
+CPauseManager::~CPauseManager()
+{
+}
+
+void CPauseManager::SetPause(PauseType pause)
+{
+ if(pause != PAUSE_NONE) {
+ if(m_pause != pause)
+ CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str());
+
+ m_pause = pause;
+ } else
+ ClearPause();
+}
+
+void CPauseManager::ClearPause()
+{
+ if(m_pause != PAUSE_NONE)
+ CLogger::GetInstancePointer()->Info("Game resumed\n");
+
+ 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_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..d2c0eab
--- /dev/null
+++ b/src/app/pausemanager.h
@@ -0,0 +1,57 @@
+// * 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 <string>
+
+
+enum PauseType {
+ PAUSE_NONE = 0,
+ PAUSE_USER,
+ PAUSE_SATCOM,
+ 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);
+
+ PauseType m_pause;
+};
+
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp
index 5cf7b23..0ee7715 100644
--- a/src/graphics/engine/engine.cpp
+++ b/src/graphics/engine/engine.cpp
@@ -63,6 +63,7 @@ CEngine::CEngine(CApplication *app)
m_planet = nullptr;
m_sound = nullptr;
m_terrain = nullptr;
+ m_pause = nullptr;
m_showStats = false;
@@ -80,7 +81,6 @@ CEngine::CEngine(CApplication *app)
m_fogStart[1] = 0.75f;
m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f);
- m_pause = false;
m_render = true;
m_movieLock = false;
m_shadowVisible = true;
@@ -179,6 +179,7 @@ CEngine::~CEngine()
m_lightning = nullptr;
m_planet = nullptr;
m_terrain = nullptr;
+ m_pause = nullptr;
GetSystemUtils()->DestroyTimeStamp(m_lastFrameTime);
m_lastFrameTime = nullptr;
@@ -252,6 +253,7 @@ bool CEngine::Create()
m_cloud = new CCloud(this);
m_lightning = new CLightning(this);
m_planet = new CPlanet(this);
+ m_pause = new CPauseManager();
m_lightMan->SetDevice(m_device);
m_particle->SetDevice(m_device);
@@ -422,18 +424,13 @@ void CEngine::FrameUpdate()
bool CEngine::WriteScreenShot(const std::string& fileName, int width, int height)
{
// TODO write screenshot: not very important for now
- GetLogger()->Trace("CEngine::WriteSceenShot(): stub!\n");
+ GetLogger()->Debug("CEngine::WriteSceenShot(): stub!\n");
return true;
}
-void CEngine::SetPause(bool pause)
-{
- m_pause = pause;
-}
-
bool CEngine::GetPause()
{
- return m_pause;
+ return m_pause->GetPause();
}
void CEngine::SetMovieLock(bool lock)
diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h
index 5ecde8f..d56bf38 100644
--- a/src/graphics/engine/engine.h
+++ b/src/graphics/engine/engine.h
@@ -24,6 +24,7 @@
#include "app/system.h"
+#include "app/pausemanager.h"
#include "common/event.h"
#include "common/singleton.h"
@@ -734,11 +735,8 @@ public:
bool WriteScreenShot(const std::string& fileName, int width, int height);
- //@{
- //! Management of game pause mode
- void SetPause(bool pause);
+ //! Get pause mode
TEST_VIRTUAL bool GetPause();
- //@}
//@{
//! Management of lock for the duration of movie sequence
@@ -1288,6 +1286,7 @@ protected:
CLightning* m_lightning;
CPlanet* m_planet;
CTerrain* m_terrain;
+ CPauseManager* m_pause;
//! Last encountered error
std::string m_error;
@@ -1300,9 +1299,6 @@ protected:
//! Whether to show stats (FPS, etc)
bool m_showStats;
std::string m_fpsText;
-
- //! Pause mode
- bool m_pause;
//! Rendering enabled?
bool m_render;
//! Lock for duration of movie?
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 308b172..f1923a5 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -618,6 +618,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
m_cloud = m_engine->GetCloud();
m_lightning = m_engine->GetLightning();
m_planet = m_engine->GetPlanet();
+ m_pause = CPauseManager::GetInstancePointer();
m_interface = new Ui::CInterface();
m_terrain = new Gfx::CTerrain();
@@ -663,7 +664,6 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
m_satComLock = false;
m_editLock = false;
m_editFull = false;
- m_pause = false;
m_hilite = false;
m_freePhoto = false;
m_showPos = false;
@@ -1110,7 +1110,7 @@ void CRobotMain::ChangePhase(Phase phase)
m_resetCreate = false;
m_engine->SetMovieLock(m_movieLock);
- ChangePause(false);
+ ChangePause(PAUSE_NONE);
FlushDisplayInfo();
m_engine->SetRankView(0);
m_terrain->FlushRelief();
@@ -1387,7 +1387,7 @@ bool CRobotMain::ProcessEvent(Event &event)
MainMovieType type = m_movie->GetStopType();
if (type == MM_SATCOMopen)
{
- ChangePause(false);
+ ChangePause(PAUSE_NONE);
SelectObject(m_infoObject, false); // hands over the command buttons
m_map->ShowMap(m_mapShow);
m_displayText->HideText(false);
@@ -1419,7 +1419,7 @@ bool CRobotMain::ProcessEvent(Event &event)
if (pe == nullptr) return false;
pe->SetState(Ui::STATE_VISIBLE);
pe->SetFocus(true);
- if (m_phase == PHASE_SIMUL) ChangePause(true);
+ if (m_phase == PHASE_SIMUL) ChangePause(PAUSE_CHEAT);
m_cmdEdit = true;
return false;
}
@@ -1432,7 +1432,7 @@ bool CRobotMain::ProcessEvent(Event &event)
pe->GetText(cmd, 50);
pe->SetText("");
pe->ClearState(Ui::STATE_VISIBLE);
- if (m_phase == PHASE_SIMUL) ChangePause(false);
+ if (m_phase == PHASE_SIMUL) ChangePause(PAUSE_NONE);
ExecuteCmd(cmd);
m_cmdEdit = false;
return false;
@@ -1562,7 +1562,7 @@ bool CRobotMain::ProcessEvent(Event &event)
m_camera->GetType() != Gfx::CAM_TYPE_VISIT &&
!m_movie->IsExist())
{
- ChangePause(!m_engine->GetPause());
+ ChangePause(m_pause->GetPause(PAUSE_USER) ? PAUSE_NONE : PAUSE_USER);
}
}
if (event.key.key == GetInputBinding(INPUT_SLOT_CAMERA).primary ||
@@ -1891,12 +1891,12 @@ void CRobotMain::ExecuteCmd(char *cmd)
if (m_freePhoto)
{
m_camera->SetType(Gfx::CAM_TYPE_FREE);
- ChangePause(true);
+ ChangePause(PAUSE_PHOTO);
}
else
{
m_camera->SetType(Gfx::CAM_TYPE_BACK);
- ChangePause(false);
+ ChangePause(PAUSE_NONE);
}
return;
}
@@ -1907,7 +1907,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
if (m_freePhoto)
{
m_camera->SetType(Gfx::CAM_TYPE_FREE);
- ChangePause(true);
+ ChangePause(PAUSE_PHOTO);
DeselectAll(); // removes the control buttons
m_map->ShowMap(false);
m_displayText->HideText(true);
@@ -1915,7 +1915,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
else
{
m_camera->SetType(Gfx::CAM_TYPE_BACK);
- ChangePause(false);
+ ChangePause(PAUSE_NONE);
m_map->ShowMap(m_mapShow);
m_displayText->HideText(false);
}
@@ -2174,7 +2174,7 @@ void CRobotMain::StartDisplayInfo(int index, bool movie)
{
m_movieInfoIndex = index;
m_movie->Start(MM_SATCOMopen, 2.5f);
- ChangePause(true);
+ ChangePause(PAUSE_SATCOM);
m_infoObject = DeselectAll(); // removes the control buttons
m_displayText->HideText(true);
return;
@@ -2184,7 +2184,7 @@ void CRobotMain::StartDisplayInfo(int index, bool movie)
if (m_movie->IsExist())
{
m_movie->Stop();
- ChangePause(false);
+ ChangePause(PAUSE_NONE);
SelectObject(m_infoObject, false); // hands over the command buttons
m_displayText->HideText(false);
}
@@ -2476,7 +2476,7 @@ void CRobotMain::StartDisplayVisit(EventType event)
m_camera->StartVisit(m_displayText->GetVisitGoal(event),
m_displayText->GetVisitDist(event));
m_displayText->SetVisit(event);
- ChangePause(true);
+ ChangePause(PAUSE_VISIT);
}
//! Move the arrow to visit
@@ -2530,7 +2530,7 @@ void CRobotMain::StopDisplayVisit()
m_camera->StopVisit();
m_displayText->ClearVisit();
- ChangePause(false);
+ ChangePause(PAUSE_NONE);
if (m_visitObject != 0)
{
SelectObject(m_visitObject, false); // gives the command buttons
@@ -2628,7 +2628,7 @@ bool CRobotMain::SelectObject(CObject* obj, bool displayError)
if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT)
StopDisplayVisit();
- if (m_movieLock || m_editLock || m_pause) return false;
+ if (m_movieLock || m_editLock || m_pause->GetPause()) return false;
if (m_movie->IsExist()) return false;
if (obj == nullptr || !IsSelectable(obj)) return false;
@@ -3530,7 +3530,7 @@ bool CRobotMain::EventFrame(const Event &event)
}
// Moves edition indicator.
- if (m_editLock || m_pause) // edition in progress?
+ if (m_editLock || m_pause->GetPause()) // edition in progress?
{
Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_EDITLOCK);
if (pc != nullptr)
@@ -7022,14 +7022,16 @@ float CRobotMain::GetPersoAngle()
//! Changes on the pause mode
-void CRobotMain::ChangePause(bool pause)
+void CRobotMain::ChangePause(PauseType pause)
{
- m_pause = pause;
- m_engine->SetPause(m_pause);
+ if(pause != PAUSE_NONE)
+ m_pause->SetPause(pause);
+ else
+ m_pause->ClearPause();
- m_sound->MuteAll(m_pause);
+ m_sound->MuteAll(m_pause->GetPause());
CreateShortcuts();
- if (m_pause) HiliteClear();
+ if (m_pause->GetPause()) HiliteClear();
}
diff --git a/src/object/robotmain.h b/src/object/robotmain.h
index 8d58adb..4fa842a 100644
--- a/src/object/robotmain.h
+++ b/src/object/robotmain.h
@@ -30,6 +30,8 @@
#include "object/object.h"
#include "object/mainmovie.h"
+#include "app/pausemanager.h"
+
#include <stdio.h>
enum Phase
@@ -253,7 +255,7 @@ public:
void SetTracePrecision(float factor);
float GetTracePrecision();
- void ChangePause(bool pause);
+ void ChangePause(PauseType pause);
void SetSpeed(float speed);
float GetSpeed();
@@ -440,6 +442,7 @@ protected:
Ui::CDisplayText* m_displayText;
Ui::CDisplayInfo* m_displayInfo;
CSoundInterface* m_sound;
+ CPauseManager* m_pause;
//! Bindings for user inputs
InputBinding m_inputBindings[INPUT_SLOT_MAX];
@@ -495,7 +498,6 @@ protected:
bool m_satComLock; // call of SatCom is possible?
bool m_editLock; // edition in progress?
bool m_editFull; // edition in full screen?
- bool m_pause; // simulation paused
bool m_hilite;
bool m_trainerPilot; // remote trainer?
bool m_suspend;
diff --git a/src/script/script.cpp b/src/script/script.cpp
index 0518479..0b3eec4 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -3423,6 +3423,7 @@ CScript::CScript(CObject* object, CTaskManager** secondaryTask)
m_secondaryTask = secondaryTask;
m_interface = m_main->GetInterface();
+ m_pause = CPauseManager::GetInstancePointer();
m_ipf = CBOT_IPF;
m_errMode = ERM_STOP;
@@ -3821,12 +3822,12 @@ bool CScript::Continue(const Event &event)
GetError(s);
m_main->GetDisplayText()->DisplayText(s.c_str(), m_object, 10.0f, Ui::TT_ERROR);
}
- m_engine->SetPause(true); // gives pause
+ m_pause->SetPause(PAUSE_EDITOR); // gives pause
return true;
}
if ( !m_bContinue )
{
- m_engine->SetPause(true); // gives pause
+ m_pause->SetPause(PAUSE_EDITOR); // gives pause
}
}
@@ -3869,9 +3870,9 @@ bool CScript::Step(const Event &event)
if ( !m_bRun ) return true;
if ( !m_bStepMode ) return false;
- m_engine->SetPause(false);
+ // ??? m_engine->SetPause(false);
// TODO: m_app StepSimulation??? m_engine->StepSimulation(0.01f); // advance of 10ms
- m_engine->SetPause(true);
+ // ??? m_engine->SetPause(true);
m_event = event;
@@ -3901,7 +3902,7 @@ bool CScript::Step(const Event &event)
if ( m_bContinue ) // instuction "move", "goto", etc. ?
{
- m_engine->SetPause(false); // removes the pause
+ m_pause->ClearPause(); // removes the pause
}
return false;
}
diff --git a/src/script/script.h b/src/script/script.h
index 9d8d372..177d40a 100644
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -24,6 +24,8 @@
#include "common/event.h"
+#include "app/pausemanager.h"
+
#include "CBot/CBotDll.h"
#include <stdio.h>
@@ -217,6 +219,7 @@ protected:
CTaskManager* m_primaryTask;
CTaskManager** m_secondaryTask;
CObject* m_object;
+ CPauseManager* m_pause;
int m_ipf; // number of instructions/second
int m_errMode; // what to do in case of error
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index 79eb38a..8db53c5 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -59,6 +59,7 @@ CDisplayInfo::CDisplayInfo()
m_main = CRobotMain::GetInstancePointer();
m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera();
+ m_pause = CPauseManager::GetInstancePointer();
m_bInfoMaximized = true;
m_bInfoMinimized = false;
@@ -330,13 +331,13 @@ void CDisplayInfo::HyperUpdate()
void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluce)
{
- Gfx::Light light;
+ Gfx::Light light;
Math::Point pos, dim;
Ui::CWindow* pw;
Ui::CEdit* edit;
Ui::CButton* button;
Ui::CSlider* slider;
- CMotionToto* toto;
+ CMotionToto* toto;
m_index = index;
m_bSoluce = bSoluce;
@@ -355,8 +356,8 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
m_main->SetEditLock(true, false);
m_main->SetEditFull(false);
- m_bInitPause = m_engine->GetPause();
- m_engine->SetPause(true);
+ m_bInitPause = m_pause->GetPauseType();
+ m_pause->SetPause(PAUSE_SATCOM);
m_infoCamera = m_camera->GetType();
m_camera->SetType(Gfx::CAM_TYPE_INFO);
@@ -839,7 +840,7 @@ void CDisplayInfo::StopDisplayInfo()
}
else
{
- if ( !m_bInitPause ) m_engine->SetPause(false);
+ m_pause->SetPause(m_bInitPause);
m_main->SetEditLock(false, false);
}
m_camera->SetType(m_infoCamera);
diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h
index eea50b7..891551b 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -25,6 +25,8 @@
#include "graphics/engine/camera.h"
+#include "app/pausemanager.h"
+
class CRobotMain;
class CObject;
class CEventQueue;
@@ -67,13 +69,14 @@ protected:
void CreateObjectsFile();
protected:
- Gfx::CEngine* m_engine;
- CEventQueue* m_event;
- CRobotMain* m_main;
- Gfx::CCamera* m_camera;
- CInterface* m_interface;
- Gfx::CParticle* m_particle;
- Gfx::CLightManager* m_light;
+ Gfx::CEngine* m_engine;
+ CEventQueue* m_event;
+ CRobotMain* m_main;
+ Gfx::CCamera* m_camera;
+ CInterface* m_interface;
+ Gfx::CParticle* m_particle;
+ Gfx::CLightManager* m_light;
+ CPauseManager* m_pause;
bool m_bInfoMaximized;
bool m_bInfoMinimized;
@@ -88,7 +91,7 @@ protected:
Math::Point m_infoFinalDim;
int m_lightSuppl;
bool m_bEditLock;
- bool m_bInitPause;
+ PauseType m_bInitPause;
bool m_bSoluce;
CObject* m_toto;
};
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index f3eca3a..b954c71 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -120,6 +120,7 @@ CMainDialog::CMainDialog()
m_camera = m_main->GetCamera();
m_engine = Gfx::CEngine::GetInstancePointer();
m_particle = m_engine->GetParticle();
+ m_pause = CPauseManager::GetInstancePointer();
m_phase = PHASE_NAME;
m_phaseSetup = PHASE_SETUPg;
@@ -6401,8 +6402,8 @@ void CMainDialog::StartSuspend()
{
m_sound->MuteAll(true);
m_main->ClearInterface();
- m_bInitPause = m_engine->GetPause();
- m_engine->SetPause(true);
+ m_bInitPause = m_pause->GetPauseType();
+ m_pause->SetPause(PAUSE_DIALOG);
m_engine->SetOverFront(false); // over flat behind
m_main->CreateShortcuts();
m_main->StartSuspend();
@@ -6416,7 +6417,7 @@ void CMainDialog::StopSuspend()
{
m_sound->MuteAll(false);
m_main->ClearInterface();
- if ( !m_bInitPause ) m_engine->SetPause(false);
+ m_pause->SetPause(m_bInitPause);
m_engine->SetOverFront(true); // over flat front
m_main->CreateShortcuts();
m_main->StopSuspend();
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index 96aff2a..444a568 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -23,6 +23,8 @@
#include "object/robotmain.h"
+#include "app/pausemanager.h"
+
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
@@ -186,6 +188,7 @@ protected:
Gfx::CParticle* m_particle;
Gfx::CCamera* m_camera;
CSoundInterface* m_sound;
+ CPauseManager* m_pause;
Phase m_phase; // copy of CRobotMain
Phase m_phaseSetup; // tab selected
@@ -242,26 +245,26 @@ protected:
bool m_bCameraInvertY; // for CCamera
bool m_bEffect; // for CCamera
- Math::Point m_glintMouse;
- float m_glintTime;
+ Math::Point m_glintMouse;
+ float m_glintTime;
- int m_loadingCounter;
+ int m_loadingCounter;
- bool m_bDialog; // this dialogue?
- bool m_bDialogFire; // setting on fire?
- bool m_bDialogDelete;
- Math::Point m_dialogPos;
- Math::Point m_dialogDim;
- float m_dialogParti;
- float m_dialogTime;
- bool m_bInitPause;
+ bool m_bDialog; // this dialogue?
+ bool m_bDialogFire; // setting on fire?
+ bool m_bDialogDelete;
+ Math::Point m_dialogPos;
+ Math::Point m_dialogDim;
+ float m_dialogParti;
+ float m_dialogTime;
+ PauseType m_bInitPause;
Gfx::CameraType m_initCamera;
- int m_partiPhase[10];
- float m_partiTime[10];
- Math::Point m_partiPos[10];
+ int m_partiPhase[10];
+ float m_partiTime[10];
+ Math::Point m_partiPos[10];
- SceneInfo m_sceneInfo[MAXSCENE];
+ SceneInfo m_sceneInfo[MAXSCENE];
std::vector<fs::path> m_saveList;
};
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index fb4dd3d..5a3b403 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -71,6 +71,7 @@ CStudio::CStudio()
m_main = CRobotMain::GetInstancePointer();
m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera();
+ m_pause = CPauseManager::GetInstancePointer();
m_bEditMaximized = false;
m_bEditMinimized = false;
@@ -563,7 +564,7 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank)
m_main->SetEditLock(true, true);
m_main->SetEditFull(false);
- m_bInitPause = m_engine->GetPause();
+ m_bInitPause = m_pause->GetPauseType();
m_main->SetSpeed(1.0f);
m_editCamera = m_camera->GetType();
m_camera->SetType(Gfx::CAM_TYPE_EDIT);
@@ -882,7 +883,7 @@ bool CStudio::StopEditScript(bool bCancel)
button->SetState(STATE_VISIBLE);
}
- if ( !m_bInitPause ) m_engine->SetPause(false);
+ m_pause->SetPause(m_bInitPause);
m_sound->MuteAll(false);
m_main->SetEditLock(false, true);
m_camera->SetType(m_editCamera);
@@ -954,22 +955,22 @@ void CStudio::UpdateFlux()
#if 1
if ( m_bRealTime ) // run?
{
- m_engine->SetPause(false);
+ m_pause->ClearPause();
m_sound->MuteAll(false);
}
else // step by step?
{
- m_engine->SetPause(true);
+ m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true);
}
#else
- m_engine->SetPause(false);
+ m_pause->ClearPause();
m_sound->MuteAll(false);
#endif
}
else // stop?
{
- m_engine->SetPause(true);
+ m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true);
}
}
diff --git a/src/ui/studio.h b/src/ui/studio.h
index 1c14124..d1c6a51 100644
--- a/src/ui/studio.h
+++ b/src/ui/studio.h
@@ -22,6 +22,8 @@
#include "graphics/engine/camera.h"
+#include "app/pausemanager.h"
+
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
@@ -96,6 +98,7 @@ protected:
CSoundInterface* m_sound;
CInterface* m_interface;
CApplication* m_app;
+ CPauseManager* m_pause;
int m_rank;
CScript* m_script;
@@ -109,11 +112,11 @@ protected:
Math::Point m_editFinalPos;
Math::Point m_editFinalDim;
- float m_time;
- float m_fixInfoTextTime;
- bool m_bRunning;
- bool m_bRealTime;
- bool m_bInitPause;
+ float m_time;
+ float m_fixInfoTextTime;
+ bool m_bRunning;
+ bool m_bRealTime;
+ PauseType m_bInitPause;
std::string m_helpFilename;
StudioDialog m_dialog;