diff options
author | Thanasis Antoniou | 2019-09-01 16:39:03 +0300 |
---|---|---|
committer | Thanasis Antoniou | 2019-09-01 16:39:36 +0300 |
commit | fd7fd3a18b7310aef8203ef5be2b37a9fc3eaed7 (patch) | |
tree | 3a0cc5e0d32a36a29999f77d7783b2efe768da93 /engines/bladerunner/ui | |
parent | a37f35695c21106d49ce7a3991e9cddd487e9eda (diff) | |
download | scummvm-rg350-fd7fd3a18b7310aef8203ef5be2b37a9fc3eaed7.tar.gz scummvm-rg350-fd7fd3a18b7310aef8203ef5be2b37a9fc3eaed7.tar.bz2 scummvm-rg350-fd7fd3a18b7310aef8203ef5be2b37a9fc3eaed7.zip |
BLADERUNNER: Isolate new frame limiter code in new class
Diffstat (limited to 'engines/bladerunner/ui')
-rw-r--r-- | engines/bladerunner/ui/elevator.cpp | 58 | ||||
-rw-r--r-- | engines/bladerunner/ui/elevator.h | 5 | ||||
-rw-r--r-- | engines/bladerunner/ui/end_credits.cpp | 23 | ||||
-rw-r--r-- | engines/bladerunner/ui/end_credits.h | 2 | ||||
-rw-r--r-- | engines/bladerunner/ui/esper.cpp | 24 | ||||
-rw-r--r-- | engines/bladerunner/ui/esper.h | 5 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia.cpp | 28 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia.h | 4 | ||||
-rw-r--r-- | engines/bladerunner/ui/spinner.cpp | 64 | ||||
-rw-r--r-- | engines/bladerunner/ui/spinner.h | 5 | ||||
-rw-r--r-- | engines/bladerunner/ui/vk.cpp | 19 | ||||
-rw-r--r-- | engines/bladerunner/ui/vk.h | 5 |
12 files changed, 123 insertions, 119 deletions
diff --git a/engines/bladerunner/ui/elevator.cpp b/engines/bladerunner/ui/elevator.cpp index db3a465ee4..d01acc21ed 100644 --- a/engines/bladerunner/ui/elevator.cpp +++ b/engines/bladerunner/ui/elevator.cpp @@ -25,6 +25,7 @@ #include "bladerunner/actor.h" #include "bladerunner/bladerunner.h" #include "bladerunner/audio_player.h" +#include "bladerunner/framelimiter.h" #include "bladerunner/game_info.h" #include "bladerunner/mouse.h" #include "bladerunner/shape.h" @@ -44,11 +45,17 @@ Elevator::Elevator(BladeRunnerEngine *vm) { _vm = vm; reset(); _imagePicker = new UIImagePicker(vm, 8); + _framelimiter = new Framelimiter(_vm, Framelimiter::kDefaultFpsRate, Framelimiter::kDefaultUseDelayMillis); } Elevator::~Elevator() { delete _imagePicker; _imagePicker = nullptr; + + if (_framelimiter) { + delete _framelimiter; + _framelimiter = nullptr; + } } int Elevator::activate(int elevatorId) { @@ -187,8 +194,7 @@ int Elevator::activate(int elevatorId) { void Elevator::open() { resetDescription(); _isOpen = true; - _timeLast = _vm->_time->currentSystem(); - _firstTickCall = true; + _framelimiter->init(); } bool Elevator::isOpen() const { @@ -207,44 +213,36 @@ int Elevator::handleMouseDown(int x, int y) { void Elevator::tick() { if (!_vm->_windowIsActive) { - _timeLast = _vm->_time->currentSystem(); + _framelimiter->init(); return; } - uint32 timeNow = _vm->_time->currentSystem(); - // unsigned difference is intentional - if (timeNow - _timeLast < _vm->kUpdateFrameTimeInMs && !_firstTickCall) { - return; - } + if (_framelimiter->shouldExecuteScreenUpdate()) { + int frame = _vqaPlayer->update(); + assert(frame >= -1); - if (_firstTickCall) { - _firstTickCall = false; - } + // vqaPlayer renders to _surfaceBack + blit(_vm->_surfaceBack, _vm->_surfaceFront); - int frame = _vqaPlayer->update(); - assert(frame >= -1); + Common::Point p = _vm->getMousePos(); - // vqaPlayer renders to _surfaceBack - blit(_vm->_surfaceBack, _vm->_surfaceFront); + // TODO(madmoose): BLADE.EXE has hasHoveredImage before handleMouseAction? + _imagePicker->handleMouseAction(p.x, p.y, false, false, false); + if (_imagePicker->hasHoveredImage()) { + _vm->_mouse->setCursor(1); + } else { + _vm->_mouse->setCursor(0); + } - Common::Point p = _vm->getMousePos(); + _imagePicker->draw(_vm->_surfaceFront); + _vm->_mouse->draw(_vm->_surfaceFront, p.x, p.y); - // TODO(madmoose): BLADE.EXE has hasHoveredImage before handleMouseAction? - _imagePicker->handleMouseAction(p.x, p.y, false, false, false); - if (_imagePicker->hasHoveredImage()) { - _vm->_mouse->setCursor(1); - } else { - _vm->_mouse->setCursor(0); - } - - _imagePicker->draw(_vm->_surfaceFront); - _vm->_mouse->draw(_vm->_surfaceFront, p.x, p.y); + _vm->_subtitles->tick(_vm->_surfaceFront); - _vm->_subtitles->tick(_vm->_surfaceFront); - - _vm->blitToScreen(_vm->_surfaceFront); + _vm->blitToScreen(_vm->_surfaceFront); + _framelimiter->postScreenUpdate(); + } tickDescription(); - _timeLast = timeNow; } void Elevator::buttonClick(int buttonId) { diff --git a/engines/bladerunner/ui/elevator.h b/engines/bladerunner/ui/elevator.h index 92afb6e2b7..c64152c3fc 100644 --- a/engines/bladerunner/ui/elevator.h +++ b/engines/bladerunner/ui/elevator.h @@ -28,12 +28,14 @@ namespace BladeRunner { class BladeRunnerEngine; +class Framelimiter; class Shape; class VQAPlayer; class UIImagePicker; class Elevator { BladeRunnerEngine *_vm; + Framelimiter *_framelimiter; bool _isOpen; VQAPlayer *_vqaPlayer; int _buttonClicked; @@ -43,9 +45,6 @@ class Elevator { int _sentenceId; uint32 _timeSpeakDescriptionStart; - uint32 _timeLast; - bool _firstTickCall; - public: Elevator(BladeRunnerEngine *vm); ~Elevator(); diff --git a/engines/bladerunner/ui/end_credits.cpp b/engines/bladerunner/ui/end_credits.cpp index 9ff6e1dbce..291014c5a3 100644 --- a/engines/bladerunner/ui/end_credits.cpp +++ b/engines/bladerunner/ui/end_credits.cpp @@ -29,6 +29,7 @@ #include "bladerunner/game_constants.h" #include "bladerunner/ambient_sounds.h" #include "bladerunner/audio_speech.h" +#include "bladerunner/framelimiter.h" #include "bladerunner/font.h" #include "bladerunner/game_info.h" #include "bladerunner/mouse.h" @@ -41,9 +42,14 @@ namespace BladeRunner { EndCredits::EndCredits(BladeRunnerEngine *vm) { _vm = vm; + _framelimiter = new Framelimiter(_vm, Framelimiter::kDefaultFpsRate, Framelimiter::kDefaultUseDelayMillis); } EndCredits::~EndCredits() { + if (_framelimiter) { + delete _framelimiter; + _framelimiter = nullptr; + } } void EndCredits::show() { @@ -92,8 +98,7 @@ void EndCredits::show() { _vm->_vqaStopIsRequested = false; double position = 0.0; - uint32 timeLast = _vm->_time->currentSystem(); - bool firstPass = true; + _framelimiter->init(); while (!_vm->_vqaStopIsRequested && !_vm->shouldQuit()) { if (position >= textPositions[textCount - 1]) { @@ -104,22 +109,15 @@ void EndCredits::show() { _vm->handleEvents(); if (!_vm->_windowIsActive) { - timeLast = _vm->_time->currentSystem(); - + _framelimiter->init(); continue; } - uint32 timeNow = _vm->_time->currentSystem(); - if (timeNow - timeLast < _vm->kUpdateFrameTimeInMs && !firstPass) { + if (!_framelimiter->shouldExecuteScreenUpdate()) { continue; } - if (firstPass) { - firstPass = false; - } - - position += (double)(timeNow - timeLast) * 0.05f; // unsigned difference is intentional - timeLast = timeNow; + position += (double)(_framelimiter->getTimeOfCurrentPass() - _framelimiter->getTimeOfLastPass()) * 0.05f; // unsigned difference is intentional _vm->_surfaceFront.fillRect(Common::Rect(640, 480), 0); @@ -156,6 +154,7 @@ void EndCredits::show() { _vm->_surfaceFront.fillRect(Common::Rect(0, 452, 640, 480), 0); _vm->blitToScreen(_vm->_surfaceFront); + _framelimiter->postScreenUpdate(); } _vm->_vqaIsPlaying = false; diff --git a/engines/bladerunner/ui/end_credits.h b/engines/bladerunner/ui/end_credits.h index 39086cd796..6c45adfd60 100644 --- a/engines/bladerunner/ui/end_credits.h +++ b/engines/bladerunner/ui/end_credits.h @@ -26,9 +26,11 @@ namespace BladeRunner { class BladeRunnerEngine; +class Framelimiter; class EndCredits { BladeRunnerEngine *_vm; + Framelimiter *_framelimiter; public: EndCredits(BladeRunnerEngine *vm); diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp index 5f49830f44..f5257bf694 100644 --- a/engines/bladerunner/ui/esper.cpp +++ b/engines/bladerunner/ui/esper.cpp @@ -28,6 +28,7 @@ #include "bladerunner/bladerunner.h" #include "bladerunner/debugger.h" #include "bladerunner/decompress_lcw.h" +#include "bladerunner/framelimiter.h" #include "bladerunner/font.h" #include "bladerunner/game_info.h" #include "bladerunner/mouse.h" @@ -57,7 +58,6 @@ ESPER::ESPER(BladeRunnerEngine *vm) { _isDrawingSelection = false; _isOpen = false; - _firstTickCall = false; _shapeButton = nullptr; _shapeThumbnail = nullptr; _vqaPlayerMain = nullptr; @@ -67,11 +67,17 @@ ESPER::ESPER(BladeRunnerEngine *vm) { reset(); _buttons = new UIImagePicker(vm, kPhotoCount + 4); + _framelimiter = new Framelimiter(_vm, Framelimiter::kDefaultFpsRate, Framelimiter::kDefaultUseDelayMillis); } ESPER::~ESPER() { delete _buttons; reset(); + + if (_framelimiter) { + delete _framelimiter; + _framelimiter = nullptr; + } } void ESPER::open(Graphics::Surface *surface) { @@ -116,8 +122,8 @@ void ESPER::open(Graphics::Surface *surface) { _vqaPlayerMain->setLoop(2, -1, kLoopSetModeJustStart, nullptr, nullptr); _isOpen = true; - _timeLast = _vm->_time->currentSystem(); - _firstTickCall = true; + _framelimiter->init(); + _flash = false; _script = new ESPERScript(_vm); @@ -210,16 +216,11 @@ void ESPER::handleMouseDown(int x, int y, bool mainButton) { void ESPER::tick() { if (!_vm->_windowIsActive) { - _timeLast = _vm->_time->currentSystem(); + _framelimiter->init(); return; } - uint32 timeNow = _vm->_time->currentSystem(); - // unsigned difference is intentional - if (timeNow - _timeLast >= _vm->kUpdateFrameTimeInMs || _firstTickCall) { - if (_firstTickCall) { - _firstTickCall = false; - } + if (_framelimiter->shouldExecuteScreenUpdate()) { tickSound(); blit(_vm->_surfaceBack, _vm->_surfaceFront); @@ -242,8 +243,7 @@ void ESPER::tick() { _vm->_subtitles->tick(_vm->_surfaceFront); _vm->blitToScreen(_vm->_surfaceFront); - // TODO: implement 60hz lock for smoother experience - _timeLast = timeNow; + _framelimiter->postScreenUpdate(); } if (_statePhoto == kEsperPhotoStateVideoShow) { diff --git a/engines/bladerunner/ui/esper.h b/engines/bladerunner/ui/esper.h index 6feb2cae2d..818d51ca44 100644 --- a/engines/bladerunner/ui/esper.h +++ b/engines/bladerunner/ui/esper.h @@ -31,6 +31,7 @@ namespace BladeRunner { class BladeRunnerEngine; +class Framelimiter; class Font; class Shape; class VQAPlayer; @@ -87,6 +88,7 @@ class ESPER { }; BladeRunnerEngine *_vm; + Framelimiter *_framelimiter; ESPERScript *_script; bool _isWaiting; @@ -184,9 +186,6 @@ class ESPER { int _volume3; int _ambientVolume; - uint32 _timeLast; - bool _firstTickCall; - public: ESPER(BladeRunnerEngine *vm); ~ESPER(); diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp index a40a78670e..501a1e7cf2 100644 --- a/engines/bladerunner/ui/kia.cpp +++ b/engines/bladerunner/ui/kia.cpp @@ -26,6 +26,7 @@ #include "bladerunner/audio_player.h" #include "bladerunner/bladerunner.h" #include "bladerunner/combat.h" +#include "bladerunner/framelimiter.h" #include "bladerunner/font.h" #include "bladerunner/game_constants.h" #include "bladerunner/game_flags.h" @@ -80,7 +81,6 @@ KIA::KIA(BladeRunnerEngine *vm) { _playerPhotograph = nullptr; _playerSliceModelId = -1; _playerSliceModelAngle = 0.0f; - _timeLast = _vm->_time->currentSystem(); _playerActorDialogueQueuePosition = 0; _playerActorDialogueQueueSize = 0; _playerActorDialogueState = 0; @@ -93,7 +93,7 @@ KIA::KIA(BladeRunnerEngine *vm) { // original imageCount was 22. We add +1 to have a description box for objects in cut content // We don't have separated cases here, for _vm->_cutContent since that causes assertion fault if - // loading a "restoed content" save game in a "original game" version + // loading a "restored content" save game in a "original game" version _buttons = new UIImagePicker(_vm, 23); _crimesSection = new KIASectionCrimes(_vm, _vm->_playerActor->_clues); @@ -110,6 +110,9 @@ KIA::KIA(BladeRunnerEngine *vm) { _playerActorDialogueQueue[i].actorId = -1; _playerActorDialogueQueue[i].sentenceId = -1; } + + _framelimiter = new Framelimiter(_vm, Framelimiter::kDefaultFpsRate, Framelimiter::kDefaultUseDelayMillis); + _framelimiter->init(); } KIA::~KIA() { @@ -133,6 +136,11 @@ KIA::~KIA() { delete _shapes; delete _log; delete _script; + + if (_framelimiter) { + delete _framelimiter; + _framelimiter = nullptr; + } } void KIA::reset() { @@ -227,18 +235,17 @@ bool KIA::isOpen() const { void KIA::tick() { if (!isOpen()) { - _timeLast = _vm->_time->currentSystem(); return; } - uint32 timeNow = _vm->_time->currentSystem(); - // unsigned difference is intentional - uint32 timeDiff = timeNow - _timeLast; - - if (timeDiff < _vm->kUpdateFrameTimeInMs) { + if (!_framelimiter->shouldExecuteScreenUpdate()) { return; } + uint32 timeNow = _framelimiter->getTimeOfCurrentPass(); + // unsigned difference is intentional + uint32 timeDiff = timeNow - _framelimiter->getTimeOfLastPass(); + if (_playerActorDialogueQueueSize == _playerActorDialogueQueuePosition) { _playerActorDialogueState = 0; } else if (_playerActorDialogueState == 0) { @@ -389,7 +396,7 @@ void KIA::tick() { _vm->blitToScreen(_vm->_surfaceFront); - _timeLast = timeNow; + _framelimiter->postScreenUpdate(); } void KIA::resume() { @@ -684,7 +691,8 @@ void KIA::init() { playerReset(); _playerVqaFrame = 0; _playerVqaTimeLast = _vm->_time->currentSystem(); - _timeLast = _vm->_time->currentSystem(); + + _framelimiter->init(); if (_vm->_gameFlags->query(kFlagKIAPrivacyAddon) && !_vm->_gameFlags->query(kFlagKIAPrivacyAddonIntro)) { _vm->_gameFlags->set(kFlagKIAPrivacyAddonIntro); diff --git a/engines/bladerunner/ui/kia.h b/engines/bladerunner/ui/kia.h index 2a87f5df6a..fdc4d8ef15 100644 --- a/engines/bladerunner/ui/kia.h +++ b/engines/bladerunner/ui/kia.h @@ -34,6 +34,7 @@ struct KeyState; namespace BladeRunner { class BladeRunnerEngine; +class Framelimiter; class KIALog; class KIAScript; class KIASectionBase; @@ -75,6 +76,7 @@ class KIA { }; BladeRunnerEngine *_vm; + Framelimiter *_framelimiter; int _transitionId; @@ -87,7 +89,7 @@ class KIA { int _playerSliceModelId; float _playerSliceModelAngle; Graphics::Surface _playerImage; - uint32 _timeLast; +// uint32 _timeLast; ActorDialogueQueueEntry _playerActorDialogueQueue[kPlayerActorDialogueQueueCapacity]; int _playerActorDialogueQueuePosition; diff --git a/engines/bladerunner/ui/spinner.cpp b/engines/bladerunner/ui/spinner.cpp index 2b084c9a2c..85d2c373bb 100644 --- a/engines/bladerunner/ui/spinner.cpp +++ b/engines/bladerunner/ui/spinner.cpp @@ -28,6 +28,7 @@ #include "bladerunner/ambient_sounds.h" #include "bladerunner/game_info.h" #include "bladerunner/subtitles.h" +#include "bladerunner/framelimiter.h" #include "bladerunner/game_constants.h" #include "bladerunner/mouse.h" #include "bladerunner/savefile.h" @@ -48,6 +49,7 @@ Spinner::Spinner(BladeRunnerEngine *vm) { reset(); _imagePicker = new UIImagePicker(vm, kSpinnerDestinations); _vqaPlayer = nullptr; + _framelimiter = new Framelimiter(_vm, Framelimiter::kDefaultFpsRate, Framelimiter::kDefaultUseDelayMillis); } Spinner::~Spinner() { @@ -59,6 +61,11 @@ Spinner::~Spinner() { _vqaPlayer->close(); delete _vqaPlayer; } + + if (_framelimiter) { + delete _framelimiter; + _framelimiter = nullptr; + } } void Spinner::setSelectableDestinationFlag(int destination, bool selectable) { @@ -79,9 +86,8 @@ int Spinner::chooseDestination(int loopId, bool immediately) { } if (loopId < 0) { - _isOpen = true; - _timeLast = _vm->_time->currentSystem(); - _firstTickCall = true; + // call Spinner:open() + open(); } else { _vm->playerLosesControl(); _vm->_scene->loopStartSpecial(kSceneLoopModeSpinner, loopId, immediately); @@ -231,8 +237,7 @@ void Spinner::mouseUpCallback(int destinationImage, void *self) { void Spinner::open() { _isOpen = true; - _timeLast = _vm->_time->currentSystem(); - _firstTickCall = true; + _framelimiter->init(); } bool Spinner::isOpen() const { @@ -251,45 +256,39 @@ int Spinner::handleMouseDown(int x, int y) { void Spinner::tick() { if (!_vm->_windowIsActive) { - _timeLast = _vm->_time->currentSystem(); + _framelimiter->init(); return; } - uint32 timeNow = _vm->_time->currentSystem(); - // unsigned difference is intentional - if (timeNow - _timeLast < _vm->kUpdateFrameTimeInMs && !_firstTickCall) { - return; - } + if (_framelimiter->shouldExecuteScreenUpdate()) { + int frame = _vqaPlayer->update(); + assert(frame >= -1); - if (_firstTickCall) { - _firstTickCall = false; - } + // vqaPlayer renders to _surfaceBack + blit(_vm->_surfaceBack, _vm->_surfaceFront); - int frame = _vqaPlayer->update(); - assert(frame >= -1); + Common::Point p = _vm->getMousePos(); + _imagePicker->handleMouseAction(p.x, p.y, false, false, false); + if (_imagePicker->hasHoveredImage()) { + _vm->_mouse->setCursor(1); + } else { + _vm->_mouse->setCursor(0); + } + _imagePicker->draw(_vm->_surfaceFront); + _vm->_mouse->draw(_vm->_surfaceFront, p.x, p.y); + _imagePicker->drawTooltip(_vm->_surfaceFront, p.x, p.y); - // vqaPlayer renders to _surfaceBack - blit(_vm->_surfaceBack, _vm->_surfaceFront); + if (_vm->_cutContent) { + _vm->_subtitles->tick(_vm->_surfaceFront); + } + _vm->blitToScreen(_vm->_surfaceFront); + _framelimiter->postScreenUpdate(); - Common::Point p = _vm->getMousePos(); - _imagePicker->handleMouseAction(p.x, p.y, false, false, false); - if (_imagePicker->hasHoveredImage()) { - _vm->_mouse->setCursor(1); - } else { - _vm->_mouse->setCursor(0); } - _imagePicker->draw(_vm->_surfaceFront); - _vm->_mouse->draw(_vm->_surfaceFront, p.x, p.y); - _imagePicker->drawTooltip(_vm->_surfaceFront, p.x, p.y); if (_vm->_cutContent) { - _vm->_subtitles->tick(_vm->_surfaceFront); - } - _vm->blitToScreen(_vm->_surfaceFront); - if (_vm->_cutContent) { tickDescription(); } - _timeLast = timeNow; } void Spinner::setSelectedDestination(int destination) { @@ -302,7 +301,6 @@ void Spinner::reset() { } _isOpen = false; - _firstTickCall = false; _destinations = nullptr; _selectedDestination = -1; _imagePicker = nullptr; diff --git a/engines/bladerunner/ui/spinner.h b/engines/bladerunner/ui/spinner.h index 0477595ef4..78c2943eb2 100644 --- a/engines/bladerunner/ui/spinner.h +++ b/engines/bladerunner/ui/spinner.h @@ -29,6 +29,7 @@ namespace BladeRunner { class BladeRunnerEngine; +class Framelimiter; class SaveFileReadStream; class SaveFileWriteStream; class Shape; @@ -44,6 +45,7 @@ class Spinner { }; BladeRunnerEngine *_vm; + Framelimiter *_framelimiter; bool _isDestinationSelectable[kSpinnerDestinations]; bool _isOpen; VQAPlayer *_vqaPlayer; @@ -56,9 +58,6 @@ class Spinner { int _sentenceId; uint32 _timeSpeakDescriptionStart; - uint32 _timeLast; - bool _firstTickCall; - public: Spinner(BladeRunnerEngine *vm); ~Spinner(); diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp index 06056c33dd..7e24b798b6 100644 --- a/engines/bladerunner/ui/vk.cpp +++ b/engines/bladerunner/ui/vk.cpp @@ -27,6 +27,7 @@ #include "bladerunner/audio_player.h" #include "bladerunner/bladerunner.h" #include "bladerunner/combat.h" +#include "bladerunner/framelimiter.h" #include "bladerunner/font.h" #include "bladerunner/game_constants.h" #include "bladerunner/game_flags.h" @@ -53,10 +54,16 @@ VK::VK(BladeRunnerEngine *vm) { _vm = vm; reset(); + _framelimiter = new Framelimiter(_vm, Framelimiter::kDefaultFpsRate, Framelimiter::kDefaultUseDelayMillis); } VK::~VK() { reset(); + + if (_framelimiter) { + delete _framelimiter; + _framelimiter = nullptr; + } } void VK::open(int actorId, int calibrationRatio) { @@ -126,8 +133,7 @@ void VK::open(int actorId, int calibrationRatio) { } _isOpen = true; - _timeLast = _vm->_time->currentSystem(); - _firstTickCall = true; + _framelimiter->init(); _script = new VKScript(_vm); @@ -193,12 +199,7 @@ void VK::close() { void VK::tick() { - uint32 timeNow = _vm->_time->currentSystem(); - // unsigned difference is intentional - if (timeNow - _timeLast >= _vm->kUpdateFrameTimeInMs || _firstTickCall) { - if (_firstTickCall) { - _firstTickCall = false; - } + if (_framelimiter->shouldExecuteScreenUpdate()) { int mouseX, mouseY; _vm->_mouse->getXY(&mouseX, &mouseY); if (!_vm->_mouse->isDisabled()) { @@ -220,7 +221,7 @@ void VK::tick() { _vm->_subtitles->tick(_vm->_surfaceFront); _vm->blitToScreen(_vm->_surfaceFront); - _timeLast = timeNow; + _framelimiter->postScreenUpdate(); } // unsigned difference is intentional diff --git a/engines/bladerunner/ui/vk.h b/engines/bladerunner/ui/vk.h index 8593e6b1b3..a8802046e3 100644 --- a/engines/bladerunner/ui/vk.h +++ b/engines/bladerunner/ui/vk.h @@ -31,6 +31,7 @@ namespace BladeRunner { class BladeRunnerEngine; +class Framelimiter; class VKScript; class Shape; class UIImagePicker; @@ -47,6 +48,7 @@ class VK { }; BladeRunnerEngine *_vm; + Framelimiter *_framelimiter; VKScript *_script; @@ -124,9 +126,6 @@ class VK { uint32 _timeNextEyeLineStepStart; uint32 _timeNextEyeLineStart; - uint32 _timeLast; - bool _firstTickCall; - public: VK(BladeRunnerEngine *vm); ~VK(); |