aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBastien Bouclet2018-06-21 07:05:10 +0200
committerBastien Bouclet2018-06-29 13:31:54 +0200
commita722fe119429f9a8a2ad4078288a07418af20ec6 (patch)
tree73d5b4a482e578a2355d1df875cf6c4e583e7e9a /engines
parentd848ebe85a2954263219ae64fd5183129dc74df6 (diff)
downloadscummvm-rg350-a722fe119429f9a8a2ad4078288a07418af20ec6.tar.gz
scummvm-rg350-a722fe119429f9a8a2ad4078288a07418af20ec6.tar.bz2
scummvm-rg350-a722fe119429f9a8a2ad4078288a07418af20ec6.zip
MOHAWK: RIVEN: Fix saving while in the menu
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/riven.cpp46
-rw-r--r--engines/mohawk/riven.h3
2 files changed, 31 insertions, 18 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 69a06ac228..6e386129d9 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -73,8 +73,8 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
_inventory = nullptr;
_lastSaveTime = 0;
- _prevCard = -1;
- _prevStack = -1;
+ _menuSavedCard = -1;
+ _menuSavedStack = -1;
DebugMan.addDebugChannel(kRivenDebugScript, "Script", "Track Script Execution");
DebugMan.addDebugChannel(kRivenDebugPatches, "Patches", "Track Script Patching");
@@ -278,7 +278,7 @@ void MohawkEngine_Riven::doFrame() {
case Common::KEYCODE_ESCAPE:
if (!_scriptMan->hasQueuedScripts()) {
// Check if we haven't jumped to menu
- if (_prevStack == -1) {
+ if (_menuSavedStack == -1) {
goToMainMenu();
} else {
resumeFromMainMenu();
@@ -327,13 +327,13 @@ void MohawkEngine_Riven::doFrame() {
}
void MohawkEngine_Riven::goToMainMenu() {
- _prevStack = _stack->getId();
- _prevCard = _card->getId();
+ _menuSavedStack = _stack->getId();
+ _menuSavedCard = _card->getId();
// If we are already in menu, do not call again
- if (_prevStack == kStackAspit && _prevCard == 1) {
- _prevStack = -1;
- _prevCard = -1;
+ if (_menuSavedStack == kStackAspit && _menuSavedCard == 1) {
+ _menuSavedStack = -1;
+ _menuSavedCard = -1;
return;
}
@@ -342,16 +342,16 @@ void MohawkEngine_Riven::goToMainMenu() {
}
void MohawkEngine_Riven::resumeFromMainMenu() {
- assert(_prevStack != -1);
+ assert(_menuSavedStack != -1);
- changeToStack(_prevStack);
- changeToCard(_prevCard);
- _prevStack = -1;
- _prevCard = -1;
+ changeToStack(_menuSavedStack);
+ changeToCard(_menuSavedCard);
+ _menuSavedStack = -1;
+ _menuSavedCard = -1;
}
bool MohawkEngine_Riven::isGameStarted() const {
- return _stack->getId() != kStackAspit || _prevStack != -1;
+ return _stack->getId() != kStackAspit || _menuSavedStack != -1;
}
void MohawkEngine_Riven::pauseEngineIntern(bool pause) {
@@ -614,8 +614,8 @@ Common::Error MohawkEngine_Riven::loadGameState(int slot) {
Common::Error loadError = _saveLoad->loadGame(slot);
if (loadError.getCode() == Common::kNoError) {
- _prevStack = -1;
- _prevCard = -1;
+ _menuSavedStack = -1;
+ _menuSavedCard = -1;
}
return loadError;
@@ -633,7 +633,19 @@ void MohawkEngine_Riven::loadGameStateAndDisplayError(int slot) {
}
Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc) {
- return _saveLoad->saveGame(slot, desc, false);
+ if (_menuSavedStack != -1) {
+ _vars["CurrentStackID"] = _menuSavedStack;
+ _vars["CurrentCardID"] = _menuSavedCard;
+ }
+
+ Common::Error error = _saveLoad->saveGame(slot, desc, false);
+
+ if (_menuSavedStack != -1) {
+ _vars["CurrentStackID"] = 1;
+ _vars["CurrentCardID"] = 1;
+ }
+
+ return error;
}
void MohawkEngine_Riven::saveGameStateAndDisplayError(int slot, const Common::String &desc) {
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index dd26f515c2..36bb2008b8 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -120,7 +120,8 @@ private:
RivenCard *_card;
RivenStack *_stack;
- int _prevCard, _prevStack;
+ int _menuSavedCard;
+ int _menuSavedStack;
bool _gameEnded;
uint32 _lastSaveTime;