From 41f097fe1ab3057f246f76936a58546b30610e8f Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Wed, 15 Feb 2017 22:20:22 +0100 Subject: ADL: Fix hires6 conditional opcode 0x0a --- engines/adl/adl.cpp | 26 +++++++++++--------------- engines/adl/adl.h | 2 +- engines/adl/adl_v5.cpp | 8 ++++---- engines/adl/adl_v5.h | 2 +- 4 files changed, 17 insertions(+), 21 deletions(-) (limited to 'engines/adl') diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index 845fc524e1..34e398de91 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -58,7 +58,7 @@ AdlEngine::AdlEngine(OSystem *syst, const AdlGameDescription *gd) : _isRestarting(false), _isRestoring(false), _isQuitting(false), - _skipOneCommand(false), + _abortScript(false), _gameDescription(gd), _console(nullptr), _messageIds(), @@ -1320,20 +1320,18 @@ bool AdlEngine::doOneCommand(const Commands &commands, byte verb, byte noun) { Commands::const_iterator cmd; for (cmd = commands.begin(); cmd != commands.end(); ++cmd) { - - if (_skipOneCommand) { - _skipOneCommand = false; - continue; - } - ScriptEnv env(*cmd, _state.room, verb, noun); if (matchCommand(env)) { doActions(env); return true; } + + if (_abortScript) { + _abortScript = false; + return false; + } } - _skipOneCommand = false; return false; } @@ -1341,11 +1339,6 @@ void AdlEngine::doAllCommands(const Commands &commands, byte verb, byte noun) { Commands::const_iterator cmd; for (cmd = commands.begin(); cmd != commands.end(); ++cmd) { - if (_skipOneCommand) { - _skipOneCommand = false; - continue; - } - ScriptEnv env(*cmd, _state.room, verb, noun); if (matchCommand(env)) { doActions(env); @@ -1353,9 +1346,12 @@ void AdlEngine::doAllCommands(const Commands &commands, byte verb, byte noun) { if (_isRestarting) return; } - } - _skipOneCommand = false; + if (_abortScript) { + _abortScript = false; + return; + } + } } Common::String AdlEngine::toAscii(const Common::String &str) { diff --git a/engines/adl/adl.h b/engines/adl/adl.h index 3630cd69b9..75df3395d7 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -391,7 +391,7 @@ protected: bool _isRestarting, _isRestoring, _isQuitting; bool _canSaveNow, _canRestoreNow; - bool _skipOneCommand; + bool _abortScript; const AdlGameDescription *_gameDescription; diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp index 795899c070..be0c31a64c 100644 --- a/engines/adl/adl_v5.cpp +++ b/engines/adl/adl_v5.cpp @@ -66,7 +66,7 @@ void AdlEngine_v5::setupOpcodeTables() { // 0x08 Opcode(o4_isVarGT); Opcode(o1_isCurPicEQ); - Opcode(o5_skipOneCommand); + Opcode(o5_abortScript); SetOpcodeTable(_actOpcodes); // 0x00 @@ -131,10 +131,10 @@ int AdlEngine_v5::o5_isNounNotInRoom(ScriptEnv &e) { return 1; } -int AdlEngine_v5::o5_skipOneCommand(ScriptEnv &e) { - OP_DEBUG_0("\t&& SKIP_ONE_COMMAND()"); +int AdlEngine_v5::o5_abortScript(ScriptEnv &e) { + OP_DEBUG_0("\t&& ABORT_SCRIPT()"); - _skipOneCommand = true; + _abortScript = true; setVar(2, 0); return -1; diff --git a/engines/adl/adl_v5.h b/engines/adl/adl_v5.h index bb1cc3015a..7836ec6b04 100644 --- a/engines/adl/adl_v5.h +++ b/engines/adl/adl_v5.h @@ -41,7 +41,7 @@ protected: virtual RegionChunkType getRegionChunkType(const uint16 addr) const; int o5_isNounNotInRoom(ScriptEnv &e); - int o5_skipOneCommand(ScriptEnv &e); + int o5_abortScript(ScriptEnv &e); int o5_dummy(ScriptEnv &e); int o5_setTextMode(ScriptEnv &e); int o5_setRegionRoom(ScriptEnv &e); -- cgit v1.2.3