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  void registerInventorySlot(uint32 namedPointId);
57  bool addInventoryItem(InventoryItem *inventoryItem, InventorySlot *inventorySlot);
58  void removeInventoryItem(InventoryItem *inventoryItem);
59  bool hasInventoryItem(uint32 objectId);
60  void buildItems();
61  void clear();
62  InventorySlot *getInventorySlot(uint32 objectId);
63  InventorySlot *findClosestSlot(Common::Point putPos, int index);
64 protected:
65 public:
67  typedef InventorySlots::iterator InventorySlotsIterator;
69  uint32 _sceneId;
70  InventorySlots _inventorySlots;
71  bool _isActive;
72  int _fieldA;
73 };
74 
76 public:
78  void registerInventoryBag(uint32 sceneId);
79  void registerInventoryItem(uint32 objectId, uint32 sequenceId);
80  void registerInventorySlot(uint32 namedPointId);
81  void addInventoryItem(uint32 objectId);
82  void removeInventoryItem(uint32 objectId);
83  bool hasInventoryItem(uint32 objectId);
84  void open();
85  void close();
86  InventoryBag *getInventoryBag(uint32 sceneId);
87  InventoryItem *getInventoryItem(uint32 objectId);
88  void refresh();
89  void buildItems(InventoryBag *inventoryBag);
90  void clear();
91  void cause0x1B0001(TriggerFunction *triggerFunction, uint32 callingThreadId);
92  void cause0x1B0002(TriggerFunction *triggerFunction, uint32 callingThreadId);
93  void putBackInventoryItem(uint32 objectId, Common::Point cursorPosition);
94 protected:
96  typedef InventoryItems::iterator InventoryItemsIterator;
98  BbdouSpecialCode *_bbdou;
99  Common::Array<InventoryBag*> _inventoryBags;
100  InventoryItems _inventoryItems;
101  uint32 _activeBagSceneId;
102  uint32 _activeInventorySceneId;
103  int _index;
104  //field_12 dw
105 };
106 
107 } // End of namespace Illusions
108 
109 #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:75
Definition: bbdou_inventory.h:46
Definition: bbdou_inventory.h:36
Definition: bbdou_specialcode.h:106