ScummVM API documentation
bbdou_inventory.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ILLUSIONS_BBDOU_BBDOU_INVENTORY_H
23 #define ILLUSIONS_BBDOU_BBDOU_INVENTORY_H
24 
25 #include "illusions/specialcode.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 
29 namespace Illusions {
30 
31 class IllusionsEngine_BBDOU;
32 class BbdouSpecialCode;
33 class Control;
34 struct TriggerFunction;
35 
36 struct InventoryItem {
37  uint32 _objectId;
38  uint32 _sequenceId;
39  bool _assigned;
40  bool _flag;
41  int _timesPresent;
42  int _fieldE;
43  InventoryItem(uint32 objectId, uint32 sequenceId);
44 };
45 
46 struct InventorySlot {
47  uint32 _namedPointId;
48  uint32 _objectId;
49  InventoryItem *_inventoryItem;
50  InventorySlot(uint32 namedPointId);
51 };
52 
53 class InventoryBag {
54 public:
55  InventoryBag(IllusionsEngine_BBDOU *vm, uint32 sceneId);
56  ~InventoryBag();
57  void registerInventorySlot(uint32 namedPointId);
58  bool addInventoryItem(InventoryItem *inventoryItem, InventorySlot *inventorySlot);
59  void removeInventoryItem(InventoryItem *inventoryItem);
60  bool hasInventoryItem(uint32 objectId);
61  void buildItems();
62  void clear();
63  InventorySlot *getInventorySlot(uint32 objectId);
64  InventorySlot *findClosestSlot(Common::Point putPos, int index);
65 protected:
66 public:
68  typedef InventorySlots::iterator InventorySlotsIterator;
70  uint32 _sceneId;
71  InventorySlots _inventorySlots;
72  bool _isActive;
73  int _fieldA;
74 };
75 
77 public:
79  ~BbdouInventory();
80  void registerInventoryBag(uint32 sceneId);
81  void registerInventoryItem(uint32 objectId, uint32 sequenceId);
82  void registerInventorySlot(uint32 namedPointId);
83  void addInventoryItem(uint32 objectId);
84  void removeInventoryItem(uint32 objectId);
85  bool hasInventoryItem(uint32 objectId);
86  void open();
87  void close();
88  InventoryBag *getInventoryBag(uint32 sceneId);
89  InventoryItem *getInventoryItem(uint32 objectId);
90  void refresh();
91  void buildItems(InventoryBag *inventoryBag);
92  void clear();
93  void cause0x1B0001(TriggerFunction *triggerFunction, uint32 callingThreadId);
94  void cause0x1B0002(TriggerFunction *triggerFunction, uint32 callingThreadId);
95  void putBackInventoryItem(uint32 objectId, Common::Point cursorPosition);
96 protected:
98  typedef InventoryItems::iterator InventoryItemsIterator;
100  BbdouSpecialCode *_bbdou;
101  Common::Array<InventoryBag*> _inventoryBags;
102  InventoryItems _inventoryItems;
103  uint32 _activeBagSceneId;
104  uint32 _activeInventorySceneId;
105  int _index;
106  //field_12 dw
107 };
108 
109 } // End of namespace Illusions
110 
111 #endif // ILLUSIONS_BBDOU_BBDOU_INVENTORY_H
T * iterator
Definition: array.h:54
Definition: actor.h:34
Definition: illusions_bbdou.h:60
Definition: bbdou_triggerfunctions.h:34
Definition: rect.h:45
Definition: bbdou_inventory.h:53
Definition: bbdou_inventory.h:76
Definition: bbdou_inventory.h:46
Definition: bbdou_inventory.h:36
Definition: bbdou_specialcode.h:106