ScummVM API documentation
cine.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 CINE_CINE_H
23#define CINE_CINE_H
24
25
26#include "common/scummsys.h"
27#include "common/file.h"
28#include "common/util.h"
29#include "common/str.h"
30#include "common/hashmap.h"
31#include "common/hash-str.h"
32#include "common/random.h"
33#include "common/events.h"
34#include "common/text-to-speech.h"
35
36#include "engines/engine.h"
37
38#include "cine/texte.h"
39#include "cine/rel.h"
40#include "cine/script.h"
41#include "cine/part.h"
42#include "cine/prc.h"
43#include "cine/msg.h"
44#include "cine/bg.h"
45#include "cine/pal.h"
46#include "cine/gfx.h"
47#include "cine/anim.h"
48#include "cine/bg_list.h"
49#include "cine/various.h"
50#include "cine/console.h"
51#include "cine/sound.h"
52#include "cine/detection.h"
53
54//#define DUMP_SCRIPTS
55
84namespace Cine {
85
86struct SeqListElement;
87
89 char name[10];
90 uint32 pNamesList;
91 int16 diskNum;
92 int32 sizeOfNamesList;
93};
94
96
97enum CINEAction {
98 kActionNone,
99 kActionMoveUp,
100 kActionMoveDown,
101 kActionMoveLeft,
102 kActionMoveRight,
103 kActionMoveUpLeft,
104 kActionMoveUpRight,
105 kActionMoveDownLeft,
106 kActionMoveDownRight,
107 kActionGameSpeedDefault,
108 kActionGameSpeedSlower,
109 kActionGameSpeedFaster,
110 kActionExamine,
111 kActionTake,
112 kActionInventory,
113 kActionUse,
114 kActionActivate,
115 kActionSpeak,
116 kActionActionMenu,
117 kActionSystemMenu,
118 kActionCollisionPage,
119 kActionMouseLeft,
120 kActionMouseRight,
121 kActionExitSonyScreen,
122 kActionMenuOptionUp,
123 kActionMenuOptionDown
124};
125
126enum TTSLanguage {
127 kEnglish = 0,
128 kFrench = 1,
129 kGerman = 2,
130 kSpanish = 3,
131 kItalian = 4
132};
133
134class CineConsole;
135
136class CineEngine : public Engine {
137
138protected:
139 // Engine APIs
140 Common::Error run() override;
141 bool hasFeature(EngineFeature f) const override;
142
143 void shutdown();
144
145 bool initGame();
146
147public:
148 CineEngine(OSystem *syst, const CINEGameDescription *gameDesc);
149 ~CineEngine() override;
150
151 void syncSoundSettings() override;
152
153 bool mayHave256Colors() const;
154 int getGameType() const;
155 uint32 getFeatures() const;
156 Common::Language getLanguage() const;
157 Common::Platform getPlatform() const;
158
159 bool loadSaveDirectory();
160 void makeSystemMenu();
161 int scummVMSaveLoadDialog(bool isSave);
162 int modifyGameSpeed(int speedChange);
163 void setDefaultGameSpeed();
164 uint32 getTimerDelay() const;
165 Common::Error loadGameState(int slot) override;
166 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
167 Common::String getSaveStateName(int slot) const override;
168 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
169 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
170
171 void sayText(const Common::String &text, Common::TextToSpeechManager::Action action);
172 void stopTextToSpeech();
173#ifdef USE_TTS
174 void mouseOverButton();
175#endif
176
177 const CINEGameDescription *_gameDescription;
178 Common::File _partFileHandle;
179
181
182 StringToVolumeResourceArrayHashMap _volumeEntriesMap;
183
184 TextHandler _textHandler;
185
186 bool _restartRequested;
187
188 Common::String _previousSaid;
189 TTSLanguage _ttsLanguage;
190 bool _copyProtectionTextScreen;
191 bool _copyProtectionColorScreen;
192 bool _saveInputMenuOpen;
193
194private:
195 void initialize();
196 void showSplashScreen();
197 void resetEngine();
198 bool checkSaveHeaderData(const ChunkHeader& hdr);
199 bool loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFormat saveGameFormat, uint32 version);
200 bool loadVersionedSaveFW(Common::SeekableReadStream &in);
201 bool loadVersionedSaveOS(Common::SeekableReadStream &in);
202 bool makeLoad(const Common::String &saveName);
203 void writeSaveHeader(Common::OutSaveFile &out, uint32 headerId);
204 void makeSaveFW(Common::OutSaveFile &out);
205 void makeSaveOS(Common::OutSaveFile &out);
206 void makeSave(const Common::String &saveFileName, uint32 playtime,
207 Common::String desc, bool isAutosave);
208 void mainLoop(int bootScriptIdx);
209 void readVolCnf();
210 Common::String getTargetSaveStateName(Common::String target, int slot) const;
211
212 bool _preLoad;
213 int _timerDelayMultiplier;
214
215public:
216 // TODO: These are pseudo-global vars
217 // They better belong to appropriate classes
218 Common::Array<AnimData> _animDataTable;
219 Common::List<BGIncrust> _bgIncrustList;
220 Common::StringArray _messageTable;
221 Common::Array<ObjectStruct> _objectTable;
222 Common::List<overlay> _overlayList;
223 Common::Array<PalEntry> _palArray;
224 Common::Array<PartBuffer> _partBuffer;
225 ScriptList _globalScripts;
226 ScriptList _objectScripts;
228
237 FWScriptInfo *_scriptInfo;
238
239 Common::Array<int16> _zoneData;
241
243
244 Common::String _commandBuffer;
247};
248
249extern CineEngine *g_cine;
250extern Sound *g_sound;
251
252#define BOOT_PRC_NAME "AUTO00.PRC"
253#define BOOT_SCRIPT_INDEX 1
254#define COPY_PROT_FAIL_PRC_NAME "L201.ANI"
255
256enum {
257 // Both FW and OS
258 VAR_MOUSE_X_POS = 249,
259 VAR_MOUSE_Y_POS = 250,
260 // FW only
261 VAR_MOUSE_X_MODE = 253,
262 VAR_MOUSE_Y_MODE = 251,
263 // OS only
264 VAR_MOUSE_X_POS_2ND = 251, // Many times used in conjunction with VAR_MOUSE_X_POS
265 VAR_MOUSE_Y_POS_2ND = 252, // Many times used in conjunction with VAR_MOUSE_Y_POS
266 VAR_BYPASS_PROTECTION = 255,
267 VAR_LOW_MEMORY = 0
268};
269
270enum {
271 MOUSE_CURSOR_NORMAL = 0,
272 MOUSE_CURSOR_DISK,
273 MOUSE_CURSOR_CROSS
274};
275
276enum {
277 kCineDebugScript = 1,
278 kCineDebugPart,
279 kCineDebugSound,
280 kCineDebugCollision,
281};
282
283enum {
284 kCmpEQ = (1 << 0),
285 kCmpGT = (1 << 1),
286 kCmpLT = (1 << 2)
287};
288
289
290} // End of namespace Cine
291
292#endif
Definition: cine.h:136
Common::Array< uint16 > _zoneQuery
Only exists in Operation Stealth.
Definition: cine.h:240
void syncSoundSettings() override
RawObjectScriptArray _relTable
Object script bytecode table.
Definition: cine.h:227
bool hasFeature(EngineFeature f) const override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
Common::Error run() override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error loadGameState(int slot) override
RawScriptArray _scriptTable
Table of script bytecode.
Definition: cine.h:236
ScriptVars _globalVars
Definition: cine.h:235
Common::String getSaveStateName(int slot) const override
Definition: script.h:325
Definition: script.h:54
Definition: sound.h:38
Definition: array.h:52
Definition: error.h:81
Definition: file.h:47
Definition: hashmap.h:85
Definition: list.h:44
Definition: savefile.h:54
Definition: random.h:44
Definition: stream.h:745
Definition: str.h:59
Definition: ustr.h:57
Definition: engine.h:155
EngineFeature
Definition: engine.h:293
Definition: system.h:166
Language
Definition: language.h:45
Platform
Definition: platform.h:93
Definition: anim.h:29
CineSaveGameFormat
Definition: saveload.h:63
Definition: detection.h:41
Definition: saveload.h:95
Definition: texte.h:47
Definition: cine.h:88