CPauseManager
parent
3536f1c7cc
commit
4a237f5925
|
@ -65,6 +65,7 @@ app/main.cpp
|
||||||
app/system.cpp
|
app/system.cpp
|
||||||
app/${SYSTEM_CPP_MODULE}
|
app/${SYSTEM_CPP_MODULE}
|
||||||
app/system_other.cpp
|
app/system_other.cpp
|
||||||
|
app/pausemanager.cpp
|
||||||
common/event.cpp
|
common/event.cpp
|
||||||
common/image.cpp
|
common/image.cpp
|
||||||
common/iman.cpp
|
common/iman.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
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
};
|
||||||
|
|
|
@ -63,6 +63,7 @@ CEngine::CEngine(CApplication *app)
|
||||||
m_planet = nullptr;
|
m_planet = nullptr;
|
||||||
m_sound = nullptr;
|
m_sound = nullptr;
|
||||||
m_terrain = nullptr;
|
m_terrain = nullptr;
|
||||||
|
m_pause = nullptr;
|
||||||
|
|
||||||
m_showStats = false;
|
m_showStats = false;
|
||||||
|
|
||||||
|
@ -80,7 +81,6 @@ CEngine::CEngine(CApplication *app)
|
||||||
m_fogStart[1] = 0.75f;
|
m_fogStart[1] = 0.75f;
|
||||||
m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f);
|
m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
m_pause = false;
|
|
||||||
m_render = true;
|
m_render = true;
|
||||||
m_movieLock = false;
|
m_movieLock = false;
|
||||||
m_shadowVisible = true;
|
m_shadowVisible = true;
|
||||||
|
@ -179,6 +179,7 @@ CEngine::~CEngine()
|
||||||
m_lightning = nullptr;
|
m_lightning = nullptr;
|
||||||
m_planet = nullptr;
|
m_planet = nullptr;
|
||||||
m_terrain = nullptr;
|
m_terrain = nullptr;
|
||||||
|
m_pause = nullptr;
|
||||||
|
|
||||||
GetSystemUtils()->DestroyTimeStamp(m_lastFrameTime);
|
GetSystemUtils()->DestroyTimeStamp(m_lastFrameTime);
|
||||||
m_lastFrameTime = nullptr;
|
m_lastFrameTime = nullptr;
|
||||||
|
@ -252,6 +253,7 @@ bool CEngine::Create()
|
||||||
m_cloud = new CCloud(this);
|
m_cloud = new CCloud(this);
|
||||||
m_lightning = new CLightning(this);
|
m_lightning = new CLightning(this);
|
||||||
m_planet = new CPlanet(this);
|
m_planet = new CPlanet(this);
|
||||||
|
m_pause = new CPauseManager();
|
||||||
|
|
||||||
m_lightMan->SetDevice(m_device);
|
m_lightMan->SetDevice(m_device);
|
||||||
m_particle->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)
|
bool CEngine::WriteScreenShot(const std::string& fileName, int width, int height)
|
||||||
{
|
{
|
||||||
// TODO write screenshot: not very important for now
|
// TODO write screenshot: not very important for now
|
||||||
GetLogger()->Trace("CEngine::WriteSceenShot(): stub!\n");
|
GetLogger()->Debug("CEngine::WriteSceenShot(): stub!\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEngine::SetPause(bool pause)
|
|
||||||
{
|
|
||||||
m_pause = pause;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CEngine::GetPause()
|
bool CEngine::GetPause()
|
||||||
{
|
{
|
||||||
return m_pause;
|
return m_pause->GetPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEngine::SetMovieLock(bool lock)
|
void CEngine::SetMovieLock(bool lock)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "app/system.h"
|
#include "app/system.h"
|
||||||
|
#include "app/pausemanager.h"
|
||||||
|
|
||||||
#include "common/event.h"
|
#include "common/event.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
|
@ -734,11 +735,8 @@ public:
|
||||||
bool WriteScreenShot(const std::string& fileName, int width, int height);
|
bool WriteScreenShot(const std::string& fileName, int width, int height);
|
||||||
|
|
||||||
|
|
||||||
//@{
|
//! Get pause mode
|
||||||
//! Management of game pause mode
|
|
||||||
void SetPause(bool pause);
|
|
||||||
TEST_VIRTUAL bool GetPause();
|
TEST_VIRTUAL bool GetPause();
|
||||||
//@}
|
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
//! Management of lock for the duration of movie sequence
|
//! Management of lock for the duration of movie sequence
|
||||||
|
@ -1288,6 +1286,7 @@ protected:
|
||||||
CLightning* m_lightning;
|
CLightning* m_lightning;
|
||||||
CPlanet* m_planet;
|
CPlanet* m_planet;
|
||||||
CTerrain* m_terrain;
|
CTerrain* m_terrain;
|
||||||
|
CPauseManager* m_pause;
|
||||||
|
|
||||||
//! Last encountered error
|
//! Last encountered error
|
||||||
std::string m_error;
|
std::string m_error;
|
||||||
|
@ -1300,9 +1299,6 @@ protected:
|
||||||
//! Whether to show stats (FPS, etc)
|
//! Whether to show stats (FPS, etc)
|
||||||
bool m_showStats;
|
bool m_showStats;
|
||||||
std::string m_fpsText;
|
std::string m_fpsText;
|
||||||
|
|
||||||
//! Pause mode
|
|
||||||
bool m_pause;
|
|
||||||
//! Rendering enabled?
|
//! Rendering enabled?
|
||||||
bool m_render;
|
bool m_render;
|
||||||
//! Lock for duration of movie?
|
//! Lock for duration of movie?
|
||||||
|
|
|
@ -618,6 +618,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
||||||
m_cloud = m_engine->GetCloud();
|
m_cloud = m_engine->GetCloud();
|
||||||
m_lightning = m_engine->GetLightning();
|
m_lightning = m_engine->GetLightning();
|
||||||
m_planet = m_engine->GetPlanet();
|
m_planet = m_engine->GetPlanet();
|
||||||
|
m_pause = CPauseManager::GetInstancePointer();
|
||||||
|
|
||||||
m_interface = new Ui::CInterface();
|
m_interface = new Ui::CInterface();
|
||||||
m_terrain = new Gfx::CTerrain();
|
m_terrain = new Gfx::CTerrain();
|
||||||
|
@ -663,7 +664,6 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
||||||
m_satComLock = false;
|
m_satComLock = false;
|
||||||
m_editLock = false;
|
m_editLock = false;
|
||||||
m_editFull = false;
|
m_editFull = false;
|
||||||
m_pause = false;
|
|
||||||
m_hilite = false;
|
m_hilite = false;
|
||||||
m_freePhoto = false;
|
m_freePhoto = false;
|
||||||
m_showPos = false;
|
m_showPos = false;
|
||||||
|
@ -1110,7 +1110,7 @@ void CRobotMain::ChangePhase(Phase phase)
|
||||||
m_resetCreate = false;
|
m_resetCreate = false;
|
||||||
|
|
||||||
m_engine->SetMovieLock(m_movieLock);
|
m_engine->SetMovieLock(m_movieLock);
|
||||||
ChangePause(false);
|
ChangePause(PAUSE_NONE);
|
||||||
FlushDisplayInfo();
|
FlushDisplayInfo();
|
||||||
m_engine->SetRankView(0);
|
m_engine->SetRankView(0);
|
||||||
m_terrain->FlushRelief();
|
m_terrain->FlushRelief();
|
||||||
|
@ -1387,7 +1387,7 @@ bool CRobotMain::ProcessEvent(Event &event)
|
||||||
MainMovieType type = m_movie->GetStopType();
|
MainMovieType type = m_movie->GetStopType();
|
||||||
if (type == MM_SATCOMopen)
|
if (type == MM_SATCOMopen)
|
||||||
{
|
{
|
||||||
ChangePause(false);
|
ChangePause(PAUSE_NONE);
|
||||||
SelectObject(m_infoObject, false); // hands over the command buttons
|
SelectObject(m_infoObject, false); // hands over the command buttons
|
||||||
m_map->ShowMap(m_mapShow);
|
m_map->ShowMap(m_mapShow);
|
||||||
m_displayText->HideText(false);
|
m_displayText->HideText(false);
|
||||||
|
@ -1419,7 +1419,7 @@ bool CRobotMain::ProcessEvent(Event &event)
|
||||||
if (pe == nullptr) return false;
|
if (pe == nullptr) return false;
|
||||||
pe->SetState(Ui::STATE_VISIBLE);
|
pe->SetState(Ui::STATE_VISIBLE);
|
||||||
pe->SetFocus(true);
|
pe->SetFocus(true);
|
||||||
if (m_phase == PHASE_SIMUL) ChangePause(true);
|
if (m_phase == PHASE_SIMUL) ChangePause(PAUSE_CHEAT);
|
||||||
m_cmdEdit = true;
|
m_cmdEdit = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1432,7 +1432,7 @@ bool CRobotMain::ProcessEvent(Event &event)
|
||||||
pe->GetText(cmd, 50);
|
pe->GetText(cmd, 50);
|
||||||
pe->SetText("");
|
pe->SetText("");
|
||||||
pe->ClearState(Ui::STATE_VISIBLE);
|
pe->ClearState(Ui::STATE_VISIBLE);
|
||||||
if (m_phase == PHASE_SIMUL) ChangePause(false);
|
if (m_phase == PHASE_SIMUL) ChangePause(PAUSE_NONE);
|
||||||
ExecuteCmd(cmd);
|
ExecuteCmd(cmd);
|
||||||
m_cmdEdit = false;
|
m_cmdEdit = false;
|
||||||
return false;
|
return false;
|
||||||
|
@ -1562,7 +1562,7 @@ bool CRobotMain::ProcessEvent(Event &event)
|
||||||
m_camera->GetType() != Gfx::CAM_TYPE_VISIT &&
|
m_camera->GetType() != Gfx::CAM_TYPE_VISIT &&
|
||||||
!m_movie->IsExist())
|
!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 ||
|
if (event.key.key == GetInputBinding(INPUT_SLOT_CAMERA).primary ||
|
||||||
|
@ -1891,12 +1891,12 @@ void CRobotMain::ExecuteCmd(char *cmd)
|
||||||
if (m_freePhoto)
|
if (m_freePhoto)
|
||||||
{
|
{
|
||||||
m_camera->SetType(Gfx::CAM_TYPE_FREE);
|
m_camera->SetType(Gfx::CAM_TYPE_FREE);
|
||||||
ChangePause(true);
|
ChangePause(PAUSE_PHOTO);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
||||||
ChangePause(false);
|
ChangePause(PAUSE_NONE);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1907,7 +1907,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
|
||||||
if (m_freePhoto)
|
if (m_freePhoto)
|
||||||
{
|
{
|
||||||
m_camera->SetType(Gfx::CAM_TYPE_FREE);
|
m_camera->SetType(Gfx::CAM_TYPE_FREE);
|
||||||
ChangePause(true);
|
ChangePause(PAUSE_PHOTO);
|
||||||
DeselectAll(); // removes the control buttons
|
DeselectAll(); // removes the control buttons
|
||||||
m_map->ShowMap(false);
|
m_map->ShowMap(false);
|
||||||
m_displayText->HideText(true);
|
m_displayText->HideText(true);
|
||||||
|
@ -1915,7 +1915,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
||||||
ChangePause(false);
|
ChangePause(PAUSE_NONE);
|
||||||
m_map->ShowMap(m_mapShow);
|
m_map->ShowMap(m_mapShow);
|
||||||
m_displayText->HideText(false);
|
m_displayText->HideText(false);
|
||||||
}
|
}
|
||||||
|
@ -2174,7 +2174,7 @@ void CRobotMain::StartDisplayInfo(int index, bool movie)
|
||||||
{
|
{
|
||||||
m_movieInfoIndex = index;
|
m_movieInfoIndex = index;
|
||||||
m_movie->Start(MM_SATCOMopen, 2.5f);
|
m_movie->Start(MM_SATCOMopen, 2.5f);
|
||||||
ChangePause(true);
|
ChangePause(PAUSE_SATCOM);
|
||||||
m_infoObject = DeselectAll(); // removes the control buttons
|
m_infoObject = DeselectAll(); // removes the control buttons
|
||||||
m_displayText->HideText(true);
|
m_displayText->HideText(true);
|
||||||
return;
|
return;
|
||||||
|
@ -2184,7 +2184,7 @@ void CRobotMain::StartDisplayInfo(int index, bool movie)
|
||||||
if (m_movie->IsExist())
|
if (m_movie->IsExist())
|
||||||
{
|
{
|
||||||
m_movie->Stop();
|
m_movie->Stop();
|
||||||
ChangePause(false);
|
ChangePause(PAUSE_NONE);
|
||||||
SelectObject(m_infoObject, false); // hands over the command buttons
|
SelectObject(m_infoObject, false); // hands over the command buttons
|
||||||
m_displayText->HideText(false);
|
m_displayText->HideText(false);
|
||||||
}
|
}
|
||||||
|
@ -2476,7 +2476,7 @@ void CRobotMain::StartDisplayVisit(EventType event)
|
||||||
m_camera->StartVisit(m_displayText->GetVisitGoal(event),
|
m_camera->StartVisit(m_displayText->GetVisitGoal(event),
|
||||||
m_displayText->GetVisitDist(event));
|
m_displayText->GetVisitDist(event));
|
||||||
m_displayText->SetVisit(event);
|
m_displayText->SetVisit(event);
|
||||||
ChangePause(true);
|
ChangePause(PAUSE_VISIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Move the arrow to visit
|
//! Move the arrow to visit
|
||||||
|
@ -2530,7 +2530,7 @@ void CRobotMain::StopDisplayVisit()
|
||||||
|
|
||||||
m_camera->StopVisit();
|
m_camera->StopVisit();
|
||||||
m_displayText->ClearVisit();
|
m_displayText->ClearVisit();
|
||||||
ChangePause(false);
|
ChangePause(PAUSE_NONE);
|
||||||
if (m_visitObject != 0)
|
if (m_visitObject != 0)
|
||||||
{
|
{
|
||||||
SelectObject(m_visitObject, false); // gives the command buttons
|
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)
|
if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT)
|
||||||
StopDisplayVisit();
|
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 (m_movie->IsExist()) return false;
|
||||||
if (obj == nullptr || !IsSelectable(obj)) return false;
|
if (obj == nullptr || !IsSelectable(obj)) return false;
|
||||||
|
|
||||||
|
@ -3530,7 +3530,7 @@ bool CRobotMain::EventFrame(const Event &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moves edition indicator.
|
// 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);
|
Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_EDITLOCK);
|
||||||
if (pc != nullptr)
|
if (pc != nullptr)
|
||||||
|
@ -7022,14 +7022,16 @@ float CRobotMain::GetPersoAngle()
|
||||||
|
|
||||||
|
|
||||||
//! Changes on the pause mode
|
//! Changes on the pause mode
|
||||||
void CRobotMain::ChangePause(bool pause)
|
void CRobotMain::ChangePause(PauseType pause)
|
||||||
{
|
{
|
||||||
m_pause = pause;
|
if(pause != PAUSE_NONE)
|
||||||
m_engine->SetPause(m_pause);
|
m_pause->SetPause(pause);
|
||||||
|
else
|
||||||
|
m_pause->ClearPause();
|
||||||
|
|
||||||
m_sound->MuteAll(m_pause);
|
m_sound->MuteAll(m_pause->GetPause());
|
||||||
CreateShortcuts();
|
CreateShortcuts();
|
||||||
if (m_pause) HiliteClear();
|
if (m_pause->GetPause()) HiliteClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "object/object.h"
|
#include "object/object.h"
|
||||||
#include "object/mainmovie.h"
|
#include "object/mainmovie.h"
|
||||||
|
|
||||||
|
#include "app/pausemanager.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
enum Phase
|
enum Phase
|
||||||
|
@ -253,7 +255,7 @@ public:
|
||||||
void SetTracePrecision(float factor);
|
void SetTracePrecision(float factor);
|
||||||
float GetTracePrecision();
|
float GetTracePrecision();
|
||||||
|
|
||||||
void ChangePause(bool pause);
|
void ChangePause(PauseType pause);
|
||||||
|
|
||||||
void SetSpeed(float speed);
|
void SetSpeed(float speed);
|
||||||
float GetSpeed();
|
float GetSpeed();
|
||||||
|
@ -440,6 +442,7 @@ protected:
|
||||||
Ui::CDisplayText* m_displayText;
|
Ui::CDisplayText* m_displayText;
|
||||||
Ui::CDisplayInfo* m_displayInfo;
|
Ui::CDisplayInfo* m_displayInfo;
|
||||||
CSoundInterface* m_sound;
|
CSoundInterface* m_sound;
|
||||||
|
CPauseManager* m_pause;
|
||||||
|
|
||||||
//! Bindings for user inputs
|
//! Bindings for user inputs
|
||||||
InputBinding m_inputBindings[INPUT_SLOT_MAX];
|
InputBinding m_inputBindings[INPUT_SLOT_MAX];
|
||||||
|
@ -495,7 +498,6 @@ protected:
|
||||||
bool m_satComLock; // call of SatCom is possible?
|
bool m_satComLock; // call of SatCom is possible?
|
||||||
bool m_editLock; // edition in progress?
|
bool m_editLock; // edition in progress?
|
||||||
bool m_editFull; // edition in full screen?
|
bool m_editFull; // edition in full screen?
|
||||||
bool m_pause; // simulation paused
|
|
||||||
bool m_hilite;
|
bool m_hilite;
|
||||||
bool m_trainerPilot; // remote trainer?
|
bool m_trainerPilot; // remote trainer?
|
||||||
bool m_suspend;
|
bool m_suspend;
|
||||||
|
|
|
@ -3423,6 +3423,7 @@ CScript::CScript(CObject* object, CTaskManager** secondaryTask)
|
||||||
m_secondaryTask = secondaryTask;
|
m_secondaryTask = secondaryTask;
|
||||||
|
|
||||||
m_interface = m_main->GetInterface();
|
m_interface = m_main->GetInterface();
|
||||||
|
m_pause = CPauseManager::GetInstancePointer();
|
||||||
|
|
||||||
m_ipf = CBOT_IPF;
|
m_ipf = CBOT_IPF;
|
||||||
m_errMode = ERM_STOP;
|
m_errMode = ERM_STOP;
|
||||||
|
@ -3821,12 +3822,12 @@ bool CScript::Continue(const Event &event)
|
||||||
GetError(s);
|
GetError(s);
|
||||||
m_main->GetDisplayText()->DisplayText(s.c_str(), m_object, 10.0f, Ui::TT_ERROR);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
if ( !m_bContinue )
|
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_bRun ) return true;
|
||||||
if ( !m_bStepMode ) return false;
|
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
|
// TODO: m_app StepSimulation??? m_engine->StepSimulation(0.01f); // advance of 10ms
|
||||||
m_engine->SetPause(true);
|
// ??? m_engine->SetPause(true);
|
||||||
|
|
||||||
m_event = event;
|
m_event = event;
|
||||||
|
|
||||||
|
@ -3901,7 +3902,7 @@ bool CScript::Step(const Event &event)
|
||||||
|
|
||||||
if ( m_bContinue ) // instuction "move", "goto", etc. ?
|
if ( m_bContinue ) // instuction "move", "goto", etc. ?
|
||||||
{
|
{
|
||||||
m_engine->SetPause(false); // removes the pause
|
m_pause->ClearPause(); // removes the pause
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#include "common/event.h"
|
#include "common/event.h"
|
||||||
|
|
||||||
|
#include "app/pausemanager.h"
|
||||||
|
|
||||||
#include "CBot/CBotDll.h"
|
#include "CBot/CBotDll.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -217,6 +219,7 @@ protected:
|
||||||
CTaskManager* m_primaryTask;
|
CTaskManager* m_primaryTask;
|
||||||
CTaskManager** m_secondaryTask;
|
CTaskManager** m_secondaryTask;
|
||||||
CObject* m_object;
|
CObject* m_object;
|
||||||
|
CPauseManager* m_pause;
|
||||||
|
|
||||||
int m_ipf; // number of instructions/second
|
int m_ipf; // number of instructions/second
|
||||||
int m_errMode; // what to do in case of error
|
int m_errMode; // what to do in case of error
|
||||||
|
|
|
@ -59,6 +59,7 @@ CDisplayInfo::CDisplayInfo()
|
||||||
m_main = CRobotMain::GetInstancePointer();
|
m_main = CRobotMain::GetInstancePointer();
|
||||||
m_interface = m_main->GetInterface();
|
m_interface = m_main->GetInterface();
|
||||||
m_camera = m_main->GetCamera();
|
m_camera = m_main->GetCamera();
|
||||||
|
m_pause = CPauseManager::GetInstancePointer();
|
||||||
|
|
||||||
m_bInfoMaximized = true;
|
m_bInfoMaximized = true;
|
||||||
m_bInfoMinimized = false;
|
m_bInfoMinimized = false;
|
||||||
|
@ -355,8 +356,8 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
|
||||||
|
|
||||||
m_main->SetEditLock(true, false);
|
m_main->SetEditLock(true, false);
|
||||||
m_main->SetEditFull(false);
|
m_main->SetEditFull(false);
|
||||||
m_bInitPause = m_engine->GetPause();
|
m_bInitPause = m_pause->GetPauseType();
|
||||||
m_engine->SetPause(true);
|
m_pause->SetPause(PAUSE_SATCOM);
|
||||||
m_infoCamera = m_camera->GetType();
|
m_infoCamera = m_camera->GetType();
|
||||||
m_camera->SetType(Gfx::CAM_TYPE_INFO);
|
m_camera->SetType(Gfx::CAM_TYPE_INFO);
|
||||||
|
|
||||||
|
@ -839,7 +840,7 @@ void CDisplayInfo::StopDisplayInfo()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !m_bInitPause ) m_engine->SetPause(false);
|
m_pause->SetPause(m_bInitPause);
|
||||||
m_main->SetEditLock(false, false);
|
m_main->SetEditLock(false, false);
|
||||||
}
|
}
|
||||||
m_camera->SetType(m_infoCamera);
|
m_camera->SetType(m_infoCamera);
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "graphics/engine/camera.h"
|
#include "graphics/engine/camera.h"
|
||||||
|
|
||||||
|
#include "app/pausemanager.h"
|
||||||
|
|
||||||
class CRobotMain;
|
class CRobotMain;
|
||||||
class CObject;
|
class CObject;
|
||||||
class CEventQueue;
|
class CEventQueue;
|
||||||
|
@ -74,6 +76,7 @@ protected:
|
||||||
CInterface* m_interface;
|
CInterface* m_interface;
|
||||||
Gfx::CParticle* m_particle;
|
Gfx::CParticle* m_particle;
|
||||||
Gfx::CLightManager* m_light;
|
Gfx::CLightManager* m_light;
|
||||||
|
CPauseManager* m_pause;
|
||||||
|
|
||||||
bool m_bInfoMaximized;
|
bool m_bInfoMaximized;
|
||||||
bool m_bInfoMinimized;
|
bool m_bInfoMinimized;
|
||||||
|
@ -88,7 +91,7 @@ protected:
|
||||||
Math::Point m_infoFinalDim;
|
Math::Point m_infoFinalDim;
|
||||||
int m_lightSuppl;
|
int m_lightSuppl;
|
||||||
bool m_bEditLock;
|
bool m_bEditLock;
|
||||||
bool m_bInitPause;
|
PauseType m_bInitPause;
|
||||||
bool m_bSoluce;
|
bool m_bSoluce;
|
||||||
CObject* m_toto;
|
CObject* m_toto;
|
||||||
};
|
};
|
||||||
|
|
|
@ -120,6 +120,7 @@ CMainDialog::CMainDialog()
|
||||||
m_camera = m_main->GetCamera();
|
m_camera = m_main->GetCamera();
|
||||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||||
m_particle = m_engine->GetParticle();
|
m_particle = m_engine->GetParticle();
|
||||||
|
m_pause = CPauseManager::GetInstancePointer();
|
||||||
|
|
||||||
m_phase = PHASE_NAME;
|
m_phase = PHASE_NAME;
|
||||||
m_phaseSetup = PHASE_SETUPg;
|
m_phaseSetup = PHASE_SETUPg;
|
||||||
|
@ -6401,8 +6402,8 @@ void CMainDialog::StartSuspend()
|
||||||
{
|
{
|
||||||
m_sound->MuteAll(true);
|
m_sound->MuteAll(true);
|
||||||
m_main->ClearInterface();
|
m_main->ClearInterface();
|
||||||
m_bInitPause = m_engine->GetPause();
|
m_bInitPause = m_pause->GetPauseType();
|
||||||
m_engine->SetPause(true);
|
m_pause->SetPause(PAUSE_DIALOG);
|
||||||
m_engine->SetOverFront(false); // over flat behind
|
m_engine->SetOverFront(false); // over flat behind
|
||||||
m_main->CreateShortcuts();
|
m_main->CreateShortcuts();
|
||||||
m_main->StartSuspend();
|
m_main->StartSuspend();
|
||||||
|
@ -6416,7 +6417,7 @@ void CMainDialog::StopSuspend()
|
||||||
{
|
{
|
||||||
m_sound->MuteAll(false);
|
m_sound->MuteAll(false);
|
||||||
m_main->ClearInterface();
|
m_main->ClearInterface();
|
||||||
if ( !m_bInitPause ) m_engine->SetPause(false);
|
m_pause->SetPause(m_bInitPause);
|
||||||
m_engine->SetOverFront(true); // over flat front
|
m_engine->SetOverFront(true); // over flat front
|
||||||
m_main->CreateShortcuts();
|
m_main->CreateShortcuts();
|
||||||
m_main->StopSuspend();
|
m_main->StopSuspend();
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "object/robotmain.h"
|
#include "object/robotmain.h"
|
||||||
|
|
||||||
|
#include "app/pausemanager.h"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
|
@ -186,6 +188,7 @@ protected:
|
||||||
Gfx::CParticle* m_particle;
|
Gfx::CParticle* m_particle;
|
||||||
Gfx::CCamera* m_camera;
|
Gfx::CCamera* m_camera;
|
||||||
CSoundInterface* m_sound;
|
CSoundInterface* m_sound;
|
||||||
|
CPauseManager* m_pause;
|
||||||
|
|
||||||
Phase m_phase; // copy of CRobotMain
|
Phase m_phase; // copy of CRobotMain
|
||||||
Phase m_phaseSetup; // tab selected
|
Phase m_phaseSetup; // tab selected
|
||||||
|
@ -254,7 +257,7 @@ protected:
|
||||||
Math::Point m_dialogDim;
|
Math::Point m_dialogDim;
|
||||||
float m_dialogParti;
|
float m_dialogParti;
|
||||||
float m_dialogTime;
|
float m_dialogTime;
|
||||||
bool m_bInitPause;
|
PauseType m_bInitPause;
|
||||||
Gfx::CameraType m_initCamera;
|
Gfx::CameraType m_initCamera;
|
||||||
|
|
||||||
int m_partiPhase[10];
|
int m_partiPhase[10];
|
||||||
|
|
|
@ -71,6 +71,7 @@ CStudio::CStudio()
|
||||||
m_main = CRobotMain::GetInstancePointer();
|
m_main = CRobotMain::GetInstancePointer();
|
||||||
m_interface = m_main->GetInterface();
|
m_interface = m_main->GetInterface();
|
||||||
m_camera = m_main->GetCamera();
|
m_camera = m_main->GetCamera();
|
||||||
|
m_pause = CPauseManager::GetInstancePointer();
|
||||||
|
|
||||||
m_bEditMaximized = false;
|
m_bEditMaximized = false;
|
||||||
m_bEditMinimized = 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->SetEditLock(true, true);
|
||||||
m_main->SetEditFull(false);
|
m_main->SetEditFull(false);
|
||||||
m_bInitPause = m_engine->GetPause();
|
m_bInitPause = m_pause->GetPauseType();
|
||||||
m_main->SetSpeed(1.0f);
|
m_main->SetSpeed(1.0f);
|
||||||
m_editCamera = m_camera->GetType();
|
m_editCamera = m_camera->GetType();
|
||||||
m_camera->SetType(Gfx::CAM_TYPE_EDIT);
|
m_camera->SetType(Gfx::CAM_TYPE_EDIT);
|
||||||
|
@ -882,7 +883,7 @@ bool CStudio::StopEditScript(bool bCancel)
|
||||||
button->SetState(STATE_VISIBLE);
|
button->SetState(STATE_VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_bInitPause ) m_engine->SetPause(false);
|
m_pause->SetPause(m_bInitPause);
|
||||||
m_sound->MuteAll(false);
|
m_sound->MuteAll(false);
|
||||||
m_main->SetEditLock(false, true);
|
m_main->SetEditLock(false, true);
|
||||||
m_camera->SetType(m_editCamera);
|
m_camera->SetType(m_editCamera);
|
||||||
|
@ -954,22 +955,22 @@ void CStudio::UpdateFlux()
|
||||||
#if 1
|
#if 1
|
||||||
if ( m_bRealTime ) // run?
|
if ( m_bRealTime ) // run?
|
||||||
{
|
{
|
||||||
m_engine->SetPause(false);
|
m_pause->ClearPause();
|
||||||
m_sound->MuteAll(false);
|
m_sound->MuteAll(false);
|
||||||
}
|
}
|
||||||
else // step by step?
|
else // step by step?
|
||||||
{
|
{
|
||||||
m_engine->SetPause(true);
|
m_pause->SetPause(PAUSE_EDITOR);
|
||||||
m_sound->MuteAll(true);
|
m_sound->MuteAll(true);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
m_engine->SetPause(false);
|
m_pause->ClearPause();
|
||||||
m_sound->MuteAll(false);
|
m_sound->MuteAll(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else // stop?
|
else // stop?
|
||||||
{
|
{
|
||||||
m_engine->SetPause(true);
|
m_pause->SetPause(PAUSE_EDITOR);
|
||||||
m_sound->MuteAll(true);
|
m_sound->MuteAll(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "graphics/engine/camera.h"
|
#include "graphics/engine/camera.h"
|
||||||
|
|
||||||
|
#include "app/pausemanager.h"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
@ -96,6 +98,7 @@ protected:
|
||||||
CSoundInterface* m_sound;
|
CSoundInterface* m_sound;
|
||||||
CInterface* m_interface;
|
CInterface* m_interface;
|
||||||
CApplication* m_app;
|
CApplication* m_app;
|
||||||
|
CPauseManager* m_pause;
|
||||||
|
|
||||||
int m_rank;
|
int m_rank;
|
||||||
CScript* m_script;
|
CScript* m_script;
|
||||||
|
@ -113,7 +116,7 @@ protected:
|
||||||
float m_fixInfoTextTime;
|
float m_fixInfoTextTime;
|
||||||
bool m_bRunning;
|
bool m_bRunning;
|
||||||
bool m_bRealTime;
|
bool m_bRealTime;
|
||||||
bool m_bInitPause;
|
PauseType m_bInitPause;
|
||||||
std::string m_helpFilename;
|
std::string m_helpFilename;
|
||||||
|
|
||||||
StudioDialog m_dialog;
|
StudioDialog m_dialog;
|
||||||
|
|
Loading…
Reference in New Issue