diff options
-rw-r--r-- | engines/fullpipe/inventory.cpp | 25 | ||||
-rw-r--r-- | engines/fullpipe/inventory.h | 22 |
2 files changed, 29 insertions, 18 deletions
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 03b7cbf8b7..588b465415 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -32,20 +32,29 @@ bool CInventory::load(MfcArchive &file) { for (int i = 0; i < numInvs; i++) { InventoryPoolItem *t = new InventoryPoolItem(); - t->_id = file.readUint16LE(); - t->_pictureObjectNormalId = file.readUint16LE(); - t->_pictureObjectId1 = file.readUint16LE(); - t->_pictureObjectMouseInsideId = file.readUint16LE(); - t->_pictureObjectId3 = file.readUint16LE(); - t->_flags = file.readUint32LE(); - t->_field_C = 0; - t->_field_A = -536; + t->id = file.readUint16LE(); + t->pictureObjectNormalId = file.readUint16LE(); + t->pictureObjectId1 = file.readUint16LE(); + t->pictureObjectMouseInsideId = file.readUint16LE(); + t->pictureObjectId3 = file.readUint16LE(); + t->flags = file.readUint32LE(); + t->field_C = 0; + t->field_A = -536; _itemsPool.push_back(*t); } return true; } +int CInventory::getInventoryPoolItemIndexById(int itemId) { + for (int i = 0; i < _itemsPool.size(); i++) { + if (_itemsPool[i].id == itemId) + return i; + } + + return 0; +} + CInventory2::CInventory2() { _selectedId = -1; _field_48 = -1; diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index 8b6271aa1b..30b23c3c98 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -28,17 +28,17 @@ namespace Fullpipe { class Scene; class BigPicture; -class InventoryPoolItem { +struct InventoryPoolItem { public: - int16 _id; - int16 _pictureObjectNormalId; - int16 _pictureObjectId1; - int16 _pictureObjectMouseInsideId; - int16 _pictureObjectId3; - int16 _field_A; - int _field_C; - int _obj; - int _flags; + int16 id; + int16 pictureObjectNormalId; + int16 pictureObjectId1; + int16 pictureObjectMouseInsideId; + int16 pictureObjectId3; + int16 field_A; + int field_C; + int obj; + int flags; }; typedef Common::Array<InventoryPoolItem> InventoryPoolItems; @@ -51,6 +51,8 @@ class CInventory : public CObject { public: CInventory() { _sceneId = 0; } virtual bool load(MfcArchive &file); + + int getInventoryPoolItemIndexById(int itemId); }; struct InventoryItem { |