ScummVM API documentation
gob.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  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, this code is also
23  * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24  * full text of the license.
25  *
26  */
27 
28 #ifndef GOB_GOB_H
29 #define GOB_GOB_H
30 
31 #include "common/random.h"
32 #include "common/system.h"
33 
34 #include "graphics/pixelformat.h"
35 
36 #include "engines/engine.h"
37 
38 #include "gob/console.h"
39 #include "gob/detection/detection.h"
40 
90 namespace Gob {
91 
92 class Game;
93 class Sound;
94 class Video;
95 class Global;
96 class Draw;
97 class DataIO;
98 class Goblin;
99 class VideoPlayer;
100 class Init;
101 class Inter;
102 class Map;
103 class Mult;
104 class PalAnim;
105 class Scenery;
106 class Util;
107 class SaveLoad;
108 class PreGob;
109 
110 #define WRITE_VAR_UINT32(var, val) _vm->_inter->_variables->writeVar32(var, val)
111 #define WRITE_VAR_UINT16(var, val) _vm->_inter->_variables->writeVar16(var, val)
112 #define WRITE_VAR_UINT8(var, val) _vm->_inter->_variables->writeVar8(var, val)
113 #define WRITE_VAR_STR(var, str) _vm->_inter->_variables->writeVarString(var, str)
114 #define WRITE_VARO_UINT32(off, val) _vm->_inter->_variables->writeOff32(off, val)
115 #define WRITE_VARO_UINT16(off, val) _vm->_inter->_variables->writeOff16(off, val)
116 #define WRITE_VARO_UINT8(off, val) _vm->_inter->_variables->writeOff8(off, val)
117 #define WRITE_VARO_STR(off, str) _vm->_inter->_variables->writeOffString(off, str)
118 #define READ_VAR_UINT32(var) _vm->_inter->_variables->readVar32(var)
119 #define READ_VAR_UINT16(var) _vm->_inter->_variables->readVar16(var)
120 #define READ_VAR_UINT8(var) _vm->_inter->_variables->readVar8(var)
121 #define READ_VARO_UINT32(off) _vm->_inter->_variables->readOff32(off)
122 #define READ_VARO_UINT16(off) _vm->_inter->_variables->readOff16(off)
123 #define READ_VARO_UINT8(off) _vm->_inter->_variables->readOff8(off)
124 #define GET_VAR_STR(var) _vm->_inter->_variables->getAddressVarString(var)
125 #define GET_VARO_STR(off) _vm->_inter->_variables->getAddressOffString(off)
126 #define GET_VAR_FSTR(var) _vm->_inter->_variables->getAddressVarString(var)
127 #define GET_VARO_FSTR(off) _vm->_inter->_variables->getAddressOffString(off)
128 
129 #define WRITE_VAR_OFFSET(off, val) WRITE_VARO_UINT32((off), (val))
130 #define WRITE_VAR(var, val) WRITE_VAR_UINT32((var), (val))
131 #define VAR_OFFSET(off) READ_VARO_UINT32(off)
132 #define VAR(var) READ_VAR_UINT32(var)
133 
134 
135 // WARNING: Reordering these will invalidate save games!
136 enum Endianness {
137  kEndiannessLE,
138  kEndiannessBE
139 };
140 
146 };
147 
148 enum {
149  kDebugFuncOp = 1 << 0,
150  kDebugDrawOp = 1 << 1,
151  kDebugGobOp = 1 << 2,
152  kDebugSound = 1 << 3,
153  kDebugExpression = 1 << 4,
154  kDebugGameFlow = 1 << 5,
155  kDebugFileIO = 1 << 6,
156  kDebugSaveLoad = 1 << 7,
157  kDebugGraphics = 1 << 8,
158  kDebugVideo = 1 << 9,
159  kDebugHotspots = 1 << 10,
160  kDebugDemo = 1 << 11
161 };
162 
163 class GobEngine : public Engine {
164 private:
165  GameType _gameType;
166  int32 _features;
167  Common::Platform _platform;
168 
169  EndiannessMethod _endiannessMethod;
170 
171  uint32 _pauseStart;
172 
173  // Engine APIs
174  Common::Error run() override;
175  bool hasFeature(EngineFeature f) const override;
176  void pauseEngineIntern(bool pause) override;
177  void syncSoundSettings() override;
178 
179  Common::Error initGameParts();
180  Common::Error initGraphics();
181 
182  void deinitGameParts();
183 
184 public:
185  static const Common::Language _gobToScummVMLang[];
186 
188 
189  Common::Language _language;
190  uint16 _width;
191  uint16 _height;
192  uint8 _mode;
193 
194  Graphics::PixelFormat _pixelFormat;
195 
196  Common::String _startStk;
197  Common::String _startTot;
198  uint32 _demoIndex;
199 
200  bool _copyProtection;
201  bool _noMusic;
202 
203  GobConsole *_console;
204 
205  bool _resourceSizeWorkaround;
206  bool _enableAdibou2FreeBananasWorkaround;
207  bool _enableAdibou2FlowersInfiniteLoopWorkaround;
208 
209  Global *_global;
210  Util *_util;
211  DataIO *_dataIO;
212  Game *_game;
213  Sound *_sound;
214  Video *_video;
215  Draw *_draw;
216  Goblin *_goblin;
217  Init *_init;
218  Map *_map;
219  Mult *_mult;
220  PalAnim *_palAnim;
221  Scenery *_scenery;
222  Inter *_inter;
223  SaveLoad *_saveLoad;
224  VideoPlayer *_vidPlayer;
225  PreGob *_preGob;
226 
227  const char *getLangDesc(int16 language) const;
228  void validateLanguage();
229  void validateVideoMode(int16 videoMode);
230 
231  void pauseGame();
232 
233  EndiannessMethod getEndiannessMethod() const;
234  Endianness getEndianness() const;
235  Common::Platform getPlatform() const;
236  GameType getGameType() const;
237  bool isCD() const;
238  bool isEGA() const;
239  bool hasAdLib() const;
240  bool isSCNDemo() const;
241  bool isBATDemo() const;
242  bool is640x400() const;
243  bool is640x480() const;
244  bool is800x600() const;
245  bool is16Colors() const;
246  bool isTrueColor() const;
247  bool isDemo() const;
248 
249  bool hasResourceSizeWorkaround() const;
250 
251  bool isCurrentTot(const Common::String &tot) const;
252 
253  void setTrueColor(bool trueColor);
254 
255  const Graphics::PixelFormat &getPixelFormat() const;
256 
257  GobEngine(OSystem *syst);
258  ~GobEngine() override;
259 
260  void initGame(const GOBGameDescription *gd);
261  GameType getGameType(const char *gameId) const;
262 };
263 
264 } // End of namespace Gob
265 
266 #endif // GOB_GOB_H
Definition: pregob.h:48
Definition: gob.h:163
Definition: str.h:59
EngineFeature
Definition: engine.h:253
Definition: error.h:84
Definition: pixelformat.h:138
Definition: random.h:44
Definition: init.h:36
EndiannessMethod
Definition: gob.h:141
Different endianness in alternate file.
Definition: gob.h:145
Definition: anifile.h:40
Definition: scenery.h:33
Definition: sound.h:46
Definition: double_serialization.h:36
Definition: inter.h:104
Definition: map.h:75
Definition: game.h:135
Definition: goblin.h:42
Follows system endianness.
Definition: gob.h:144
Definition: draw.h:52
Always little endian.
Definition: gob.h:142
Definition: saveload.h:39
Definition: global.h:84
Definition: dataio.h:49
Definition: console.h:38
Definition: system.h:161
Definition: avi_frames.h:36
Definition: detection.h:86
Definition: engine.h:144
Definition: palanim.h:35
Platform
Definition: platform.h:46
Definition: videoplayer.h:50
Definition: mult.h:37
Language
Definition: language.h:45
Always big endian.
Definition: gob.h:143