aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWalter van Niftrik2017-02-23 16:01:46 +0100
committerWalter van Niftrik2017-02-23 16:12:48 +0100
commit516815d5f5f47f3e83576975eaa3e95b64719340 (patch)
treeab8227417ffa6afeaf86252ec062c5ca1f9b6c8c /engines
parentf0b1c46caf097b8e6f65047642e6f64a205e9329 (diff)
downloadscummvm-rg350-516815d5f5f47f3e83576975eaa3e95b64719340.tar.gz
scummvm-rg350-516815d5f5f47f3e83576975eaa3e95b64719340.tar.bz2
scummvm-rg350-516815d5f5f47f3e83576975eaa3e95b64719340.zip
ADL: Fix hires6 canSaveGameStateCurrently()
Diffstat (limited to 'engines')
-rw-r--r--engines/adl/adl.cpp6
-rw-r--r--engines/adl/adl.h2
-rw-r--r--engines/adl/adl_v2.cpp10
-rw-r--r--engines/adl/adl_v2.h3
-rw-r--r--engines/adl/hires6.cpp19
5 files changed, 39 insertions, 1 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 1f0b0b173a..3887fa92d9 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -891,6 +891,12 @@ bool AdlEngine::canSaveGameStateCurrently() {
// Here we check whether or not the game currently accepts the command
// "SAVE GAME". This prevents saving via the GMM in situations where
// it wouldn't otherwise be possible to do so.
+ for (cmd = _roomData.commands.begin(); cmd != _roomData.commands.end(); ++cmd) {
+ ScriptEnv env(*cmd, _state.room, _saveVerb, _saveNoun);
+ if (matchCommand(env))
+ return env.op() == IDO_ACT_SAVE;
+ }
+
for (cmd = _roomCommands.begin(); cmd != _roomCommands.end(); ++cmd) {
ScriptEnv env(*cmd, _state.room, _saveVerb, _saveNoun);
if (matchCommand(env))
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 3ac99c465b..75c6485a1f 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -239,6 +239,7 @@ protected:
// Engine
Common::Error loadGameState(int slot);
Common::Error saveGameState(int slot, const Common::String &desc);
+ bool canSaveGameStateCurrently();
virtual void gameLoop();
virtual void loadState(Common::ReadStream &stream);
@@ -411,7 +412,6 @@ private:
Common::Error run();
bool hasFeature(EngineFeature f) const;
bool canLoadGameStateCurrently();
- bool canSaveGameStateCurrently();
// Text input
byte convertKey(uint16 ascii) const;
diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp
index 5392526746..23294391ab 100644
--- a/engines/adl/adl_v2.cpp
+++ b/engines/adl/adl_v2.cpp
@@ -611,6 +611,16 @@ int AdlEngine_v2::o2_initDisk(ScriptEnv &e) {
return 0;
}
+bool AdlEngine_v2::canSaveGameStateCurrently() {
+ // Back up first visit flag as it may be changed by this test
+ const bool isFirstTime = getCurRoom().isFirstTime;
+ const bool retval = AdlEngine::canSaveGameStateCurrently();
+
+ getCurRoom().isFirstTime = isFirstTime;
+
+ return retval;
+}
+
int AdlEngine_v2::askForSlot(const Common::String &question) {
while (1) {
_display->printString(question);
diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h
index 63d22975e3..9d4d5fa600 100644
--- a/engines/adl/adl_v2.h
+++ b/engines/adl/adl_v2.h
@@ -51,6 +51,9 @@ protected:
virtual void showRoom();
void takeItem(byte noun);
+ // Engine
+ bool canSaveGameStateCurrently();
+
virtual DataBlockPtr readDataBlockPtr(Common::ReadStream &f) const;
virtual void adjustDataBlockPtr(byte &track, byte &sector, byte &offset, byte &size) const { }
void loadItems(Common::ReadStream &stream);
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index 0f21a14dd0..0eb47de7fc 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -58,6 +58,9 @@ private:
// AdlEngine_v2
void printString(const Common::String &str);
+ // Engine
+ bool canSaveGameStateCurrently();
+
template <Direction D>
int o_goDirection(ScriptEnv &e);
int o_fluteSound(ScriptEnv &e);
@@ -202,6 +205,22 @@ int HiRes6Engine::o_fluteSound(ScriptEnv &e) {
return 0;
}
+bool HiRes6Engine::canSaveGameStateCurrently() {
+ // Back up variables that may be changed by this test
+ const byte var2 = getVar(2);
+ const byte var24 = getVar(24);
+ const bool abortScript = _abortScript;
+
+ const bool retval = AdlEngine_v5::canSaveGameStateCurrently();
+
+ setVar(2, var2);
+ setVar(24, var24);
+ _abortScript = abortScript;
+
+ return retval;
+}
+
+
#define SECTORS_PER_TRACK 16
#define BYTES_PER_SECTOR 256