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 
33 namespace Myst3 {
34 
35 class Myst3Engine;
36 class Texture;
37 
38 class Inventory : public Window {
39 public:
41  virtual ~Inventory();
42 
43  // Window API
44  Common::Rect getPosition() const override;
45  Common::Rect getOriginalPosition() 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 
57  bool isMouseInside();
58 
60  void updateCursor();
61 
62  void reflow();
63 
64  uint16 hoveredItem();
65  void useItem(uint16 var);
66 
67  void draw() override;
68 
69 private:
70  struct InventoryItem {
71  uint16 var;
72  Common::Rect rect;
73  };
74 
76 
77  struct ItemData {
78  uint16 textureX;
79  uint16 textureWidth;
80  uint16 textureHeight;
81  uint16 var;
82  };
83 
84  static const ItemData _availableItems[8];
85  const ItemData &getData(uint16 var);
86 
87  Myst3Engine *_vm;
88 
89  Texture *_texture;
90  ItemList _inventory;
91 
92  void initializeTexture();
93 
94  bool hasItem(uint16 var);
95 
96  void openBook(uint16 age, uint16 room, uint16 node);
97  void closeAllBooks();
98 };
99 
100 class DragItem : public Drawable {
101 public:
102  DragItem(Myst3Engine *vm, uint id);
103  ~DragItem();
104  void drawOverlay() override;
105  void setFrame(uint16 frame);
106 
107 private:
108  Myst3Engine *_vm;
109 
110  Common::SeekableReadStream *_movieStream;
111  Video::BinkDecoder _bink;
112 
113  uint16 _frame;
114  Texture *_texture;
115 
117 };
118 
119 } // End of namespace Myst3
120 
121 #endif // INVENTORY_H_
Definition: inventory.h:100
Definition: ambient.h:27
Definition: rect.h:144
Definition: stream.h:745
Definition: gfx.h:93
Common::Rect getOriginalPosition() const override
Common::Rect getPosition() const override
Definition: gfx.h:65
Definition: gfx.h:36
Definition: inventory.h:38
Definition: myst3.h:87