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 
34 #include "engines/engine.h"
35 
36 #include "cine/texte.h"
37 #include "cine/rel.h"
38 #include "cine/script.h"
39 #include "cine/part.h"
40 #include "cine/prc.h"
41 #include "cine/msg.h"
42 #include "cine/bg.h"
43 #include "cine/pal.h"
44 #include "cine/gfx.h"
45 #include "cine/anim.h"
46 #include "cine/bg_list.h"
47 #include "cine/various.h"
48 #include "cine/console.h"
49 #include "cine/sound.h"
50 #include "cine/detection.h"
51 
52 //#define DUMP_SCRIPTS
53 
82 namespace Cine {
83 
84 struct SeqListElement;
85 
87  char name[10];
88  uint32 pNamesList;
89  int16 diskNum;
90  int32 sizeOfNamesList;
91 };
92 
94 
95 class CineConsole;
96 
97 class CineEngine : public Engine {
98 
99 protected:
100  // Engine APIs
101  Common::Error run() override;
102  bool hasFeature(EngineFeature f) const override;
103 
104  void shutdown();
105 
106  bool initGame();
107 
108 public:
109  CineEngine(OSystem *syst, const CINEGameDescription *gameDesc);
110  ~CineEngine() override;
111 
112  void syncSoundSettings() override;
113 
114  bool mayHave256Colors() const;
115  int getGameType() const;
116  uint32 getFeatures() const;
117  Common::Language getLanguage() const;
118  Common::Platform getPlatform() const;
119 
120  bool loadSaveDirectory();
121  void makeSystemMenu();
122  int scummVMSaveLoadDialog(bool isSave);
123  int modifyGameSpeed(int speedChange);
124  void setDefaultGameSpeed();
125  uint32 getTimerDelay() const;
126  Common::Error loadGameState(int slot) override;
127  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
128  Common::String getSaveStateName(int slot) const override;
129  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
130  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
131 
132  const CINEGameDescription *_gameDescription;
133  Common::File _partFileHandle;
134 
136 
137  StringToVolumeResourceArrayHashMap _volumeEntriesMap;
138 
139  TextHandler _textHandler;
140 
141  bool _restartRequested;
142 
143 private:
144  void initialize();
145  void showSplashScreen();
146  void resetEngine();
147  bool checkSaveHeaderData(const ChunkHeader& hdr);
148  bool loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFormat saveGameFormat, uint32 version);
149  bool loadVersionedSaveFW(Common::SeekableReadStream &in);
150  bool loadVersionedSaveOS(Common::SeekableReadStream &in);
151  bool makeLoad(const Common::String &saveName);
152  void writeSaveHeader(Common::OutSaveFile &out, uint32 headerId);
153  void makeSaveFW(Common::OutSaveFile &out);
154  void makeSaveOS(Common::OutSaveFile &out);
155  void makeSave(const Common::String &saveFileName, uint32 playtime,
156  Common::String desc, bool isAutosave);
157  void mainLoop(int bootScriptIdx);
158  void readVolCnf();
159  Common::String getTargetSaveStateName(Common::String target, int slot) const;
160 
161  bool _preLoad;
162  int _timerDelayMultiplier;
163 
164 public:
165  // TODO: These are pseudo-global vars
166  // They better belong to appropriate classes
167  Common::Array<AnimData> _animDataTable;
168  Common::List<BGIncrust> _bgIncrustList;
169  Common::StringArray _messageTable;
170  Common::Array<ObjectStruct> _objectTable;
171  Common::List<overlay> _overlayList;
172  Common::Array<PalEntry> _palArray;
173  Common::Array<PartBuffer> _partBuffer;
174  ScriptList _globalScripts;
175  ScriptList _objectScripts;
177 
186  FWScriptInfo *_scriptInfo;
187 
188  Common::Array<int16> _zoneData;
190 
192 
193  Common::String _commandBuffer;
194  Common::Array<Common::KeyState> _keyInputList;
195 };
196 
197 extern CineEngine *g_cine;
198 extern Sound *g_sound;
199 
200 #define BOOT_PRC_NAME "AUTO00.PRC"
201 #define BOOT_SCRIPT_INDEX 1
202 #define COPY_PROT_FAIL_PRC_NAME "L201.ANI"
203 
204 enum {
205  // Both FW and OS
206  VAR_MOUSE_X_POS = 249,
207  VAR_MOUSE_Y_POS = 250,
208  // FW only
209  VAR_MOUSE_X_MODE = 253,
210  VAR_MOUSE_Y_MODE = 251,
211  // OS only
212  VAR_MOUSE_X_POS_2ND = 251, // Many times used in conjunction with VAR_MOUSE_X_POS
213  VAR_MOUSE_Y_POS_2ND = 252, // Many times used in conjunction with VAR_MOUSE_Y_POS
214  VAR_BYPASS_PROTECTION = 255,
215  VAR_LOW_MEMORY = 0
216 };
217 
218 enum {
219  MOUSE_CURSOR_NORMAL = 0,
220  MOUSE_CURSOR_DISK,
221  MOUSE_CURSOR_CROSS
222 };
223 
224 enum {
225  kCineDebugScript = 1 << 0,
226  kCineDebugPart = 1 << 1,
227  kCineDebugSound = 1 << 2,
228  kCineDebugCollision = 1 << 3
229 };
230 
231 enum {
232  kCmpEQ = (1 << 0),
233  kCmpGT = (1 << 1),
234  kCmpLT = (1 << 2)
235 };
236 
237 
238 } // End of namespace Cine
239 
240 #endif
Definition: script.h:54
Definition: str.h:59
ScriptVars _globalVars
Definition: cine.h:184
EngineFeature
Definition: engine.h:250
RawScriptArray _scriptTable
Table of script bytecode.
Definition: cine.h:185
Definition: savefile.h:54
Definition: error.h:84
Definition: array.h:52
Definition: texte.h:47
Definition: anim.h:29
Definition: random.h:44
Definition: detection.h:41
Definition: list.h:44
Definition: stream.h:745
Definition: sound.h:38
Definition: console.h:34
Common::Array< uint16 > _zoneQuery
Only exists in Operation Stealth.
Definition: cine.h:189
Definition: cine.h:97
Definition: hashmap.h:85
Definition: ustr.h:57
Definition: file.h:47
Definition: saveload.h:95
Definition: system.h:167
Definition: engine.h:143
Definition: cine.h:86
Definition: script.h:325
Platform
Definition: platform.h:46
CineSaveGameFormat
Definition: saveload.h:63
Language
Definition: language.h:45
RawObjectScriptArray _relTable
Object script bytecode table.
Definition: cine.h:176