diff options
author | Walter van Niftrik | 2016-08-26 21:42:47 +0200 |
---|---|---|
committer | Walter van Niftrik | 2016-08-26 22:00:37 +0200 |
commit | 444fe0e64df11b26ba6d281c00ad365750550079 (patch) | |
tree | ffb145446b9408e35dc0d12333e44cd543b21bf9 /engines | |
parent | c1671b5d320fe4c58b883bb8bb4774288f1a1259 (diff) | |
download | scummvm-rg350-444fe0e64df11b26ba6d281c00ad365750550079.tar.gz scummvm-rg350-444fe0e64df11b26ba6d281c00ad365750550079.tar.bz2 scummvm-rg350-444fe0e64df11b26ba6d281c00ad365750550079.zip |
ADL: Implement inventory listing for v3 and v4
Diffstat (limited to 'engines')
-rw-r--r-- | engines/adl/adl_v3.cpp | 18 | ||||
-rw-r--r-- | engines/adl/adl_v3.h | 4 | ||||
-rw-r--r-- | engines/adl/adl_v4.cpp | 14 | ||||
-rw-r--r-- | engines/adl/adl_v4.h | 2 |
4 files changed, 36 insertions, 2 deletions
diff --git a/engines/adl/adl_v3.cpp b/engines/adl/adl_v3.cpp index 2e54195db4..6b93acde61 100644 --- a/engines/adl/adl_v3.cpp +++ b/engines/adl/adl_v3.cpp @@ -28,12 +28,18 @@ AdlEngine_v3::AdlEngine_v3(OSystem *syst, const AdlGameDescription *gd) : AdlEngine_v2(syst, gd) { } +Common::String AdlEngine_v3::getItemDescription(const Item &item) const { + return _itemDesc[item.description - 1]; +} + typedef Common::Functor1Mem<ScriptEnv &, int, AdlEngine_v3> OpcodeV3; void AdlEngine_v3::setupOpcodeTables() { AdlEngine_v2::setupOpcodeTables(); delete _condOpcodes[0x04]; _condOpcodes[0x04] = new OpcodeV3(this, &AdlEngine_v3::o3_isNounNotInRoom); + delete _actOpcodes[0x04]; + _actOpcodes[0x04] = new OpcodeV3(this, &AdlEngine_v3::o3_listInv); } int AdlEngine_v3::o3_isNounNotInRoom(ScriptEnv &e) { @@ -55,4 +61,16 @@ int AdlEngine_v3::o3_isNounNotInRoom(ScriptEnv &e) { return (isAnItem ? 1 : -1); } +int AdlEngine_v3::o3_listInv(ScriptEnv &e) { + OP_DEBUG_0("\tLIST_INVENTORY()"); + + Common::List<Item>::const_iterator item; + + for (item = _state.items.begin(); item != _state.items.end(); ++item) + if (item->room == IDI_ANY) + printString(_itemDesc[item->description - 1]); + + return 0; +} + } // End of namespace Adl diff --git a/engines/adl/adl_v3.h b/engines/adl/adl_v3.h index 097fa659ab..759b17cc6f 100644 --- a/engines/adl/adl_v3.h +++ b/engines/adl/adl_v3.h @@ -36,8 +36,12 @@ protected: // AdlEngine virtual void setupOpcodeTables(); + Common::String getItemDescription(const Item &item) const; int o3_isNounNotInRoom(ScriptEnv &e); + int o3_listInv(ScriptEnv &e); + + Common::Array<Common::String> _itemDesc; }; } // End of namespace Adl diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp index 598f0f01ee..602ee25683 100644 --- a/engines/adl/adl_v4.cpp +++ b/engines/adl/adl_v4.cpp @@ -107,7 +107,7 @@ void AdlEngine_v4::setupOpcodeTables() { Opcode(o1_varSub); Opcode(o1_varSet); // 0x04 - Opcode(o1_listInv); + Opcode(o4_listInv); Opcode(o4_moveItem); Opcode(o1_setRoom); Opcode(o2_setCurPic); @@ -196,6 +196,18 @@ int AdlEngine_v4::o4_isNounNotInRoom(ScriptEnv &e) { return 1; } +int AdlEngine_v4::o4_listInv(ScriptEnv &e) { + OP_DEBUG_0("\tLIST_INVENTORY()"); + + Common::List<Item>::const_iterator item; + + for (item = _state.items.begin(); item != _state.items.end(); ++item) + if (item->room == IDI_ANY) + printString(_itemDesc[item->id - 1]); + + return 0; +} + int AdlEngine_v4::o4_moveItem(ScriptEnv &e) { OP_DEBUG_2("\tSET_ITEM_ROOM(%s, %s)", itemStr(e.arg(1)).c_str(), itemRoomStr(e.arg(2)).c_str()); diff --git a/engines/adl/adl_v4.h b/engines/adl/adl_v4.h index 3a4836bc14..dc9a27501e 100644 --- a/engines/adl/adl_v4.h +++ b/engines/adl/adl_v4.h @@ -57,13 +57,13 @@ protected: int o4_isItemInRoom(ScriptEnv &e); int o4_isNounNotInRoom(ScriptEnv &e); int o4_skipOneCommand(ScriptEnv &e); + int o4_listInv(ScriptEnv &e); int o4_moveItem(ScriptEnv &e); int o4_dummy(ScriptEnv &e); int o4_setTextMode(ScriptEnv &e); int o4_setDisk(ScriptEnv &e); int o4_sound(ScriptEnv &e); - Common::Array<Common::String> _itemDesc; byte _curDisk; Common::Array<DiskOffset> _diskOffsets; }; |