aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2017-11-15 23:17:07 +0000
committerThierry Crozat2018-01-23 02:15:40 +0000
commitb39beb43fd9e9cbbebc0a6bb035ed6cc809f6385 (patch)
tree5a9c104b946e136a0d07ff60e1c26de62f749155
parent45595b9683b9d8ba88bf94d2ba8aaa931551865c (diff)
downloadscummvm-rg350-b39beb43fd9e9cbbebc0a6bb035ed6cc809f6385.tar.gz
scummvm-rg350-b39beb43fd9e9cbbebc0a6bb035ed6cc809f6385.tar.bz2
scummvm-rg350-b39beb43fd9e9cbbebc0a6bb035ed6cc809f6385.zip
SUPERNOVA: Fix initialization of timer when starting or loading game
-rw-r--r--engines/supernova/state.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp
index 27ad9da381..7291152f48 100644
--- a/engines/supernova/state.cpp
+++ b/engines/supernova/state.cpp
@@ -108,6 +108,8 @@ bool GameManager::deserialize(Common::ReadStream *in, int version) {
_state._powerOff = in->readByte();
_state._dream = in->readByte();
+ _oldTime = g_system->getMillis();
+
// Inventory
int inventorySize = in->readSint32LE();
_inventoryScroll = in->readSint32LE();
@@ -324,7 +326,7 @@ void GameManager::initState() {
_mouseY = -1;
_mouseField = -1;
_inventoryScroll = 0;
- _oldTime = 0;
+ _oldTime = g_system->getMillis();
_timerPaused = 0;
_timePaused = false;
_timer1 = 0;
@@ -1250,7 +1252,8 @@ void GameManager::setAnimationTimer(int ticks) {
void GameManager::handleTime() {
if (_timerPaused)
return;
- int32 delta = g_system->getMillis() - _oldTime;
+ int32 newTime = g_system->getMillis();
+ int32 delta = newTime - _oldTime;
_state._time += delta;
if (_state._time > 86400000)
_state._time -= 86400000; // 24h wrap around
@@ -1259,7 +1262,7 @@ void GameManager::handleTime() {
else
_animationTimer = 0;
- _oldTime = g_system->getMillis();
+ _oldTime = newTime;
}
void GameManager::pauseTimer(bool pause) {