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 
91 class GobMetaEngine;
92 
93 namespace Gob {
94 
95 class Game;
96 class Sound;
97 class Video;
98 class Global;
99 class Draw;
100 class DataIO;
101 class Goblin;
102 class VideoPlayer;
103 class Init;
104 class Inter;
105 class Map;
106 class Mult;
107 class PalAnim;
108 class Scenery;
109 class Util;
110 class SaveLoad;
111 class 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!
139 enum Endianness {
140  kEndiannessLE,
141  kEndiannessBE
142 };
143 
144 enum EndiannessMethod {
145  kEndiannessMethodLE,
146  kEndiannessMethodBE,
147  kEndiannessMethodSystem,
148  kEndiannessMethodAltFile
149 };
150 
151 enum {
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 
166 class GobEngine : public Engine {
167 private:
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 
188 public:
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: pregob.h:48
const char * getGameVersion() const
bool dirMustBeGameAddOn(const Common::FSDirectory &dir) const override
Definition: gob.h:166
Definition: str.h:59
EngineFeature
Definition: engine.h:260
Definition: error.h:81
Definition: pixelformat.h:138
Definition: random.h:44
bool dirCanBeGameAddOn(const Common::FSDirectory &dir) const override
Definition: init.h:36
Definition: anifile.h:40
Definition: scenery.h:33
Definition: sound.h:46
Definition: double_serialization.h:36
Definition: inter.h:105
Definition: map.h:75
Definition: game.h:136
Definition: goblin.h:42
bool gameTypeHasAddOns() const override
Definition: draw.h:53
Definition: fs.h:341
Definition: saveload.h:39
Definition: global.h:84
Definition: dataio.h:49
Definition: console.h:38
Definition: system.h:163
Definition: avi_frames.h:36
Definition: detection.h:86
Definition: engine.h:146
Definition: palanim.h:35
Platform
Definition: platform.h:46
Definition: videoplayer.h:50
Definition: mult.h:37
Language
Definition: language.h:45