mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-12 22:51:11 +00:00
ADL: Fix hires6 canSaveGameStateCurrently()
This commit is contained in:
parent
f0b1c46caf
commit
516815d5f5
@ -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))
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user