ScummVM API documentation
sci.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
22#ifndef SCI_SCI_H
23#define SCI_SCI_H
24
25#include "engines/engine.h"
26#include "common/macresman.h"
27#include "common/util.h"
28#include "common/random.h"
29#include "sci/engine/vm_types.h" // for Selector
30#include "sci/debug.h" // for DebugState
31#include "sci/detection.h" // Shared code between detection and engine
32
34
45namespace Sci {
46
47struct EngineState;
48class Vocabulary;
49class ResourceManager;
50class Kernel;
51class GameFeatures;
52class GuestAdditions;
53class Console;
54class AudioPlayer;
55class SoundCommandParser;
56class EventManager;
57class SegManager;
58class ScriptPatcher;
59class Sync;
60
61class GfxAnimate;
62class GfxCache;
63class GfxCompare;
64class GfxControls16;
65class GfxControls32;
66class GfxCoordAdjuster16;
67class GfxCursor;
68class GfxMacFontManager;
69class GfxMacIconBar;
70class GfxMenu;
71class GfxPaint16;
72class GfxPaint32;
73class GfxPalette;
74class GfxPalette32;
75class GfxRemap;
76class GfxRemap32;
77class GfxPorts;
78class GfxScreen;
79class GfxText16;
80class GfxText32;
81class GfxTransitions;
82class SciTTS;
83
84#ifdef ENABLE_SCI32
85class GfxFrameout;
86class Audio32;
87class Video32;
88class GfxTransitions32;
89class GfxCursor32;
90#endif
91
94 kDebugLevelError = 1,
95 kDebugLevelNodes,
96 kDebugLevelGraphics,
97 kDebugLevelStrings,
98 kDebugLevelMemory,
99 kDebugLevelFuncCheck,
100 kDebugLevelBresen,
101 kDebugLevelSound,
102 kDebugLevelBaseSetter,
103 kDebugLevelParser,
104 kDebugLevelSaid,
105 kDebugLevelFile,
106 kDebugLevelTime,
107 kDebugLevelRoom,
108 kDebugLevelAvoidPath,
109 kDebugLevelDclImplode,
110 kDebugLevelVM,
111 kDebugLevelScripts,
112 kDebugLevelGC,
113 kDebugLevelResMan,
114 kDebugLevelOnStartup,
115 kDebugLevelDebugMode,
116 kDebugLevelPatcher,
117 kDebugLevelWorkarounds,
118 kDebugLevelVideo,
119 kDebugLevelGame,
120};
121
122
125 K_LANG_NONE = 0,
126 K_LANG_ENGLISH = 1,
127 K_LANG_FRENCH = 33,
128 K_LANG_SPANISH = 34,
129 K_LANG_ITALIAN = 39,
130 K_LANG_GERMAN = 49,
131 K_LANG_JAPANESE = 81,
132 K_LANG_PORTUGUESE = 351
133};
134
135class SciEngine : public Engine {
136 friend class Console;
137public:
138 SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gameId);
139 ~SciEngine() override;
140
141 // Engine APIs
142 Common::Error run() override;
143 bool hasFeature(EngineFeature f) const override;
144 void pauseEngineIntern(bool pause) override;
145 void severeError();
146 Console *getSciDebugger();
147 Common::Error loadGameState(int slot) override;
148 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
149 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
150 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
151 void syncSoundSettings() override;
152 void updateSoundMixerVolumes();
153 uint32 getTickCount();
154 void setTickCount(const uint32 ticks);
155 void errorString(const char *buf1, char *buf2, int size) override;
156
182 int getAutosaveSlot() const override { return -1; }
183
184 const SciGameId &getGameId() const { return _gameId; }
185 const char *getGameIdStr() const;
186 Common::Language getLanguage() const;
187
193 bool isLanguageRTL() const;
194
197 bool isDemo() const;
198 bool isCD() const;
199 bool useHiresGraphics() const;
200
205 bool isBE() const;
206
207 bool hasParser() const;
208
210 bool hasMacFonts() const;
211
213 bool hasMacIconBar() const;
214
221
222 inline ResourceManager *getResMan() const { return _resMan; }
223 inline ScriptPatcher *getScriptPatcher() const { return _scriptPatcher; }
224 inline Kernel *getKernel() const { return _kernel; }
225 inline EngineState *getEngineState() const { return _gamestate; }
226 inline Vocabulary *getVocabulary() const { return _vocabulary; }
227 inline EventManager *getEventManager() const { return _eventMan; }
228 inline reg_t getGameObject() const { return _gameObjectAddress; } // Gets the game object VM address
229
230 Common::RandomSource &getRNG() { return _rng; }
231
232 Common::String getSavegameName(int nr) const;
233 Common::String getSavegamePattern() const;
234
237
240
243
245 const char *getGameObjectName();
246
252 int inQfGImportRoom() const;
253
256
261 void sleep(uint32 msecs);
262
263 void scriptDebug();
264 bool checkExportBreakpoint(uint16 script, uint16 pubfunct);
265 bool checkSelectorBreakpoint(BreakpointType breakpointType, reg_t send_obj, int selector);
266 bool checkAddressBreakpoint(const reg_t &address);
267
268public:
269 bool checkKernelBreakpoint(const Common::String &name);
270
282 Common::String strSplitLanguage(const char *str, uint16 *splitLanguage, const char *sep);
283 Common::String strSplit(const char *str, const char *sep) {
284 return strSplitLanguage(str, NULL, sep);
285 }
286
287 kLanguage getSciLanguage();
288 void setSciLanguage(kLanguage lang);
289 void setSciLanguage();
290
291 Common::String getSciLanguageString(const Common::String &str, kLanguage requestedLanguage, kLanguage *secondaryLanguage = nullptr, uint16 *languageSplitter = nullptr) const;
292
293 // Check if vocabulary needs to get switched (in multilingual parser games)
294 void checkVocabularySwitch();
295
296 // Initializes ports and paint16 for non-sci32 games, also sets default palette
297 void initGraphics();
298
299public:
300 GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
301 GfxCache *_gfxCache;
302 GfxCompare *_gfxCompare;
303 GfxControls16 *_gfxControls16; // Controls for 16-bit gfx
304 GfxCoordAdjuster16 *_gfxCoordAdjuster; // Coordinate adjuster for 16-bit gfx
305 GfxCursor *_gfxCursor; // 16-bit cursor
306 GfxMenu *_gfxMenu; // Menu for 16-bit gfx
307 GfxPalette *_gfxPalette16;
308 GfxRemap *_gfxRemap16; // Remapping for the QFG4 demo
309 GfxPaint16 *_gfxPaint16; // Painting in 16-bit gfx
310 GfxPorts *_gfxPorts; // Port management for 16-bit gfx
311 GfxScreen *_gfxScreen; // Screen class for 16-bit
312 GfxText16 *_gfxText16;
313 GfxTransitions *_gfxTransitions; // transitions between screens for 16-bit gfx
314 GfxMacIconBar *_gfxMacIconBar; // Mac Icon Bar manager
315 GfxMacFontManager *_gfxMacFontManager; // null when not applicable
316 SciTTS *_tts;
317
318#ifdef ENABLE_SCI32
319 GfxControls32 *_gfxControls32; // Controls for 32-bit gfx
320 GfxPalette32 *_gfxPalette32; // Palette for 32-bit gfx
321 GfxRemap32 *_gfxRemap32; // Remapping for 32-bit gfx
322 GfxPaint32 *_gfxPaint32; // Painting in 32-bit gfx
323 GfxText32 *_gfxText32;
324
325 Audio32 *_audio32;
326 Video32 *_video32;
327 GfxFrameout *_gfxFrameout; // kFrameout and the like for 32-bit gfx
328 GfxTransitions32 *_gfxTransitions32;
329 GfxCursor32 *_gfxCursor32;
330#endif
331
332 AudioPlayer *_audio;
333 Sync *_sync;
334 SoundCommandParser *_soundCmd;
335 GameFeatures *_features;
336 GuestAdditions *_guestAdditions;
337
338 opcode_format (*_opcode_formats)[4];
339
340 DebugState _debugState;
341 uint32 _speedThrottleDelay; // kGameIsRestarting maximum delay
342
343 Common::MacResManager *getMacExecutable() { return &_macExecutable; }
344
345private:
354 bool initGame();
355
363 void runGame();
364
371 void initStackBaseWithSelector(Selector selector);
372
379 void loadMacExecutable();
380
388 void loadMacFonts();
389
399 bool gameHasFanMadePatch();
400
405 void setLauncherLanguage();
406
407 const ADGameDescription *_gameDescription;
408 const SciGameId _gameId;
409 ResourceManager *_resMan;
410 ScriptPatcher *_scriptPatcher;
411 EngineState *_gamestate;
412 Kernel *_kernel;
413 Vocabulary *_vocabulary;
414 int16 _vocabularyLanguage;
415 EventManager *_eventMan;
416 reg_t _gameObjectAddress;
417 Console *_console;
419 Common::MacResManager _macExecutable;
420 bool _useHiresGraphics; // user-option for GK1, KQ6, PQ4
421 bool _inErrorString;
422};
423
430extern SciEngine *g_sci;
431
432} // End of namespace Sci
433
434#endif // SCI_SCI_H
Definition: error.h:81
Definition: macresman.h:126
Definition: random.h:44
Definition: str.h:59
Definition: ustr.h:57
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
Definition: system.h:166
Definition: audio32.h:174
Definition: audio.h:55
Definition: console.h:36
Definition: features.h:56
Definition: animate.h:87
Definition: cache.h:38
Definition: compare.h:34
Definition: controls16.h:53
Definition: controls32.h:389
Definition: coordadjuster.h:37
Definition: cursor32.h:34
Definition: cursor.h:55
Definition: frameout.h:43
Definition: macfont.h:78
Definition: maciconbar.h:36
Definition: menu.h:80
Definition: paint16.h:37
Definition: paint32.h:42
Definition: palette32.h:234
Definition: palette16.h:41
Definition: ports.h:52
Definition: remap32.h:234
Definition: remap.h:35
Definition: screen.h:70
Definition: text16.h:45
Definition: text32.h:53
Definition: transitions32.h:215
Definition: transitions.h:62
Definition: guest_additions.h:62
Definition: resource.h:327
Definition: sci.h:135
void sleep(uint32 msecs)
Common::String wrapFilename(const Common::String &name) const
bool hasMacSaveRestoreDialogs() const
bool isLanguageRTL() const
int getAutosaveSlot() const override
Definition: sci.h:182
Common::String unwrapFilename(const Common::String &name) const
void showQfgImportMessageBox() const
void syncSoundSettings() override
from ScummVM to the game
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
int inQfGImportRoom() const
const char * getGameObjectName()
Common::String strSplitLanguage(const char *str, uint16 *splitLanguage, const char *sep)
void errorString(const char *buf1, char *buf2, int size) override
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
bool hasMacFonts() const
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
bool hasMacIconBar() const
Common::Error loadGameState(int slot) override
Common::Platform getPlatform() const
bool isBE() const
Common::String getFilePrefix() const
bool hasFeature(EngineFeature f) const override
void pauseEngineIntern(bool pause) override
Common::Error run() override
Definition: tts.h:30
Definition: script_patches.h:91
Definition: soundcmd.h:36
Definition: sync.h:44
Definition: video32.h:787
Language
Definition: language.h:45
Platform
Definition: platform.h:93
void initGraphics(int width, int height)
Definition: console.h:28
kLanguage
Definition: sci.h:124
SciEngine * g_sci
kDebugLevels
Definition: sci.h:93
BreakpointType
Definition: debug.h:31
Definition: advancedDetector.h:164
Definition: debug.h:80
Definition: vm_types.h:39