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