aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/outtake.cpp
diff options
context:
space:
mode:
authorThanasis Antoniou2019-08-31 19:18:33 +0300
committerThanasis Antoniou2019-08-31 19:19:32 +0300
commita99e8d7baba5bcbc6cc07ff2d34d81fb7e3e93dc (patch)
tree05a80e1d0b4212c7a8b753c02ba8009a2c404b07 /engines/bladerunner/outtake.cpp
parent196378d9da0366feb341c0b9ab5f63b6dce0c218 (diff)
downloadscummvm-rg350-a99e8d7baba5bcbc6cc07ff2d34d81fb7e3e93dc.tar.gz
scummvm-rg350-a99e8d7baba5bcbc6cc07ff2d34d81fb7e3e93dc.tar.bz2
scummvm-rg350-a99e8d7baba5bcbc6cc07ff2d34d81fb7e3e93dc.zip
BLADERUNNER: Replace delayMillis(10) calls with software timers
Diffstat (limited to 'engines/bladerunner/outtake.cpp')
-rw-r--r--engines/bladerunner/outtake.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp
index 112a12085d..0c995ff614 100644
--- a/engines/bladerunner/outtake.cpp
+++ b/engines/bladerunner/outtake.cpp
@@ -26,6 +26,7 @@
#include "bladerunner/chapters.h"
#include "bladerunner/subtitles.h"
#include "bladerunner/vqa_player.h"
+#include "bladerunner/time.h"
#include "common/debug.h"
#include "common/events.h"
@@ -69,13 +70,26 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co
_vm->_vqaIsPlaying = true;
_vm->_vqaStopIsRequested = false;
+ uint32 timeNow = 0;
+ bool firstFrame = true;
+ _timeLast = _vm->_time->currentSystem();
+
while (!_vm->_vqaStopIsRequested && !_vm->shouldQuit()) {
_vm->handleEvents();
if (!_vm->_windowIsActive) {
+ _timeLast = _vm->_time->currentSystem();
continue;
}
+ timeNow = _vm->_time->currentSystem();
+ // unsigned difference is intentional
+ if (timeNow - _timeLast < _vm->kUpdateFrameTimeInMs && !firstFrame) {
+ continue;
+ } else if (firstFrame) {
+ firstFrame = false;
+ }
+
int frame = vqaPlayer.update();
blit(_surfaceVideo, _vm->_surfaceFront); // This helps to make subtitles disappear properly, if the video is rendered in separate surface and then pushed to the front surface
if (frame == -3) { // end of video
@@ -87,8 +101,7 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co
_vm->_subtitles->tickOuttakes(_vm->_surfaceFront);
_vm->blitToScreen(_vm->_surfaceFront);
}
-
- _vm->_system->delayMillis(10);
+ _timeLast = timeNow;
}
_vm->_vqaIsPlaying = false;