aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/bladerunner.cpp
diff options
context:
space:
mode:
authorThanasis Antoniou2019-05-31 16:42:31 +0300
committerThanasis Antoniou2019-05-31 16:43:10 +0300
commit35daa692aff1cb2d6aa0cbca3480fa8c50be55c6 (patch)
tree47276958b4d407440b0a1b13670961f144d793fc /engines/bladerunner/bladerunner.cpp
parent2b2c8d6f9390229c7dd9a5cc805641979bea6b64 (diff)
downloadscummvm-rg350-35daa692aff1cb2d6aa0cbca3480fa8c50be55c6.tar.gz
scummvm-rg350-35daa692aff1cb2d6aa0cbca3480fa8c50be55c6.tar.bz2
scummvm-rg350-35daa692aff1cb2d6aa0cbca3480fa8c50be55c6.zip
BLADERUNNER: Fix bad timer initialization for actors after LOAD
Diffstat (limited to 'engines/bladerunner/bladerunner.cpp')
-rw-r--r--engines/bladerunner/bladerunner.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 6fc8dda67c..3d20423c39 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -254,7 +254,12 @@ Common::Error BladeRunnerEngine::loadGameState(int slot) {
if (!BladeRunner::SaveFileManager::readHeader(*saveFile, header)) {
error("Invalid savegame");
}
+
setTotalPlayTime(header._playTime);
+ // this essentially does something similar with setTotalPlayTime
+ // reseting and updating Blade Runner's _pauseStart and offset before starting a loaded game
+ _time->resetPauseStart();
+
loadGame(*saveFile);
delete saveFile;
@@ -336,8 +341,17 @@ Common::Error BladeRunnerEngine::run() {
// end of additional code for gracefully handling end-game
if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") != -1) {
+ // when loading from ScummVM main menu, we should emulate
+ // the Kia pause/resume in order to get a valid "current" time when the game
+ // is actually loaded (assuming delays can be introduced by a popup warning dialogue)
+ if(!_time->isLocked()) {
+ _time->pause();
+ }
loadGameState(ConfMan.getInt("save_slot"));
ConfMan.set("save_slot", "-1");
+ if(_time->isLocked()) {
+ _time->resume();
+ }
} else if (hasSavegames) {
_kia->_forceOpen = true;
_kia->open(kKIASectionLoad);
@@ -402,7 +416,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
_surfaceBack.create(640, 480, screenPixelFormat());
_time = new Time(this);
-
// Try to load the SUBTITLES.MIX first, before Startup.MIX
// allows overriding any identically named resources (such as the original font files and as a bonus also the TRE files for the UI and dialogue menu)
_subtitles = new Subtitles(this);
@@ -972,6 +985,8 @@ void BladeRunnerEngine::gameTick() {
_overlays->tick();
if (!inDialogueMenu) {
+ // TODO This is probably responsible for actors getting stuck in place
+ // after reaching a waypoint when dialoge menu is open
actorsUpdate();
}