ScummVM API documentation
vars.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 M4_VARS_H
23 #define M4_VARS_H
24 
25 #include "m4/adv_r/kernel.h"
26 #include "m4/core/globals.h"
27 #include "m4/core/term.h"
28 #include "m4/adv_db_r/db_catalog.h"
29 #include "m4/adv_r/adv.h"
30 #include "m4/adv_r/adv_been.h"
31 #include "m4/adv_r/adv_game.h"
32 #include "m4/adv_r/adv_interface.h"
33 #include "m4/adv_r/adv_inv.h"
34 #include "m4/adv_r/adv_player.h"
35 #include "m4/adv_r/adv_rails.h"
36 #include "m4/adv_r/adv_scale.h"
37 #include "m4/adv_r/adv_trigger.h"
38 #include "m4/adv_r/adv_walk.h"
39 #include "m4/adv_r/conv_io.h"
40 #include "m4/core/globals.h"
41 #include "m4/core/mouse.h"
42 #include "m4/fileio/fstream.h"
43 #include "m4/fileio/sys_file.h"
44 #include "m4/graphics/gr_color.h"
45 #include "m4/graphics/gr_font.h"
46 #include "m4/graphics/krn_pal.h"
47 #include "m4/graphics/rend.h"
48 #include "m4/gui/gui_dialog.h"
49 #include "m4/gui/gui_item.h"
50 #include "m4/gui/gui_mouse.h"
51 #include "m4/gui/gui_univ.h"
52 #include "m4/gui/hotkeys.h"
53 #include "m4/mem/memman.h"
54 #include "m4/mem/res.h"
55 #include "m4/platform/events.h"
56 #include "m4/platform/timer.h"
57 #include "m4/platform/sound/digi.h"
58 #include "m4/platform/sound/midi.h"
59 #include "m4/wscript/wscript.h"
60 
61 namespace M4 {
62 
63 #define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
64 
65 class Vars;
66 
67 extern Vars *g_vars;
68 
69 class Vars : public Mouse_Globals {
70 private:
71  void game_systems_initialize(byte flags);
72  void game_systems_shutdown();
73  void fire_up_gui();
74  bool woodscript_init();
75  void woodscript_shutdown();
76  void grab_fonts();
77  void create_mouse_watch_dialog();
78 
79 protected:
80  void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
81  virtual void main_cold_data_init() = 0;
82 
83 public:
84  Vars();
85  virtual ~Vars();
86  bool init();
87 
88  virtual Interface *getInterface() = 0;
89  virtual Walker *getWalker() = 0;
90  virtual Hotkeys *getHotkeys() = 0;
91  virtual void global_menu_system_init() = 0;
92  virtual void initialize_game() = 0;
93 
94  Events _events;
95  MouseInfo &_MouseState = _events;
96  GameControl _game;
97  Kernel _kernel;
98  Term _term;
99  Hag_Statics _hag;
100  SceneDef _currentSceneDef;
101  Scene_list _scene_list;
102  frac16 _globals[GLB_SHARED_VARS];
103  Player _player;
104  PlayerInfo _player_info;
105  Resources _resources;
106  Rails_Globals _rails;
107  Catalog _catalog;
108  Dialog_Globals _dialog;
109  Item_Globals _items;
110  Converstation_Globals _conversations;
111  WS_Globals _ws;
112  Triggers _triggers;
113  Sound::Digi _digi;
114  Sound::Midi _midi;
115  KernelPal_Globals _krnPal;
116  ADVScale_Globals _scale;
117  ConvDisplayData _cdd;
118  Rend_Globals _rend;
119 
120  const bool _cheating_enabled = true;
121 
122  Font *_system_font = nullptr;
123  Font *_font_line = nullptr;
124  Font *_font_tiny_prop = nullptr;
125  Font *_font_tiny = nullptr;
126  Font *_font_inter = nullptr;
127  Font *_font_conv = nullptr;
128  Font *_font_menu = nullptr;
129  Font *_font_misc = nullptr;
130  Font *_interfaceFont = nullptr;
131  Font *_font = nullptr;
132 
133  bool _system_shutting_down = false;
134  InventoryBase *_inventory = nullptr;
135  size_t _mem_to_alloc = 0;
136  GrBuff *_screenCodeBuff = nullptr;
137  GrBuff *_game_bgBuff = nullptr;
138  GrBuff *_gameDrawBuff = nullptr;
139  GrBuff *_gameInterfaceBuff = nullptr;
140  void *_custom_interface_setup = nullptr;
141  void *_custom_interface_button_handler = nullptr;
142  int _global_sound_room = 0;
143  CursorChange _toggle_cursor = CURSCHANGE_NONE;
144  bool _i_just_hyperwalked = false;
145  void (*_custom_ascii_converter)(char *string) = nullptr;
146  bool _vmng_Initted = false;
147  ScreenContext *_frontScreen = nullptr;
148  ScreenContext *_backScreen = nullptr;
149  ScreenContext *_inactiveScreens = nullptr;
150  // A list of "hot keys" which are activated by their keyboard event, if the event
151  // has been passed right through the complete list of active windows.
152  Hotkey *_systemHotkeys = nullptr;
153  int32 _memtypeSCRN = 0; // Memory slots used by the memory manager
154  int32 _memtypeMATTE = 0;
155  int32 _memtypeRECT = 0;
156  int32 _sizeMem[_MEMTYPE_LIMIT];
157  int32 _requests[_MEMTYPE_LIMIT];
158  void *_memBlock[_MEMTYPE_LIMIT];
159  RGB8 _master_palette[256];
160  RGB8 _backup_palette[256];
161  bool _pal_fade_in_progress = false;
162  strmRequest *_firstStream = nullptr;
163  strmRequest *_lastStream = nullptr;
164  InvPal *_inverse_pal = nullptr;
165  int32 _inv_obj_mem_type = 0;
166  bool _currScreen = false;
167  ScreenContext *_eventToScreen = nullptr;
168  byte _color = 0;
169  Dialog *_mousePosDialog = nullptr;
170  bool _showMousePos = false;
171  bool _inv_suppress_click_sound = false;
172  bool _between_rooms = false;
173  bool _completeWalk = false;
174  const char *_art_base_override = nullptr;
175  bool _use_alternate_attribute_file = false;
176  bool _camera_reacts_to_player = false;
177  bool _set_commands_allowed_since_last_checked = false;
178  SceneDef *_myDef = nullptr;
179  Common::String _def_filename;
180  Common::String _currBackgroundFN;
181  Common::String _currCodeFN;
182  ScreenContext *_game_buff_ptr = nullptr;
183  machine *_my_walker = nullptr;
184  uint32 _editors_in_use = 0;
185  bool _editor_showStats = false;
186  bool _shut_down_digi_tracks_between_rooms = false;
187  cursor_states _cursor_state = kARROW;
188  int _iPitch = 0;
189  bool _hyperwalk = false;
190 };
191 
192 #define _G(X) (g_vars->_##X)
193 #define _GI() (*g_vars->getInterface())
194 #define _GW() (*g_vars->getWalker())
195 #define _GWS(X) _G(ws)._##X
196 #define INTERFACE_VISIBLE g_vars->getInterface()->_visible
197 
198 } // namespace M4
199 
200 #endif
Definition: ws_machine.h:153
Definition: str.h:59
Definition: kernel.h:34
Definition: gr_font.h:30
Definition: adv_walk.h:32
Definition: vars.h:69
Definition: hotkeys.h:35
Definition: adv.h:79
Definition: conv_io.h:54
Definition: res.h:33
Definition: adv_interface.h:32
Definition: gui_dialog.h:89
Definition: events.h:60
Definition: fstream.h:45
Definition: midi.h:31
intptr frac16
Definition: m4_types.h:46
Definition: m4_types.h:88
Definition: sys_file.h:39
Definition: adv_player.h:94
Definition: digi.h:39
Definition: gui_univ.h:47
Definition: database.h:28
Definition: gr_color.h:30
Definition: gr_buff.h:30
Definition: conv.h:99
Definition: adv_trigger.h:35
Definition: adv_scale.h:32
Definition: gui_mouse.h:34
Definition: rend.h:75
Definition: wscript.h:34
Definition: gui_univ.h:38
Definition: adv_been.h:32
Definition: adv_player.h:34
Definition: adv_rails.h:32
Definition: gui_item.h:105
Definition: adv_game.h:32
Definition: gui_dialog.h:38
Definition: events.h:69
Definition: krn_pal.h:35
Definition: adv_inv.h:38
Definition: db_catalog.h:32
Definition: term.h:35