aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/bladerunner.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/bladerunner.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/bladerunner.cpp')
-rw-r--r--engines/bladerunner/bladerunner.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index f451db1642..2da701f5d3 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -954,6 +954,7 @@ bool BladeRunnerEngine::isMouseButtonDown() const {
void BladeRunnerEngine::gameLoop() {
_gameIsRunning = true;
+ _timeOfMainGameLoopTickPrevious = _time->currentSystem();
do {
if (_playerDead) {
playerDied();
@@ -964,9 +965,11 @@ void BladeRunnerEngine::gameLoop() {
}
void BladeRunnerEngine::gameTick() {
+
handleEvents();
if (!_gameIsRunning || !_windowIsActive) {
+ _timeOfMainGameLoopTickPrevious = _time->currentSystem();
return;
}
@@ -975,6 +978,7 @@ void BladeRunnerEngine::gameTick() {
Common::Error runtimeError = Common::Error(Common::kUnknownError, _("A required game resource was not found"));
GUI::MessageDialog dialog(runtimeError.getDesc());
dialog.runModal();
+ _timeOfMainGameLoopTickPrevious = _time->currentSystem();
return;
}
}
@@ -1106,13 +1110,17 @@ void BladeRunnerEngine::gameTick() {
_subtitles->tick(_surfaceFront);
+ uint32 mainGameLoopTickNow = _time->currentSystem();
+ if (mainGameLoopTickNow - _timeOfMainGameLoopTickPrevious < kUpdateFrameTimeInMs) {
+ return;
+ }
+ _timeOfMainGameLoopTickPrevious = mainGameLoopTickNow;
// Without this condition the game may flash back to the game screen
// between and ending outtake and the end credits.
if (!_gameOver) {
blitToScreen(_surfaceFront);
}
- _system->delayMillis(10);
}
void BladeRunnerEngine::actorsUpdate() {