From 2b9811d225413afcf06f21454fb73975b0e09cbb Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 16 Jul 2015 20:47:15 +0200 Subject: [PATCH] Movie lock refactoring --- src/graphics/engine/engine.cpp | 24 +++++++----------------- src/graphics/engine/engine.h | 9 --------- src/graphics/engine/lightning.cpp | 3 +-- src/object/robotmain.cpp | 4 ---- 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 44620f8b..fc95ea9b 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -89,7 +89,6 @@ CEngine::CEngine(CApplication *app) m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f); m_render = true; - m_movieLock = false; m_shadowVisible = true; m_groundSpotVisible = true; m_dirty = true; @@ -488,17 +487,19 @@ void CEngine::FrameUpdate() bool CEngine::WriteScreenShot(const std::string& fileName, int width, int height) { void *pixels = m_device->GetFrameBufferPixels(); - CImage img({width,height}); + CImage img({width, height}); img.SetDataPixels(pixels); img.flipVertically(); - if ( img.SavePNG(fileName.c_str()) ){ - GetLogger()->Info("Save SceenShot Saved Successfully!\n"); + if ( img.SavePNG(fileName.c_str()) ) + { + GetLogger()->Debug("Save screenshot saved successfully\n"); return true; } - else{ - GetLogger()->Error("%s!\n",img.GetError().c_str()); + else + { + GetLogger()->Error("%s!\n", img.GetError().c_str()); return false; } } @@ -508,16 +509,6 @@ bool CEngine::GetPause() return m_pause->GetPause(); } -void CEngine::SetMovieLock(bool lock) -{ - m_movieLock = lock; -} - -bool CEngine::GetMovieLock() -{ - return m_movieLock; -} - void CEngine::SetShowStats(bool show) { m_showStats = show; @@ -5135,4 +5126,3 @@ void CEngine::SetStaticMeshTransparency(int meshHandle, float value) } } // namespace Gfx - diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h index e394a723..375ecaa4 100644 --- a/src/graphics/engine/engine.h +++ b/src/graphics/engine/engine.h @@ -731,12 +731,6 @@ public: //! Get pause mode TEST_VIRTUAL bool GetPause(); - //@{ - //! Management of lock for the duration of movie sequence - void SetMovieLock(bool lock); - bool GetMovieLock(); - //@} - //@{ //! Management of displaying statistic information void SetShowStats(bool show); @@ -1372,8 +1366,6 @@ protected: std::string m_fpsText; //! Rendering enabled? bool m_render; - //! Lock for duration of movie? - bool m_movieLock; //! Projection matrix for 3D scene Math::Matrix m_matProj; @@ -1544,4 +1536,3 @@ protected: } // namespace Gfx - diff --git a/src/graphics/engine/lightning.cpp b/src/graphics/engine/lightning.cpp index 08deea3b..67e936a9 100644 --- a/src/graphics/engine/lightning.cpp +++ b/src/graphics/engine/lightning.cpp @@ -81,7 +81,7 @@ bool CLightning::EventProcess(const Event &event) bool CLightning::EventFrame(const Event &event) { if (m_engine->GetPause()) return true; - if (m_engine->GetMovieLock()) return true; + if (CRobotMain::GetInstancePointer()->GetMovieLock()) return true; m_progress += event.rTime*m_speed; @@ -417,4 +417,3 @@ CObject* CLightning::SearchObject(Math::Vector pos) } // namespace Gfx - diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index cd319c3e..c0cf63c2 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -283,8 +283,6 @@ void CRobotMain::Create(bool loadProfile) m_engine->SetTerrain(m_terrain); - m_engine->SetMovieLock(m_movieLock); - m_app->SetMouseMode(MOUSE_ENGINE); m_movie->Flush(); @@ -472,7 +470,6 @@ void CRobotMain::ChangePhase(Phase phase) m_freePhoto = false; m_resetCreate = false; - m_engine->SetMovieLock(m_movieLock); ChangePause(PAUSE_NONE); FlushDisplayInfo(); m_engine->SetRankView(0); @@ -5827,7 +5824,6 @@ bool CRobotMain::GetShowMap() void CRobotMain::SetMovieLock(bool lock) { m_movieLock = lock; - m_engine->SetMovieLock(m_movieLock); CreateShortcuts(); m_map->ShowMap(!m_movieLock && m_mapShow);