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  const char *_extra;
169 
170  EndiannessMethod _endiannessMethod;
171 
172  uint32 _pauseStart;
173 
174  // Engine APIs
175  Common::Error run() override;
176  bool hasFeature(EngineFeature f) const override;
177  void pauseEngineIntern(bool pause) override;
178  void syncSoundSettings() override;
179 
180  Common::Error initGameParts();
181  Common::Error initGraphics();
182 
183  void deinitGameParts();
184 
185 public:
186  static const Common::Language _gobToScummVMLang[];
187 
189 
190  Common::Language _language;
191  uint16 _width;
192  uint16 _height;
193  uint8 _mode;
194 
195  Graphics::PixelFormat _pixelFormat;
196 
197  Common::String _startStk;
198  Common::String _startTot;
199  uint32 _demoIndex;
200 
201  bool _copyProtection;
202  bool _noMusic;
203 
204  GobConsole *_console;
205 
206  bool _resourceSizeWorkaround;
207  bool _enableAdibou2FreeBananasWorkaround;
208  bool _enableAdibou2FlowersInfiniteLoopWorkaround;
209 
210  Global *_global;
211  Util *_util;
212  DataIO *_dataIO;
213  Game *_game;
214  Sound *_sound;
215  Video *_video;
216  Draw *_draw;
217  Goblin *_goblin;
218  Init *_init;
219  Map *_map;
220  Mult *_mult;
221  PalAnim *_palAnim;
222  Scenery *_scenery;
223  Inter *_inter;
224  SaveLoad *_saveLoad;
225  VideoPlayer *_vidPlayer;
226  PreGob *_preGob;
227 
228  const char *getLangDesc(int16 language) const;
229  void validateLanguage();
230  void validateVideoMode(int16 videoMode);
231 
232  void pauseGame();
233 
234  EndiannessMethod getEndiannessMethod() const;
235  Endianness getEndianness() const;
236  Common::Platform getPlatform() const;
237  GameType getGameType() const;
238  bool isCD() const;
239  bool isEGA() const;
240  bool hasAdLib() const;
241  bool isSCNDemo() const;
242  bool isBATDemo() const;
243  bool is640x400() const;
244  bool is640x480() const;
245  bool is800x600() const;
246  bool is16Colors() const;
247  bool isTrueColor() const;
248  bool isDemo() const;
249 
250  bool hasResourceSizeWorkaround() const;
251 
252  bool isCurrentTot(const Common::String &tot) const;
253 
254  void setTrueColor(bool trueColor);
255 
256  const Graphics::PixelFormat &getPixelFormat() const;
257 
258  GobEngine(OSystem *syst);
259  ~GobEngine() override;
260 
261  void initGame(const GOBGameDescription *gd);
262  GameType getGameType(const char *gameId) const;
263 
269  const char *getGameVersion() const;
270 };
271 
272 } // End of namespace Gob
273 
274 #endif // GOB_GOB_H
Definition: pregob.h:48
const char * getGameVersion() const
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