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