[colobot] 93/145: Removed CAM_TYPE_DIALOG

Didier Raboud odyx at moszumanska.debian.org
Mon Jul 11 12:56:21 UTC 2016


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 942f746a21608f44f068ac92a777ccce4d1f2b3f
Author: krzys-h <krzys_h at interia.pl>
Date:   Sat May 28 12:50:32 2016 +0200

    Removed CAM_TYPE_DIALOG
---
 src/app/pausemanager.h         |  1 +
 src/graphics/engine/camera.cpp | 16 ++++++++--------
 src/graphics/engine/camera.h   | 10 ++++++----
 src/level/robotmain.cpp        | 12 ++++--------
 src/level/robotmain.h          |  1 -
 src/ui/mainui.cpp              |  2 +-
 6 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/src/app/pausemanager.h b/src/app/pausemanager.h
index 478d115..d76baf8 100644
--- a/src/app/pausemanager.h
+++ b/src/app/pausemanager.h
@@ -40,6 +40,7 @@ enum PauseType
     PAUSE_PHOTO = (1<<2), //!< photo mode, TODO: remove
     PAUSE_OBJECT_UPDATES = (1<<3), //!< do not send events to objects
     PAUSE_MUTE_SOUND = (1<<4), //!< mute sound
+    PAUSE_CAMERA = (1<<5), //!< freeze camera
 };
 inline PauseType& operator|=(PauseType& a, const PauseType& b)
 {
diff --git a/src/graphics/engine/camera.cpp b/src/graphics/engine/camera.cpp
index e0cfaa7..96c4f00 100644
--- a/src/graphics/engine/camera.cpp
+++ b/src/graphics/engine/camera.cpp
@@ -1163,6 +1163,9 @@ void CCamera::EventMouseButton(const Event &event)
 
 bool CCamera::EventFrame(const Event &event)
 {
+    if (m_freeze)
+        return true;
+
     Math::Point newDelta = m_mouseDeltaEdge * m_speed * event.rTime;
     if (m_cameraInvertX)
         newDelta.x = -newDelta.x;
@@ -1177,9 +1180,6 @@ bool CCamera::EventFrame(const Event &event)
         m_type == CAM_TYPE_EDIT)
         return EventFrameFree(event, m_type != CAM_TYPE_EDIT);
 
-    if (m_type == CAM_TYPE_DIALOG)
-        return EventFrameDialog(event);
-
     if (m_type == CAM_TYPE_BACK)
         return EventFrameBack(event);
 
@@ -1262,11 +1262,6 @@ bool CCamera::EventFrameFree(const Event &event, bool keysAllowed)
     return true;
 }
 
-bool CCamera::EventFrameDialog(const Event &event)
-{
-    return true;
-}
-
 bool CCamera::EventFrameBack(const Event &event)
 {
     Math::Vector cameraMove = CalculateCameraMovement(event);
@@ -1625,4 +1620,9 @@ Math::Vector CCamera::CalculateCameraMovement(const Event &event, bool keysAllow
     return delta;
 }
 
+void CCamera::SetFreeze(bool freeze)
+{
+    m_freeze = freeze;
+}
+
 }
diff --git a/src/graphics/engine/camera.h b/src/graphics/engine/camera.h
index 8d7386f..ff4d62e 100644
--- a/src/graphics/engine/camera.h
+++ b/src/graphics/engine/camera.h
@@ -63,8 +63,6 @@ enum CameraType
     CAM_TYPE_INFO     = 8,
     //! Visit instead of an error
     CAM_TYPE_VISIT    = 9,
-    //! Camera for dialog
-    CAM_TYPE_DIALOG   = 10,
     //! Static camera height
     CAM_TYPE_PLANE    = 11,
 };
@@ -211,6 +209,9 @@ public:
     void        SetCameraInvertY(bool invert);
     bool        GetCameraInvertY();
 
+    //! Temporarily freeze camera movement
+    void        SetFreeze(bool freeze);
+
     void        SetCameraSpeed(float speed);
 
 protected:
@@ -225,8 +226,6 @@ protected:
     //! Moves the point of view
     bool        EventFrameFree(const Event &event, bool keysAllowed);
     //! Moves the point of view
