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 DRAGONS_INVENTORY_H
23#define DRAGONS_INVENTORY_H
24
25namespace Dragons {
26
27class Actor;
28class ActorManager;
29class BackgroundResourceLoader;
30class Background;
31class Bag;
32class DragonINIResource;
33
34#define DRAGONS_MAX_INVENTORY_ITEMS 0x29
35
36#define ACTOR_INVENTORY_OFFSET 0x17
37
38enum InventoryState {
39 Closed = 0,
40 InventoryOpen = 1,
41 InventionBookOpen = 2
42};
43
44class Inventory {
45public:
46 InventoryState _previousState;
47private:
48 DragonsEngine *_vm;
49 int32 _sequenceId;
50 int16 _screenPositionIndex;
51 Actor *_actor;
52 InventoryState _state;
53 Bag *_bag;
54
55 void (*_inventionBookPrevSceneUpdateFunc)();
56 uint16 _inventionBookPrevSceneId;
57 uint16 _inventionBookPrevFlickerINISceneId;
58 Common::Point _inventionBookPrevFlickerINIPosition;
59
60 uint16 _inventoryItemTbl[DRAGONS_MAX_INVENTORY_ITEMS];
61
62public:
64
65 void init(ActorManager *actorManager, BackgroundResourceLoader *backgroundResourceLoader, Bag *bag, DragonINIResource *dragonIniResource);
66 void loadScene(uint32 sceneId);
67 bool isActorSet() { return true; }
68
69 int32 getSequenceId() {
70 return _sequenceId;
71 }
72 void setActorSequenceId(int32 sequenceId);
73 void updateActorSequenceId(int32 sequenceId);
74 void resetSequenceId();
75
76 InventoryState getState() { return _state; }
77 void setState(InventoryState newState) { _state = newState; }
78 void setPreviousState();
79
80 int16 getPositionIndex() { return _screenPositionIndex; }
81 Common::Point getPosition();
82
83 bool isOpen() {
84 return _state != Closed;
85 }
86
87 void close() { _state = Closed; }
88
89 void updateVisibility();
90 void setActorFlag400();
91 void clearActorFlag400();
92 void setPriority(uint16 priority);
93
94 void openInventory();
95 void closeInventory();
96
97 void draw();
98 uint16 getIniAtPosition(int16 x, int16 y);
99 void loadInventoryItemsFromSave();
100
101 void openInventionBook();
102 void closeInventionBook();
103
104 bool addItem(uint16 iniId);
105 bool addItemIfPositionIsEmpty(uint16 iniId, uint16 x, uint16 y);
106 void replaceItem(uint16 existingIniId, uint16 newIniId);
107 bool clearItem(uint16 iniId);
108 bool hasItem(uint16 iniId);
109
110 Actor *getInventoryItemActor(uint16 iniId);
111 void inventoryMissing();
112
113private:
114 void setPositionFromSceneId(uint32 sceneId);
115 void animateBagIn();
116 void animateBagOut();
117};
118
119} // End of namespace Dragons
120
121#endif //DRAGONS_INVENTORY_H
Definition: actor.h:86
Definition: actor.h:61
Definition: background.h:36
Definition: bag.h:33
Definition: dragonini.h:63
Definition: dragons.h:166
Definition: inventory.h:44
Definition: rect.h:144