aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script/police_maze.cpp
diff options
context:
space:
mode:
authorThanasis Antoniou2019-07-17 19:08:43 +0300
committerThanasis Antoniou2019-07-17 19:09:15 +0300
commitcaa4578add35021bfbb00b5f81359592402096a3 (patch)
tree2133b0dd3f4e71324bafc1ca65699ba79483e512 /engines/bladerunner/script/police_maze.cpp
parentd1ff73cbb381db1876e2dbdf0457c9efc76fcd1a (diff)
downloadscummvm-rg350-caa4578add35021bfbb00b5f81359592402096a3.tar.gz
scummvm-rg350-caa4578add35021bfbb00b5f81359592402096a3.tar.bz2
scummvm-rg350-caa4578add35021bfbb00b5f81359592402096a3.zip
BLADERUNNER: Use unsigned 32bit diff for time durations
Diffstat (limited to 'engines/bladerunner/script/police_maze.cpp')
-rw-r--r--engines/bladerunner/script/police_maze.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/engines/bladerunner/script/police_maze.cpp b/engines/bladerunner/script/police_maze.cpp
index 68e2b672ed..028eca00b5 100644
--- a/engines/bladerunner/script/police_maze.cpp
+++ b/engines/bladerunner/script/police_maze.cpp
@@ -120,10 +120,10 @@ void PoliceMaze::setPauseState(bool state) {
warning("PAUSE: %d", state);
_isPaused = state;
- uint32 t = _vm->_time->current();
+ uint32 timeNow = _vm->_time->current();
for (int i = 0; i < kNumMazeTracks; i++) {
- _tracks[i]->setTime(t);
+ _tracks[i]->setTime(timeNow);
}
}
@@ -256,8 +256,8 @@ bool PoliceMazeTargetTrack::tick() {
uint32 oldTime = _time;
_time = _vm->_time->current();
- int32 timeDiff = _time - oldTime;
- _timeLeftUpdate -= timeDiff;
+ uint32 timeDiff = _time - oldTime; // unsigned difference is intentional
+ _timeLeftUpdate = _timeLeftUpdate - (int32)timeDiff; // should be ok
if (_timeLeftUpdate > 0) {
return false;
@@ -265,8 +265,9 @@ bool PoliceMazeTargetTrack::tick() {
#if BLADERUNNER_ORIGINAL_BUGS
#else
+ // here _timeLeftUpdate is <= 0
if (_vm->_settings->getDifficulty() > kGameDifficultyEasy) {
- timeDiff = 0 - _timeLeftUpdate;
+ timeDiff = abs(_timeLeftUpdate);
}
#endif // BLADERUNNER_ORIGINAL_BUGS
_timeLeftUpdate = 66; // update the target track 15 times per second
@@ -282,7 +283,7 @@ bool PoliceMazeTargetTrack::tick() {
if (_vm->_settings->getDifficulty() == kGameDifficultyEasy) {
_timeLeftWait -= timeDiff; // original behavior
} else {
- _timeLeftWait -= (timeDiff + _timeLeftUpdate); // this deducts an amount >= 66
+ _timeLeftWait = _timeLeftWait - (int32)(timeDiff + _timeLeftUpdate); // this deducts an amount >= 66 // should be ok
}
#endif // BLADERUNNER_ORIGINAL_BUGS
if (_timeLeftWait > 0) {