-    bool        EventFrameDialog(const Event &event);
-    //! Moves the point of view
     bool        EventFrameBack(const Event &event);
     //! Moves the point of view
     bool        EventFrameFix(const Event &event);
@@ -389,6 +388,9 @@ protected:
     bool        m_cameraInvertX;
     //! Y inversion in the edges?
     bool        m_cameraInvertY;
+
+    //! Is camera frozen?
+    bool m_freeze = false;
 };
 
 
diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp
index 2990ceb..9abd54a 100644
--- a/src/level/robotmain.cpp
+++ b/src/level/robotmain.cpp
@@ -456,7 +456,7 @@ void CRobotMain::ChangePhase(Phase phase)
         FlushNewScriptName();
         m_sound->SetListener(Math::Vector(0.0f, 0.0f, 0.0f), Math::Vector(0.0f, 0.0f, 1.0f));
         m_sound->StopAll();
-        m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
+        m_camera->SetType(Gfx::CAM_TYPE_NULL);
         m_movie->Flush();
         m_movieInfoIndex = -1;
         m_cameraPan  = 0.0f;
@@ -1589,7 +1589,7 @@ void CRobotMain::StartSuspend()
 {
     m_sound->MuteAll(true);
     ClearInterface();
-    m_suspend = m_pause->ActivatePause(PAUSE_ENGINE|PAUSE_HIDE_SHORTCUTS|PAUSE_MUTE_SOUND);
+    m_suspend = m_pause->ActivatePause(PAUSE_ENGINE|PAUSE_HIDE_SHORTCUTS|PAUSE_MUTE_SOUND|PAUSE_CAMERA);
     m_engine->SetOverFront(false);  // over flat behind
     CreateShortcuts();
 
@@ -1597,9 +1597,6 @@ void CRobotMain::StartSuspend()
     m_infoObject = DeselectAll();  // removes the control buttons
     m_displayText->HideText(true);
 
-    m_suspendInitCamera = m_camera->GetType();
-    m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
-
     m_engine->EnablePauseBlur();
 }
 
@@ -1618,8 +1615,6 @@ void CRobotMain::StopSuspend()
     m_map->ShowMap(m_mapShow);
     m_displayText->HideText(false);
 
-    m_camera->SetType(m_suspendInitCamera);
-
     m_engine->DisablePauseBlur();
 }
 
@@ -4975,7 +4970,7 @@ void CRobotMain::ResetCreate()
     m_particle->FlushParticle();
     m_terrain->FlushBuildingLevel();
 
-    m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
+    m_camera->SetType(Gfx::CAM_TYPE_NULL);
 
     try
     {
@@ -5500,6 +5495,7 @@ void CRobotMain::StartMusic()
 void CRobotMain::UpdatePause(PauseType pause)
 {
     m_engine->SetPause(pause & PAUSE_ENGINE);
+    m_camera->SetFreeze(pause & PAUSE_CAMERA);
     m_sound->MuteAll(pause & PAUSE_MUTE_SOUND);
     CreateShortcuts();
     if (pause != PAUSE_NONE) HiliteClear();
diff --git a/src/level/robotmain.h b/src/level/robotmain.h
index 505b5b9..8c6b53e 100644
--- a/src/level/robotmain.h
+++ b/src/level/robotmain.h
@@ -506,7 +506,6 @@ protected:
     char            m_mapFilename[100] = {};
 
     ActivePause*    m_suspend = nullptr;
-    Gfx::CameraType m_suspendInitCamera = Gfx::CAM_TYPE_NULL;
 
     Math::Point     m_tooltipPos;
     std::string     m_tooltipName;
diff --git a/src/ui/mainui.cpp b/src/ui/mainui.cpp
index 2a60dae..f373d69 100644
--- a/src/ui/mainui.cpp
+++ b/src/ui/mainui.cpp
@@ -148,7 +148,7 @@ CScreenSetup* CMainUserInterface::GetSetupScreen(Phase phase)
 
 void CMainUserInterface::ChangePhase(Phase phase)
 {
-    m_main->GetCamera()->SetType(Gfx::CAM_TYPE_DIALOG);
+    m_main->GetCamera()->SetType(Gfx::CAM_TYPE_NULL);
     m_engine->SetOverFront(false);
     m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok?
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list