ScummVM API documentation
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 NGI_INVENTORY_H
23#define NGI_INVENTORY_H
24
25namespace NGI {
26
27class Scene;
28class BigPicture;
29
31 int16 id;
32 int16 pictureObjectNormal;
33 int16 pictureObjectId1;
34 int16 pictureObjectHover;
35 int16 pictureObjectSelected;
36 int16 field_A;
37 int field_C;
38 int obj;
39 int flags;
40};
41
43
44class Inventory : public CObject {
45 protected:
46 int16 _sceneId;
47 InventoryPoolItems _itemsPool;
48
49 public:
50 Inventory() { _sceneId = 0; }
51
52 bool load(MfcArchive &file) override;
53
54 int getInventoryPoolItemIndexById(int itemId);
55 uint getItemsPoolCount() { return _itemsPool.size(); }
56 bool setItemFlags(int itemId, int flags);
57};
58
60 int16 itemId;
61 int16 count;
62
63 InventoryItem() { itemId = count = 0; }
64 InventoryItem(int id, int cnt) : itemId(id), count(cnt) {}
65};
66
67class PictureObject;
68
70 PictureObject *pictureObjectNormal;
71 PictureObject *pictureObjectHover;
72 PictureObject *pictureObjectSelected;
73 int x1;
74 int y1;
75 int x2;
76 int y2;
77 int16 inventoryItemId;
78 bool isSelected;
79 bool isMouseHover;
80};
81
82class Inventory2 : public Inventory {
83 Common::Array<InventoryItem> _inventoryItems;
84 Common::Array<InventoryIcon> _inventoryIcons;
85 int _selectedId;
86 int _field_48;
87 bool _isInventoryOut;
88 bool _isLocked;
89 int _topOffset;
90 Scene *_scene;
91 BigPicture *_picture;
92
93 public:
94 Inventory2();
95 ~Inventory2() override;
96
97 bool loadPartial(MfcArchive &file);
98 bool savePartial(MfcArchive &file);
99 void addItem(int itemId, int count);
100 void addItem2(StaticANIObject *obj);
101 void removeItem(int itemId, int count);
102 void removeItem2(Scene *sceneObj, int itemId, int x, int y, int priority);
103
104 int getInventoryItemIndexById(int itemId);
105 int getInventoryPoolItemIdAtIndex(int itemId);
106 int getInventoryPoolItemFieldCById(int itemId);
107 int getCountItemsWithId(int itemId);
108 int getItemFlags(int itemId);
109
110 void rebuildItemRects();
111
112 Scene *getScene() { return _scene; }
113 bool getIsLocked() { return _isLocked; }
114 void setIsLocked(bool val) { _isLocked = val; }
115 bool getIsInventoryOut() { return _isInventoryOut; }
116
117 int getSelectedItemId() { return _selectedId < 0 ? 0 : _selectedId; }
118 int getHoveredItem(Common::Point *point);
119 void slideIn();
120 void slideOut();
121
122 bool handleLeftClick(ExCommand *cmd);
123 int selectItem(int itemId);
124 bool unselectItem(bool flag);
125
126 void draw();
127
128 void clear();
129};
130
131} // End of namespace NGI
132
133#endif /* NGI_INVENTORY_H */
size_type size() const
Definition: array.h:316
Definition: gfx.h:131
Definition: utils.h:106
Definition: messages.h:59
Definition: inventory.h:82
Definition: inventory.h:44
Definition: utils.h:39
Definition: gfx.h:169
Definition: scene.h:32
Definition: statics.h:172
Definition: rect.h:144
Definition: inventory.h:69
Definition: inventory.h:59
Definition: inventory.h:30