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