diff options
author | Walter van Niftrik | 2016-03-18 22:52:22 +0100 |
---|---|---|
committer | Walter van Niftrik | 2016-06-06 20:35:49 +0200 |
commit | 8d1901c39bbfd22ff3540e2db68897f2aae652d9 (patch) | |
tree | 077b7211f6c6456fb3f4d87f864b44ca25b47954 | |
parent | fab489c530fb89ce92dcfa0ce62f0ca2f3dcc676 (diff) | |
download | scummvm-rg350-8d1901c39bbfd22ff3540e2db68897f2aae652d9.tar.gz scummvm-rg350-8d1901c39bbfd22ff3540e2db68897f2aae652d9.tar.bz2 scummvm-rg350-8d1901c39bbfd22ff3540e2db68897f2aae652d9.zip |
ADL: Implement hires2 cond opcodes 0x01 and 0x04
-rw-r--r-- | engines/adl/adl.h | 1 | ||||
-rw-r--r-- | engines/adl/adl_v2.cpp | 28 | ||||
-rw-r--r-- | engines/adl/adl_v2.h | 2 | ||||
-rw-r--r-- | engines/adl/hires2.cpp | 2 |
4 files changed, 31 insertions, 2 deletions
diff --git a/engines/adl/adl.h b/engines/adl/adl.h index d4fe9ed8dc..9e29d1f08a 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -76,6 +76,7 @@ struct Room { byte offset; byte picture; byte curPicture; + bool isFirstTime; }; struct Picture { diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp index 6c6a710a55..7560504c3c 100644 --- a/engines/adl/adl_v2.cpp +++ b/engines/adl/adl_v2.cpp @@ -43,7 +43,7 @@ void AdlEngine_v2::setupOpcodeTables() { OpcodeUnImpl(); Opcode(o2_isItemInRoom); // 0x04 - OpcodeUnImpl(); + Opcode(o2_isNounNotInRoom); Opcode(o1_isMovesGrEq); Opcode(o1_isVarEq); OpcodeUnImpl(); @@ -93,6 +93,17 @@ void AdlEngine_v2::setupOpcodeTables() { Opcode(o1_setRoomPic); } +int AdlEngine_v2::o2_isFirstTime(ScriptEnv &e) { + bool oldFlag = getCurRoom().isFirstTime; + + getCurRoom().isFirstTime = false; + + if (!oldFlag) + return -1; + + return 0; +} + int AdlEngine_v2::o2_isItemInRoom(ScriptEnv &e) { byte room = e.arg(2); @@ -105,6 +116,21 @@ int AdlEngine_v2::o2_isItemInRoom(ScriptEnv &e) { return 2; } +int AdlEngine_v2::o2_isNounNotInRoom(ScriptEnv &e) { + Common::Array<Item>::const_iterator item; + + byte room = e.arg(1); + + if (room == IDI_CUR_ROOM) + room = _state.room; + + for (item = _state.items.begin(); item != _state.items.end(); ++item) + if (item->noun == e.getNoun() && (item->room == room)) + return -1; + + return 1; +} + int AdlEngine_v2::o2_moveItem(ScriptEnv &e) { byte room = e.arg(2); diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h index 2e8b0f0671..61c811b02f 100644 --- a/engines/adl/adl_v2.h +++ b/engines/adl/adl_v2.h @@ -39,7 +39,9 @@ protected: virtual void setupOpcodeTables(); + int o2_isFirstTime(ScriptEnv &e); int o2_isItemInRoom(ScriptEnv &e); + int o2_isNounNotInRoom(ScriptEnv &e); int o2_moveItem(ScriptEnv &e); }; diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp index b99f9fc3c5..6f517dacdb 100644 --- a/engines/adl/hires2.cpp +++ b/engines/adl/hires2.cpp @@ -142,7 +142,7 @@ void HiRes2Engine::initState() { f.readByte(); // always 1, possibly disk? room.picture = f.readByte(); room.curPicture = f.readByte(); - f.readByte(); // always 1, possibly disk? + room.isFirstTime = f.readByte(); _state.rooms.push_back(room); } |