From 297ebb73e0e922c635397086cdca46cd8d00c74b Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Wed, 15 May 2019 22:52:00 +0300 Subject: BLADERUNNER: Warning if loading restored cut content save in original mode And vice versa. The game won't exit, it will continue loading but adjust the mode accordingly Also added a incremental version number for the save games (as a global variable), for possible future use --- engines/bladerunner/bladerunner.cpp | 25 ++++++++++++++++++++++++- engines/bladerunner/bladerunner.h | 5 +++++ engines/bladerunner/game_constants.h | 5 +++-- engines/bladerunner/script/init_script.cpp | 5 +++++ engines/bladerunner/script/scene/ct02.cpp | 3 +++ engines/bladerunner/script/scene/ma04.cpp | 4 ---- 6 files changed, 40 insertions(+), 7 deletions(-) diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 44a59e1182..8cd9df7186 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -1985,12 +1985,36 @@ bool BladeRunnerEngine::loadGame(Common::SeekableReadStream &stream) { _scene->_set->load(s); for (uint i = 0; i != _gameInfo->getGlobalVarCount(); ++i) { _gameVars[i] = s.readInt(); + if (i == 3 && _gameVars[i] != kBladeRunnerScummVMVersion) { + warning("This game was saved using an older version of the engine (v%d), currently the engine is at v%d", _gameVars[i], kBladeRunnerScummVMVersion); + } } _music->load(s); // _audioPlayer->load(s) // zero func // _audioSpeech->load(s) // zero func _combat->load(s); _gameFlags->load(s); + + if ((_gameFlags->query(kFlagGamePlayedInRestoredContentMode) && !_cutContent) + || (!_gameFlags->query(kFlagGamePlayedInRestoredContentMode) && _cutContent) + ){ + Common::String warningMsg; + if (!_cutContent) { + warningMsg = "WARNING: This game was saved in Restored Cut Content mode, but you are playing in Original Content mode. The mode will be adjusted to Restored Cut Content for this session until you completely Quit the game."; + } else { + warningMsg = "WARNING: This game was saved in Original Content mode, but you are playing in Restored Cut Content mode. The mode will be adjusted to Original Content mode for this session until you completely Quit the game."; + } + GUI::MessageDialog dialog(warningMsg, "Continue", 0); + dialog.runModal(); + _cutContent = !_cutContent; + // force a Key Up event, since we need it to remove the KIA + // but it's lost due to the modal dialogue + Common::EventManager *eventMan = _system->getEventManager(); + Common::Event event; + event.type = Common::EVENT_KEYUP; + eventMan->pushEvent(event); + } + _items->load(s); _sceneObjects->load(s); _ambientSounds->load(s); @@ -2018,7 +2042,6 @@ bool BladeRunnerEngine::loadGame(Common::SeekableReadStream &stream) { _settings->setNewSetAndScene(_settings->getSet(), _settings->getScene()); _settings->setChapter(_settings->getChapter()); - return true; } diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index 267001a4fd..33ab032bb8 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -110,6 +110,11 @@ public: static const int kArchiveCount = 12; // +2 to original value (10) to accommodate for SUBTITLES.MIX and one extra resource file, to allow for capability of loading all VQAx.MIX and the MODE.MIX file (debug purposes) static const int kActorCount = 100; static const int kActorVoiceOver = kActorCount - 1; + // Incremental number to keep track of significant revisions of the ScummVM bladerunner engine + // that could potentially introduce incompatibilities with old save files or require special actions to restore compatibility + // This is stored in game global variable "kVariableGameVersion" + // Original (classic) save game files will have version number of 0 + static const int kBladeRunnerScummVMVersion = 1; // 1: alpha testing (since May 15, 2019) bool _gameIsRunning; bool _windowIsActive; diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h index 1670b19fe3..c1163a8662 100644 --- a/engines/bladerunner/game_constants.h +++ b/engines/bladerunner/game_constants.h @@ -441,7 +441,7 @@ enum SpinnerDestinations { enum Flags { kFlagNotUsed0 = 0, // is never checked kFlagRC02Entered = 1, - // 2 is never used + kFlagGamePlayedInRestoredContentMode = 2, // Re-purposed. Original: 2 is never used kFlagRC01GotOfficersStatement = 3, kFlagRC02Left = 4, // 5 is never used @@ -1174,7 +1174,8 @@ enum Flags { enum Variables { kVariableChapter = 1, kVariableChinyen = 2, - // variables 3 - 8 are not used + kVariableGameVersion = 3, // re-purposed, original: not used, so it would have value of 0 in the classic version + // variables 4 - 8 are not used kVariablePoliceMazeScore = 9, kVariablePoliceMazePS10TargetCounter = 10, kVariablePoliceMazePS11TargetCounter = 11, diff --git a/engines/bladerunner/script/init_script.cpp b/engines/bladerunner/script/init_script.cpp index e60dbbfe67..aa16a3b83e 100644 --- a/engines/bladerunner/script/init_script.cpp +++ b/engines/bladerunner/script/init_script.cpp @@ -61,6 +61,7 @@ void InitScript::Init_Globals() { Global_Variable_Set(kVariableGenericWalkerConfig, 2); Global_Variable_Set(kVariableChapter, 1); Global_Variable_Set(kVariableChinyen, 100); + Global_Variable_Set(kVariableGameVersion, _vm->kBladeRunnerScummVMVersion); Set_Score(0, 0); Set_Score(1, 64); @@ -125,6 +126,10 @@ void InitScript::Init_Game_Flags() { Game_Flag_Set(kFlagMcCoyInRunciters); Game_Flag_Set(kFlagSpinnerAtRC01); + + if (_vm->_cutContent) { + Game_Flag_Set(kFlagGamePlayedInRestoredContentMode); + } } void InitScript::Init_Clues() { diff --git a/engines/bladerunner/script/scene/ct02.cpp b/engines/bladerunner/script/scene/ct02.cpp index aef8e45c56..4657e3a647 100644 --- a/engines/bladerunner/script/scene/ct02.cpp +++ b/engines/bladerunner/script/scene/ct02.cpp @@ -219,6 +219,9 @@ void SceneScriptCT02::dialogueWithZuben() { Actor_Clue_Acquire(kActorMcCoy, kClueZubenRunsAway, true, -1); Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT02PushPot); Game_Flag_Set(kFlagCT02PotTipped); + if (_vm->_cutContent) { + Game_Flag_Set(kFlagCT01TalkToHowieAfterZubenMissing); + } Scene_Loop_Set_Default(kCT02LoopMainPotTipped); Scene_Loop_Start_Special(kSceneLoopModeOnce, kCT02LoopTippingPot, true); } diff --git a/engines/bladerunner/script/scene/ma04.cpp b/engines/bladerunner/script/scene/ma04.cpp index 9bf36a6ed8..b196972457 100644 --- a/engines/bladerunner/script/scene/ma04.cpp +++ b/engines/bladerunner/script/scene/ma04.cpp @@ -312,10 +312,6 @@ void SceneScriptMA04::PlayerWalkedIn() { Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 955.0f, 1675.0f, 0, true, false, false); Game_Flag_Set(kFlagChapter1Ending); - if (_vm->_cutContent) { - Game_Flag_Set(kFlagCT01TalkToHowieAfterZubenMissing); - } - Async_Actor_Walk_To_XYZ(kActorMcCoy, -7204.0f, 956.17f, 1568.0f, 0, false); Set_Enter(kSetMA05, kSceneMA05); } -- cgit v1.2.3