[Scummvm-git-logs] scummvm master -> 516815d5f5f47f3e83576975eaa3e95b64719340
waltervn
walter at vanniftrik-it.nl
Thu Feb 23 16:15:04 CET 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
516815d5f5 ADL: Fix hires6 canSaveGameStateCurrently()
Commit: 516815d5f5f47f3e83576975eaa3e95b64719340
https://github.com/scummvm/scummvm/commit/516815d5f5f47f3e83576975eaa3e95b64719340
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2017-02-23T16:12:48+01:00
Commit Message:
ADL: Fix hires6 canSaveGameStateCurrently()
Changed paths:
engines/adl/adl.cpp
engines/adl/adl.h
engines/adl/adl_v2.cpp
engines/adl/adl_v2.h
engines/adl/hires6.cpp
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 1f0b0b1..3887fa9 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 3ac99c4..75c6485 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 5392526..2329439 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 63d2297..9d4d5fa 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 §or, byte &offset, byte &size) const { }
void loadItems(Common::ReadStream &stream);
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index 0f21a14..0eb47de 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
More information about the Scummvm-git-logs
mailing list