ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
inventory.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef M4_BURGER_GUI_INVENTORY_H
24 #define M4_BURGER_GUI_INVENTORY_H
25 
26 #include "m4/gui/gui_cheapo.h"
27 
28 namespace M4 {
29 namespace Burger {
30 namespace GUI {
31 
32 using namespace M4::GUI;
33 
34 constexpr int16 INVENTORY_CELLS_COUNT = 128;
35 constexpr int16 ARROW_WIDTH = 8;
36 constexpr int16 MAX_INVENTORY = 9;
37 
38 constexpr int16 LEFT_ARROW_TAG = 128;
39 constexpr int16 RIGHT_ARROW_TAG = 129;
40 
41 constexpr int16 LEFT_ARROW_TAG_DORMANT = 130;
42 constexpr int16 RIGHT_ARROW_TAG_DORMANT = 134;
43 constexpr int16 LEFT_ARROW_TAG_ROLL = 131;
44 constexpr int16 RIGHT_ARROW_TAG_ROLL = 135;
45 constexpr int16 LEFT_ARROW_TAG_DOWN = 132;
46 constexpr int16 RIGHT_ARROW_TAG_DOWN = 136;
47 constexpr int16 LEFT_ARROW_TAG_NONFUNC = 133;
48 constexpr int16 RIGHT_ARROW_TAG_NONFUNC = 137;
49 
50 class Inventory : public RectClass {
51  struct Entry {
52  Common::String _name;
53  Common::String _verb;
54  int16 _cell = -1;
55  int16 _cursor = -1;
56  };
57 private:
58  int32 _sprite = 0;
59  int16 _tag = 0;
60  int16 _num_cells = 0;
61  bool _right_arrow_visible = false;
62 
63  int16 cell_pos_x(int16 index);
64  int16 cell_pos_y(int16 index);
65  int16 interface_tracking = -1;
66 
67 public:
68  int16 _scroll = 0;
69  int16 _cells_h = 0, _cells_v = 0;
70  int16 _cell_w = 0, _cell_h = 0;
71  int16 _must_redraw1 = 0, _must_redraw2 = 0;
72  int16 _highlight = 0;
73  bool _must_redraw_all = false;
74 
75  Entry _items[INVENTORY_CELLS_COUNT];
76 
77 public:
78  Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag);
79  ~Inventory();
80 
81  void draw(GrBuff *interface_buffer);
82 
83  int16 inside(int16 x, int16 y) const override;
84  ControlStatus track(int32 eventType, int16 x, int16 y);
85 
86  bool add(const Common::String &name, const Common::String &verb, int32 cel, int32 cursor);
87  bool remove(const Common::String &name);
88  void highlight_part(int16 index);
89 
90  bool need_left() const;
91  bool need_right() const;
92  void set_scroll(int32 new_scroll);
93 };
94 
95 } // namespace GUI
96 } // namespace Burger
97 } // namespace M4
98 
99 #endif
Definition: str.h:59
Definition: gui_cheapo.h:47
Definition: system.h:46
Definition: inventory.h:50
Definition: database.h:28
Definition: gr_buff.h:30
Definition: game_menu.h:30