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 GOT_VARS_H
23 #define GOT_VARS_H
24 
25 #include "common/events.h"
26 #include "common/queue.h"
27 #include "got/data/defines.h"
28 #include "got/data/highscores.h"
29 #include "got/data/level.h"
30 #include "got/data/sd_data.h"
31 #include "got/data/setup.h"
32 #include "got/data/thorinfo.h"
33 #include "got/game/script.h"
34 #include "got/gfx/font.h"
35 #include "got/gfx/gfx_chunks.h"
36 #include "got/gfx/gfx_pics.h"
37 #include "got/metaengine.h"
38 #include "got/sound.h"
39 #include "graphics/screen.h"
40 
41 namespace Got {
42 
43 #define TILE_SIZE 16
44 #define TILES_X (320 / TILE_SIZE)
45 #define TILES_Y (192 / TILE_SIZE)
46 #define TILES_COUNT (TILES_X * TILES_Y)
47 
48 class Vars;
49 
50 extern Vars *g_vars;
51 
52 enum Key {
53  key_none = KEYBIND_NONE,
54  key_up = KEYBIND_UP,
55  key_down = KEYBIND_DOWN,
56  key_left = KEYBIND_LEFT,
57  key_right = KEYBIND_RIGHT,
58  key_fire = KEYBIND_FIRE,
59  key_magic = KEYBIND_MAGIC,
60  key_select = KEYBIND_SELECT
61 };
62 
63 enum GameMode {
64  MODE_NORMAL,
65  MODE_AREA_CHANGE,
66  MODE_THUNDER,
67  MODE_THOR_DIES,
68  MODE_ADD_SCORE,
69  MODE_LIGHTNING,
70  MODE_PAUSE,
71  MODE_SCORE_INV
72 };
73 
74 enum TransitionDir {
75  DIR_LEFT,
76  DIR_RIGHT,
77  DIR_UP,
78  DIR_DOWN,
79  DIR_PHASED
80 };
81 
82 struct Cheats {
83  bool _freezeHealth = false;
84  bool _freezeMagic = false;
85  bool _freezeJewels = false;
86 };
87 
88 class Vars {
89 public:
90  Vars();
91  ~Vars();
92 
93  void load();
94  void setArea(int areaNum);
95  void loadArea();
96  void clearKeyFlags();
97  void resetEndGameFlags();
98 
99  Common::String _playerName = "ScummVM";
100  Gfx::GfxChunks _gfx;
101  Gfx::BgPics _bgPics;
102  Gfx::Font _font;
103  Gfx::Pics _hampic;
104  Gfx::Pics _objects;
105  Gfx::Pics _odin;
106  Gfx::Pics _status;
107  HighScores _highScores;
108  SdData _sdData;
109  Sound _sound;
110  Scripts _scripts;
111  GameMode _gameMode = MODE_NORMAL;
112  TransitionDir _transitionDir = DIR_LEFT;
113  Cheats _cheats;
114  Common::Queue<byte> _demoKeys;
115  bool _useItemFlag = false;
116  bool _slipFlag = false;
117  bool _slipping = false;
118  int _slipCount = 0;
119  bool _bossIntro1 = false;
120  bool _bossIntro2 = false;
121 
122  int8 _pge = 0;
123  int _exitFlag = 0;
124 
125  byte _keyFlag[100] = {};
126  int8 _diag = 0;
127  bool _diagFlag = false;
128  bool _slowMode = false;
129  bool _startup = true;
130  bool _shotOk = false;
131  int _thorX1 = 0;
132  int _thorY1 = 0;
133  int _thorX2 = 0;
134  int _thorY2 = 0;
135  int _thorRealY1 = 0;
136  int _thorPos = 0;
137 
138  uint _magicCounter = 0;
139 
140  byte _objectMap[TILES_COUNT] = {};
141  byte _objectIndex[TILES_COUNT] = {};
142  int8 _thorIcon1 = 0;
143  int8 _thorIcon2 = 0;
144  int8 _thorIcon3 = 0;
145  int8 _thorIcon4 = 0;
146  int8 _levelMusic = 0;
147  int8 _currentMusic = -1;
148  int8 _appleDropCounter = 0;
149  bool _cheat = false;
150  int8 _area = 1;
151 
152  Level _scrn;
153 
154  Setup _setup;
155  Setup _lastSetup;
156  byte *_tmpBuff = nullptr;
157 
158  Actor _actor[MAX_ACTORS] = {}; //current actors
159  Actor _enemy[MAX_ENEMIES] = {}; //current enemies
160  Actor _shot[MAX_ENEMIES] = {}; //current shots
161  int8 _enemyType[MAX_ENEMIES] = {};
162  int _etype[MAX_ENEMIES] = {};
163 
164  Actor _magicItem[2] = {};
165  byte _magicPic[2][1024] = {};
166  bool _warpScroll = false;
167 
168  Actor *_thor = nullptr;
169  Actor *_hammer = nullptr;
170  Actor _explosion;
171  Actor _sparkle;
172  ThorInfo _thorInfo;
173  bool _bossDead = false;
174  byte _endGame = 0;
175 
176  bool _warpFlag = false;
177 
178  int _rand1 = 0;
179  int _rand2 = 0;
180  int _thunderSnakeCounter = 0;
181  bool _tornadoUsed = false;
182  bool _shieldOn = false;
183  bool _appleFlag = false;
184  int _switchUsed = 0;
185 
186  bool _musicFlag = false;
187  bool _soundFlag = false;
188  bool _cashDoor1Inform = false;
189  bool _cashDoor2Inform = false;
190  bool _keyDoorInform = false;
191  bool _magicMissingInform = false;
192  bool _cantCarryInform = false;
193  bool _killGoodGuyInform = false;
194 
195  bool _bossActive = false;
196  bool _storyFlag = true;
197  int8 *_scr = nullptr;
198  bool _demo = false;
199  bool _gameOver = false;
200  bool _endTile = false;
201  int _currentLevel = 23;
202  int _newLevel = 0;
203  int _newLevelTile = 0;
204  int _currentArea = 0;
205  bool _thorSpecialFlag = false;
206  byte _explosionRow = 0;
207  bool _eyeballs = 0;
208 };
209 
210 #define _G(X) (g_vars->_##X)
211 
212 } // namespace Got
213 
214 #endif
Definition: highscores.h:43
Definition: gfx_chunks.h:80
Definition: gfx_pics.h:77
Definition: str.h:59
Definition: font.h:34
Definition: script.h:36
Definition: sound.h:58
Definition: vars.h:82
Definition: actor.h:33
Definition: sd_data.h:29
Definition: vars.h:88
Definition: level.h:31
Definition: console.h:28
Definition: setup.h:102
Definition: gfx_pics.h:64
Definition: thorinfo.h:29