From 570630ee3df60e1dd22fbab1595a4d9dfaa38774 Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Tue, 24 Dec 2013 14:38:11 +0700 Subject: ZVISION: Make update screen delayed for updates. --- engines/zvision/script_manager.cpp | 2 ++ engines/zvision/zvision.cpp | 16 ++++++++++++++-- engines/zvision/zvision.h | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'engines/zvision') diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index e2397abc59..e30861aa98 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -462,6 +462,8 @@ void ScriptManager::do_changeLocation() { assert(_nextLocation.world != 0); debug(1, "Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.offset); + _engine->setRenderDelay(2); + if (getStateValue(StateKey_World) != 'g' || getStateValue(StateKey_Room) != 'j') { if (_nextLocation.world != 'g' || _nextLocation.room != 'j') { setStateValue(StateKey_LastWorld, getStateValue(StateKey_World)); diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 39d61d9a89..65064d8a66 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -62,7 +62,8 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _saveManager(nullptr), _stringManager(nullptr), _cursorManager(nullptr), - _aud_id(0) { + _aud_id(0), + _rendDelay(2) { debug(1, "ZVision::ZVision"); } @@ -156,7 +157,10 @@ Common::Error ZVision::run() { _renderManager->renderBackbufferToScreen(); // Update the screen - _system->updateScreen(); + if (_rendDelay <= 0) + _system->updateScreen(); + else + _rendDelay--; // Calculate the frame delay based off a desired frame time int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); @@ -193,4 +197,12 @@ int ZVision::getAudioId() { return _aud_id; } +void ZVision::setRenderDelay(uint delay) { + _rendDelay = delay; +} + +bool ZVision::canRender() { + return _rendDelay <= 0; +} + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index e7709283ae..05c5fcd3a4 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -109,6 +109,8 @@ private: const Common::Rect _workingWindow_ZGI; const Common::Rect _workingWindow_ZNM; + + int _rendDelay; public: uint32 getFeatures() const; Common::Language getLanguage() const; @@ -153,6 +155,9 @@ public: Common::String generateSaveFileName(uint slot); Common::String generateAutoSaveFileName(); + void setRenderDelay(uint); + bool canRender(); + private: void initialize(); void initFonts(); -- cgit v1.2.3