ScummVM API documentation
xeen.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 XEEN_XEEN_H
23#define XEEN_XEEN_H
24
25#include "common/scummsys.h"
26#include "common/system.h"
27#include "common/text-to-speech.h"
28#include "common/error.h"
29#include "common/random.h"
30#include "common/serializer.h"
31#include "common/util.h"
32#include "engines/engine.h"
33#include "mm/xeen/combat.h"
34#include "mm/xeen/debugger.h"
35#include "mm/xeen/dialogs/dialogs.h"
36#include "mm/xeen/events.h"
37#include "mm/xeen/files.h"
38#include "mm/xeen/interface.h"
39#include "mm/xeen/locations.h"
40#include "mm/xeen/map.h"
41#include "mm/xeen/party.h"
42#include "mm/xeen/patcher.h"
43#include "mm/xeen/resources.h"
44#include "mm/xeen/saves.h"
45#include "mm/xeen/screen.h"
46#include "mm/xeen/scripts.h"
47#include "mm/xeen/sound.h"
48#include "mm/xeen/spells.h"
49#include "mm/xeen/window.h"
50#include "mm/detection.h"
51#include "mm/mm.h"
52
62namespace MM {
63namespace Xeen {
64
65enum Mode {
66 MODE_FF = -1,
67 MODE_STARTUP = 0,
68 MODE_INTERACTIVE = 1,
69 MODE_COMBAT = 2,
70 MODE_3 = 3,
71 MODE_4 = 4,
72 MODE_SLEEPING = 5,
73 MODE_6 = 6,
74 MODE_7 = 7,
75 MODE_8 = 8,
76 MODE_SCRIPT_IN_PROGRESS = 9,
77 MODE_CHARACTER_INFO = 10,
78 MODE_INTERACTIVE2 = 12,
79 MODE_DIALOG_123 = 13,
80 MODE_INTERACTIVE7 = 17,
81 MODE_86 = 86
82};
83
84enum GameMode {
85 GMODE_NONE = 0,
86 GMODE_STARTUP = 1,
87 GMODE_MENU = 2,
88 GMODE_PLAY_GAME = 3,
89 GMODE_QUIT = 4
90};
91
92#ifdef USE_TTS
93
94enum TTSLanguage {
95 kEnglish = 0,
96 kGerman = 1,
97 kFrench = 2,
98 kSpanish = 3,
99 kRussian = 4,
100 kChinese = 5
101};
102
103#endif
104
105#define XEEN_SAVEGAME_VERSION 2
106
107class XeenEngine : public MMEngine {
111 struct ExtendedOptions {
112 bool _showItemCosts;
113 bool _durableArmor;
114 bool _showHpSpBars;
115
116 ExtendedOptions() :
117 _showItemCosts(false),
118 _durableArmor(false),
119 _showHpSpBars(false)
120 {}
121 };
122private:
126 bool initialize();
127
131 void loadSettings();
132
133 // Engine APIs
134 Common::Error run() override;
135
140 void outerGameLoop();
141
145 void gameLoop();
146
150 void play();
151protected:
152 int _loadSaveSlot;
153protected:
157 virtual void showStartup() = 0;
158
162 virtual void showMainMenu() = 0;
163
167 virtual void playGame();
168
172 virtual void death() = 0;
173public:
174 Combat *_combat;
175 Debugger *_debugger;
176 EventsManager *_events;
177 FileManager *_files;
178 Interface *_interface;
179 LocationManager *_locations;
180 Map *_map;
181 Party *_party;
182 Patcher *_patcher;
183 Resources *_resources;
184 SavesManager *_saves;
185 Screen *_screen;
186 Scripts *_scripts;
187 Sound *_sound;
188 Spells *_spells;
189 Windows *_windows;
190 Mode _mode;
191 GameMode _gameMode;
192 bool _noDirectionSense;
193 bool _startupWindowActive;
194 uint _endingScore;
195 bool _gameWon[3];
196 uint _finalScore;
197 ExtendedOptions _extOptions;
198#ifdef USE_TTS
199 bool _mouseMoved;
200 TTSLanguage _ttsLanguage;
201 Common::CodePage _ttsTextEncoding;
202#endif
203
204 CCArchive *_xeenCc = nullptr, *_darkCc = nullptr,
205 *_introCc = nullptr;
206 SaveArchive *_xeenSave = nullptr, *_darkSave = nullptr;
207 BaseCCArchive *_currentArchive = nullptr;
208 SaveArchive *_currentSave = nullptr;
209public:
211 ~XeenEngine() override;
212
217 uint32 getSpecificGameId() const;
218
222 uint32 getGameFeatures() const;
223
227 int getRandomNumber(int maxNumber);
228
232 int getRandomNumber(int minNumber, int maxNumber);
233
237 bool shouldExit() const {
238 return _gameMode != GMODE_NONE || isLoadPending() || shouldQuit();
239 }
240
244 bool isLoadPending() const {
245 return _loadSaveSlot != -1;
246 }
247
251 Common::Error loadGameState(int slot) override;
252
256 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
257
261 void syncSoundSettings() override;
262
266 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
267
271 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
272
277
284 virtual void showCutscene(const Common::String &name, int status, uint score) {
285 }
286
290 virtual void dream() = 0;
291
292 static Common::String printMil(uint value);
293
294 static Common::String printK(uint value);
295
296 static Common::String printK2(uint value);
297
302
306 void GUIError(const Common::U32String &msg);
307
308#ifdef USE_TTS
312 void sayText(const Common::String &text, Common::TextToSpeechManager::Action action = Common::TextToSpeechManager::QUEUE_NO_REPEAT) const;
313
317 void stopTextToSpeech() const;
318
325#endif
326};
327
328extern XeenEngine *g_vm;
329
330} // End of namespace Xeen
331} // End of namespace MM
332
333#endif
Definition: error.h:81
Definition: str.h:59
Definition: ustr.h:57
static bool shouldQuit()
Definition: mm.h:37
Definition: cc_archive.h:51
Definition: cc_archive.h:94
Definition: sound.h:35
Definition: combat.h:114
Definition: debugger.h:33
Definition: events.h:60
Definition: files.h:67
Definition: interface.h:98
Definition: locations.h:454
Definition: map.h:422
Definition: party.h:159
Definition: patcher.h:28
Definition: resources.h:40
Definition: files.h:150
Definition: saves.h:48
Definition: screen.h:40
Definition: scripts.h:213
Definition: spells.h:62
Definition: window.h:53
Definition: xeen.h:107
virtual void showStartup()=0
uint32 getSpecificGameId() const
virtual void death()=0
void GUIError(const Common::U32String &msg)
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
virtual void showMainMenu()=0
bool isLoadPending() const
Definition: xeen.h:244
int getRandomNumber(int minNumber, int maxNumber)
virtual void dream()=0
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
virtual void playGame()
virtual void showCutscene(const Common::String &name, int status, uint score)
Definition: xeen.h:284
bool canSaveAutosaveCurrently() override
void sayText(const Common::String &text, Common::TextToSpeechManager::Action action=Common::TextToSpeechManager::QUEUE_NO_REPEAT) const
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
Common::Error loadGameState(int slot) override
int getRandomNumber(int maxNumber)
void stopTextToSpeech() const
uint32 getGameFeatures() const
Common::U32String convertSpanishText(const Common::String &text) const
bool shouldExit() const
Definition: xeen.h:237
void syncSoundSettings() override
Definition: system.h:166
Definition: detection.h:27
Definition: detection.h:43