ScummVM API documentation
gui_gizmo.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_GIZMO_H
24 #define M4_BURGER_GUI_GIZMO_H
25 
26 #include "common/rect.h"
27 #include "m4/m4_types.h"
28 #include "m4/gui/gui_vmng_core.h"
29 #include "m4/graphics/gr_buff.h"
30 #include "m4/burger/gui/gui_cheapo.h"
31 
32 namespace M4 {
33 namespace Burger {
34 namespace GUI {
35 
36 #define _GIZMO(X) g_vars->_gizmo._##X
37 
38 struct Gizmo;
39 struct GizmoItem;
40 
41 struct Gizmo_Globals {
42  bool _initialized = false;
43  bool _interface_visible = false;
44  Gizmo *_gui = nullptr;
45  RGB8 *_palette = nullptr;
46  bool _lowMemory1 = false;
47  bool _lowMemory2 = false;
48  GizmoItem *_currentItem = nullptr;
49  MemHandle _seriesHandle = nullptr;
50  int32 _celsOffset = 0;
51  int32 _palOffset = 0;
52  char *_assetName = nullptr;
53  int _spriteCount = 0;
54  M4sprite **_sprites = nullptr;
55  bool _roomFlags[15];
56 
57  bool _savedFlag = false;
58  int _savedX = 0;
59  int _savedY = 0;
60 
61  Gizmo_Globals();
62  ~Gizmo_Globals();
63 };
64 
65 struct Gizmo {
66  GrBuff *_grBuff = nullptr;
67  GizmoItem *_items = nullptr;
68  void (*_fnEnter)() = nullptr;
69  void (*_fnEscape)() = nullptr;
70  EventHandler _fnEvents = nullptr;
71 };
72 
73 struct GizmoButton {
74  ControlStatus _state = NOTHING;
75  int _index = 0;
76  int _field8 = 0;
77  int _fieldC = 0;
78  int _field10 = 0;
79 };
80 
81 typedef void (*GizmoItemFnSelect)();
82 typedef void (*GizmoItemFnDraw)(GizmoItem *item, Gizmo *gizmo, int x, int y);
83 typedef void (*GizmoItemFnFree)(GizmoItem *item);
84 typedef bool (*GizmoItemFnEvents)(GizmoItem *item, int eventType, int event, int x, int y,
85  GizmoItem **currentItem);
86 
87 struct GizmoItem {
88  GizmoItem *_next = nullptr;
89  GizmoItem *_prior = nullptr;
90  Gizmo *_gizmo = nullptr;
91  GrBuff *_grBuff = nullptr;
92  GizmoButton *_button = nullptr;
93 
94  int _id = 0;
95  Common::Rect _bounds;
96  Common::Rect _btnRect;
97  bool _hasBuffer = false;
98  GizmoItemFnSelect _select = nullptr;
99  GizmoItemFnDraw _fnDraw = nullptr;
100  GizmoItemFnFree _fnFree = nullptr;
101  GizmoItemFnEvents _fnEvents = nullptr;
102 };
103 
104 void gizmo_anim(RGB8 *pal);
105 void gizmo_initialize(RGB8 *pal);
106 void gizmo_shutdown(void *v1 = nullptr, void *v2 = nullptr);
107 void gizmo_digi_play(const char *name, int vol, bool &done);
108 
109 } // namespace GUI
110 } // namespace Burger
111 } // namespace M4
112 
113 #endif
Definition: gui_gizmo.h:87
Definition: rect.h:144
Definition: system.h:46
Definition: m4_types.h:88
Definition: database.h:28
Definition: gui.h:31
Definition: gr_buff.h:30
Definition: gui_gizmo.h:65
Definition: gui_gizmo.h:41
Definition: gui_gizmo.h:73