Skip to content

Commit

Permalink
ADL: Fix hires6 conditional opcode 0x0a
Browse files Browse the repository at this point in the history
  • Loading branch information
waltervn committed Feb 15, 2017
1 parent 832a0dc commit 41f097f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
26 changes: 11 additions & 15 deletions engines/adl/adl.cpp
Expand Up @@ -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(),
Expand Down Expand Up @@ -1320,42 +1320,38 @@ 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;
}

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);
// The original long jumps on restart, so we need to abort here
if (_isRestarting)
return;
}
}

_skipOneCommand = false;
if (_abortScript) {
_abortScript = false;
return;
}
}
}

Common::String AdlEngine::toAscii(const Common::String &str) {
Expand Down
2 changes: 1 addition & 1 deletion engines/adl/adl.h
Expand Up @@ -391,7 +391,7 @@ friend class Console;

bool _isRestarting, _isRestoring, _isQuitting;
bool _canSaveNow, _canRestoreNow;
bool _skipOneCommand;
bool _abortScript;

const AdlGameDescription *_gameDescription;

Expand Down
8 changes: 4 additions & 4 deletions engines/adl/adl_v5.cpp
Expand Up @@ -66,7 +66,7 @@ void AdlEngine_v5::setupOpcodeTables() {
// 0x08
Opcode(o4_isVarGT);
Opcode(o1_isCurPicEQ);
Opcode(o5_skipOneCommand);
Opcode(o5_abortScript);

SetOpcodeTable(_actOpcodes);
// 0x00
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion engines/adl/adl_v5.h
Expand Up @@ -41,7 +41,7 @@ class AdlEngine_v5 : public AdlEngine_v4 {
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);
Expand Down

0 comments on commit 41f097f

Please sign in to comment.