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 INVENTORY_H_
23#define INVENTORY_H_
24
25#include "common/list.h"
26#include "common/memstream.h"
27#include "common/rect.h"
28
29#include "engines/myst3/gfx.h"
30
31#include "video/bink_decoder.h"
32
33namespace Myst3 {
34
35class Myst3Engine;
36class Texture;
37
38class Inventory : public Window {
39public:
41 virtual ~Inventory();
42
43 // Window API
44 Common::Rect getPosition() const override;
46
47 void loadFromState();
48 void updateState();
49
50 void addItem(uint16 var, bool atEnd);
51 void addSaavedroChapter(uint16 var);
52 void addAll();
53 void removeItem(uint16 var);
54 void reset();
55
58
61
62 void reflow();
63
64 uint16 hoveredItem();
65 void useItem(uint16 var);
66
67 bool isEmpty() const { return _inventory.empty(); }
68
69 void draw() override;
70
71private:
72 struct InventoryItem {
73 uint16 var;
74 Common::Rect rect;
75 };
76
77 typedef Common::List<InventoryItem> ItemList;
78
79 struct ItemData {
80 uint16 textureX;
81 uint16 textureWidth;
82 uint16 textureHeight;
83 uint16 var;
84 };
85
86 static const ItemData _availableItems[8];
87 const ItemData &getData(uint16 var);
88
89 Myst3Engine *_vm;
90
91 Texture *_texture;
92 ItemList _inventory;
93 bool _hidden;
94
95 void initializeTexture();
96
97 bool hasItem(uint16 var);
98
99 void openBook(uint16 age, uint16 room, uint16 node);
100 void closeAllBooks();
101};
102
103class DragItem : public Drawable {
104public:
105 DragItem(Myst3Engine *vm, uint id);
106 ~DragItem();
107 void drawOverlay() override;
108 void setFrame(uint16 frame);
109
110private:
111 Myst3Engine *_vm;
112
113 Common::SeekableReadStream *_movieStream;
114 Video::BinkDecoder _bink;
115
116 uint16 _frame;
117 Texture *_texture;
118
119 Common::Rect getPosition();
120};
121
122} // End of namespace Myst3
123
124#endif // INVENTORY_H_
bool empty() const
Definition: list.h:258
Definition: stream.h:745
Definition: inventory.h:103
Definition: gfx.h:36
Definition: inventory.h:38
Common::Rect getOriginalPosition() const override
Common::Rect getPosition() const override
Definition: myst3.h:87
Definition: gfx.h:93
Definition: gfx.h:65
Definition: rect.h:536