diff options
-rw-r--r-- | engines/adl/adl.cpp | 4 | ||||
-rw-r--r-- | engines/adl/adl_v2.cpp | 7 | ||||
-rw-r--r-- | engines/adl/adl_v2.h | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index e2025b9b3d..a09ec69cd5 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -1040,7 +1040,7 @@ bool AdlEngine::matchCommand(ScriptEnv &env) const { for (uint i = 0; i < env.getCondCount(); ++i) { byte op = env.op(); - if (!_condOpcodes[op] || !_condOpcodes[op]->isValid()) + if (op >= _condOpcodes.size() || !_condOpcodes[op] || !_condOpcodes[op]->isValid()) error("Unimplemented condition opcode %02x", op); int numArgs = (*_condOpcodes[op])(env); @@ -1058,7 +1058,7 @@ void AdlEngine::doActions(ScriptEnv &env) { for (uint i = 0; i < env.getActCount(); ++i) { byte op = env.op(); - if (!_actOpcodes[op] || !_actOpcodes[op]->isValid()) + if (op >= _actOpcodes.size() || !_actOpcodes[op] || !_actOpcodes[op]->isValid()) error("Unimplemented action opcode %02x", op); int numArgs = (*_actOpcodes[op])(env); diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp index e5e02d20fd..3db013deb1 100644 --- a/engines/adl/adl_v2.cpp +++ b/engines/adl/adl_v2.cpp @@ -101,6 +101,7 @@ void AdlEngine_v2::setupOpcodeTables() { Opcode(o1_dropItem); Opcode(o1_setRoomPic); Opcode(o2_tellTime); + Opcode(o2_setRoomFromVar); } bool AdlEngine_v2::matchesCurrentPic(byte pic) const { @@ -280,4 +281,10 @@ int AdlEngine_v2::o2_tellTime(ScriptEnv &e) { return 0; } +int AdlEngine_v2::o2_setRoomFromVar(ScriptEnv &e) { + getCurRoom().curPicture = getCurRoom().picture; + _state.room = getVar(e.arg(1)); + return 1; +} + } // End of namespace Adl diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h index d4847193d0..01aa57c7af 100644 --- a/engines/adl/adl_v2.h +++ b/engines/adl/adl_v2.h @@ -62,6 +62,7 @@ protected: int o2_moveAllItems(ScriptEnv &e); int o2_placeItem(ScriptEnv &e); int o2_tellTime(ScriptEnv &e); + int o2_setRoomFromVar(ScriptEnv &e); struct { Common::String time; |