aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanasis Antoniou2019-04-02 15:42:26 +0300
committerThanasis Antoniou2019-04-02 15:46:14 +0300
commit65166efb22b0fdd28c3b7845c4aef1f4342c5ded (patch)
tree943e5fa47f06370408103a1bfbbe6a119d443bc7
parent43e04d19c4e398989a1ba7184d49657b7cedb1cf (diff)
downloadscummvm-rg350-65166efb22b0fdd28c3b7845c4aef1f4342c5ded.tar.gz
scummvm-rg350-65166efb22b0fdd28c3b7845c4aef1f4342c5ded.tar.bz2
scummvm-rg350-65166efb22b0fdd28c3b7845c4aef1f4342c5ded.zip
BLADERUNNER: Fix for corrupt incomplete autosaves
Autosaving overrides other conditions that don't allow proper saving
-rw-r--r--engines/bladerunner/bladerunner.cpp31
-rw-r--r--engines/bladerunner/bladerunner.h3
-rw-r--r--engines/bladerunner/script/script.cpp2
3 files changed, 24 insertions, 12 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 5b858b53c0..ce96fe96cd 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -116,10 +116,11 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
_playerActorIdle = false;
_playerDead = false;
- _gameOver = false;
- _gameAutoSave = -1;
- _gameIsLoading = false;
- _sceneIsLoading = false;
+ _gameOver = false;
+ _gameAutoSaveTextId = -1;
+ _gameIsAutoSaving = false;
+ _gameIsLoading = false;
+ _sceneIsLoading = false;
_runningActorId = -1;
_isWalkingInterruptible = false;
@@ -282,7 +283,6 @@ Common::Error BladeRunnerEngine::saveGameState(int slot, const Common::String &d
header._name = desc;
BladeRunner::SaveFileManager::writeHeader(*saveFile, header);
-
_time->pause();
saveGame(*saveFile, thumbnail);
_time->resume();
@@ -331,6 +331,14 @@ Common::Error BladeRunnerEngine::run() {
_mouse->disable();
if (_gameOver) {
+ // In the original game this created a single "END_GAME_STATE.END"
+ // which had the a valid format of a save game but was never accessed
+ // from the loading screen. (Due to the .END extension)
+ // It was also a single file that was overwritten each time the player
+ // finished the game.
+ // Maybe its purpose was debugging (?) by renaming it to .SAV and also
+ // for the game to "know" if the player has already finished the game at least once (?)
+ // although that latter one seems not to be used for anything.
autoSaveGame(4, true);
_endCredits->show();
}
@@ -856,9 +864,9 @@ void BladeRunnerEngine::gameTick() {
}
}
- if (_gameAutoSave >= 0) {
- autoSaveGame(_gameAutoSave, false);
- _gameAutoSave = -1;
+ if (_gameAutoSaveTextId >= 0) {
+ autoSaveGame(_gameAutoSaveTextId, false);
+ _gameAutoSaveTextId = -1;
}
//probably not needed, this version of tick is just loading data from buffer
@@ -1811,7 +1819,9 @@ void BladeRunnerEngine::playerDied() {
}
bool BladeRunnerEngine::saveGame(Common::WriteStream &stream, const Graphics::Surface &thumbnail) {
- if (!playerHasControl() || _sceneScript->isInsideScript() || _aiScripts->isInsideScript()) {
+ if ( !_gameIsAutoSaving
+ && ( !playerHasControl() || _sceneScript->isInsideScript() || _aiScripts->isInsideScript())
+ ){
return false;
}
@@ -1977,6 +1987,7 @@ void BladeRunnerEngine::autoSaveGame(int textId, bool endgame) {
if (!textAutoSave.open("AUTOSAVE")) {
return;
}
+ _gameIsAutoSaving = true;
SaveStateList saveList = BladeRunner::SaveFileManager::list(getTargetName());
@@ -1999,7 +2010,7 @@ void BladeRunnerEngine::autoSaveGame(int textId, bool endgame) {
} else {
saveGameState(slot, textAutoSave.getText(textId));
}
-
+ _gameIsAutoSaving = false;
}
void BladeRunnerEngine::ISez(const Common::String &str) {
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 1df3c35cdc..a06daf2dd7 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -194,7 +194,8 @@ public:
bool _actorIsSpeaking;
bool _actorSpeakStopIsRequested;
bool _gameOver;
- int _gameAutoSave;
+ int _gameAutoSaveTextId;
+ bool _gameIsAutoSaving;
bool _gameIsLoading;
bool _sceneIsLoading;
bool _vqaIsPlaying;
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 63bfa43fb4..15b6067030 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -1560,7 +1560,7 @@ bool ScriptBase::Game_Over() {
void ScriptBase::Autosave_Game(int textId) {
debugC(kDebugScript, "Autosave_Game(%d)", textId);
- _vm->_gameAutoSave = textId;
+ _vm->_gameAutoSaveTextId = textId;
}
void ScriptBase::I_Sez(const char *str) {