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#include "common/text-to-speech.h"
34
35#include "graphics/pixelformat.h"
36
37#include "engines/engine.h"
38
39#include "gob/console.h"
40#include "gob/detection/detection.h"
41
91class GobMetaEngine;
92
93namespace Gob {
94
95class Game;
96class Sound;
97class Video;
98class Global;
99class Draw;
100class DataIO;
101class Goblin;
102class VideoPlayer;
103class Init;
104class Inter;
105class Map;
106class Mult;
107class PalAnim;
108class Scenery;
109class Util;
110class SaveLoad;
111class PreGob;
112
113#define WRITE_VAR_UINT32(var, val) _vm->_inter->_variables->writeVar32(var, val)
114#define WRITE_VAR_UINT16(var, val) _vm->_inter->_variables->writeVar16(var, val)
115#define WRITE_VAR_UINT8(var, val) _vm->_inter->_variables->writeVar8(var, val)
116#define WRITE_VAR_STR(var, str) _vm->_inter->_variables->writeVarString(var, str)
117#define WRITE_VARO_UINT32(off, val) _vm->_inter->_variables->writeOff32(off, val)
118#define WRITE_VARO_UINT16(off, val) _vm->_inter->_variables->writeOff16(off, val)
119#define WRITE_VARO_UINT8(off, val) _vm->_inter->_variables->writeOff8(off, val)
120#define WRITE_VARO_STR(off, str) _vm->_inter->_variables->writeOffString(off, str)
121#define READ_VAR_UINT32(var) _vm->_inter->_variables->readVar32(var)
122#define READ_VAR_UINT16(var) _vm->_inter->_variables->readVar16(var)
123#define READ_VAR_UINT8(var) _vm->_inter->_variables->readVar8(var)
124#define READ_VARO_UINT32(off) _vm->_inter->_variables->readOff32(off)
125#define READ_VARO_UINT16(off) _vm->_inter->_variables->readOff16(off)
126#define READ_VARO_UINT8(off) _vm->_inter->_variables->readOff8(off)
127#define GET_VAR_STR(var) _vm->_inter->_variables->getAddressVarString(var)
128#define GET_VARO_STR(off) _vm->_inter->_variables->getAddressOffString(off)
129#define GET_VAR_FSTR(var) _vm->_inter->_variables->getAddressVarString(var)
130#define GET_VARO_FSTR(off) _vm->_inter->_variables->getAddressOffString(off)
131
132#define WRITE_VAR_OFFSET(off, val) WRITE_VARO_UINT32((off), (val))
133#define WRITE_VAR(var, val) WRITE_VAR_UINT32((var), (val))
134#define VAR_OFFSET(off) READ_VARO_UINT32(off)
135#define VAR(var) READ_VAR_UINT32(var)
136
137
138// WARNING: Reordering these will invalidate save games!
139enum Endianness {
140 kEndiannessLE,
141 kEndiannessBE
142};
143
144enum EndiannessMethod {
145 kEndiannessMethodLE,
146 kEndiannessMethodBE,
147 kEndiannessMethodSystem,
148 kEndiannessMethodAltFile
149};
150
151enum {
152 kDebugFuncOp = 1,
153 kDebugDrawOp,
154 kDebugGobOp,
155 kDebugSound,
156 kDebugExpression,
157 kDebugGameFlow,
158 kDebugFileIO,
159 kDebugSaveLoad,
160 kDebugGraphics,
161 kDebugVideo,
162 kDebugHotspots,
163 kDebugDemo,
164};
165
166class GobEngine : public Engine {
167private:
168 GameType _gameType;
169 int32 _features;
170 Common::Platform _platform;
171 const char *_extra;
172
173 EndiannessMethod _endiannessMethod;
174
175 uint32 _pauseStart;
176
177 // Engine APIs
178 Common::Error run() override;
179 bool hasFeature(EngineFeature f) const override;
180 void pauseEngineIntern(bool pause) override;
181 void syncSoundSettings() override;
182
183 Common::Error initGameParts();
184 Common::Error initGraphics();
185
186 void deinitGameParts();
187
188public:
189 static const Common::Language _gobToScummVMLang[];
190
192
193 Common::Language _language;
194 uint16 _width;
195 uint16 _height;
196 uint8 _mode;
197
198 Graphics::PixelFormat _pixelFormat;
199
200 Common::String _startStk;
201 Common::String _startTot;
202 uint32 _demoIndex;
203
204 bool _copyProtection;
205 bool _noMusic;
206
207 GobConsole *_console;
208
209 bool _resourceSizeWorkaround;
210 bool _enableAdibou2FreeBananasWorkaround;
211 bool _enableAdibou2FlowersInfiniteLoopWorkaround;
212
213 Global *_global;
214 Util *_util;
215 DataIO *_dataIO;
216 Game *_game;
217 Sound *_sound;
218 Video *_video;
219 Draw *_draw;
220 Goblin *_goblin;
221 Init *_init;
222 Map *_map;
223 Mult *_mult;
224 PalAnim *_palAnim;
225 Scenery *_scenery;
226 Inter *_inter;
227 SaveLoad *_saveLoad;
228 VideoPlayer *_vidPlayer;
229 PreGob *_preGob;
230
231#ifdef USE_TTS
232 bool _weenVoiceNotepad;
233 Common::CodePage _ttsEncoding;
234#endif
235
236 const char *getLangDesc(int16 language) const;
237 void validateLanguage();
238 void validateVideoMode(int16 videoMode);
239
240 void pauseGame();
241
242#ifdef USE_TTS
243 void sayText(const Common::String &text, Common::TextToSpeechManager::Action action = Common::TextToSpeechManager::INTERRUPT) const;
244 void stopTextToSpeech() const;
245#endif
246
247 EndiannessMethod getEndiannessMethod() const;
248 Endianness getEndianness() const;
249 Common::Platform getPlatform() const;
250 GameType getGameType() const;
251 bool isCD() const;
252 bool isEGA() const;
253 bool hasAdLib() const;
254 bool isSCNDemo() const;
255 bool isBATDemo() const;
256 bool is640x400() const;
257 bool is640x480() const;
258 bool is800x600() const;
259 bool is16Colors() const;
260 bool isTrueColor() const;
261 bool isDemo() const;
262
263 bool hasResourceSizeWorkaround() const;
264
265 bool isCurrentTot(const Common::String &tot) const;
266 void setTrueColor(bool trueColor, bool convertAllSurfaces, Graphics::PixelFormat *format = nullptr);
267
268 const Graphics::PixelFormat &getPixelFormat() const;
269
270 GobEngine(OSystem *syst);
271 ~GobEngine() override;
272
273 void initGame(const GOBGameDescription *gd);
274
275 GameType getGameType(const char *gameId) const;
276 bool gameTypeHasAddOns() const override;
277 bool dirCanBeGameAddOn(const Common::FSDirectory &dir) const override;
278 bool dirMustBeGameAddOn(const Common::FSDirectory &dir) const override;
279
285 const char *getGameVersion() const;
286};
287
288} // End of namespace Gob
289
290#endif // GOB_GOB_H
Definition: error.h:81
Definition: fs.h:341
Definition: random.h:44
Definition: str.h:59
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
Definition: dataio.h:49
Definition: draw.h:57
Definition: game.h:157
Definition: global.h:84
Definition: console.h:38
Definition: gob.h:166
bool dirMustBeGameAddOn(const Common::FSDirectory &dir) const override
const char * getGameVersion() const
bool gameTypeHasAddOns() const override
bool dirCanBeGameAddOn(const Common::FSDirectory &dir) const override
Definition: goblin.h:42
Definition: init.h:36
Definition: inter.h:105
Definition: map.h:75
Definition: mult.h:37
Definition: palanim.h:35
Definition: pregob.h:48
Definition: saveload.h:39
Definition: scenery.h:33
Definition: sound.h:46
Definition: util.h:86
Definition: video.h:77
Definition: videoplayer.h:50
Definition: system.h:166
Language
Definition: language.h:45
Platform
Definition: platform.h:93
Definition: detection.h:86
Definition: pixelformat.h:138