ScummVM API documentation
cruise.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 CRUISE_CRUISE_H
23 #define CRUISE_CRUISE_H
24 
25 #include "common/scummsys.h"
26 #include "common/util.h"
27 #include "common/random.h"
28 #include "common/text-to-speech.h"
29 
30 #include "engines/engine.h"
31 
32 #include "cruise/cruise_main.h"
33 #include "cruise/debugger.h"
34 #include "cruise/sound.h"
35 
44 namespace Cruise {
45 
46 #define GAME_FRAME_DELAY_1 50
47 #define GAME_FRAME_DELAY_2 100
48 
49 #define MAX_LANGUAGE_STRINGS 25
50 
51 
52 
53 enum CRUISEAction {
54  kActionNone,
55  kActionFastMode,
56  kActionExit,
57  kActionEscape,
58  kActionPause,
59  kActionPlayerMenu,
60  kActionInventory,
61  kActionEndUserWaiting,
62  kActionIncreaseGameSpeed,
63  kActionDecreaseGameSpeed
64 };
65 
66 enum LangStringId { ID_PAUSED = 0, ID_INVENTORY = 5, ID_SPEAK_ABOUT = 6, ID_PLAYER_MENU = 7,
67  ID_SAVE = 9, ID_LOAD = 10, ID_RESTART = 11, ID_QUIT = 12};
68 
69 struct CRUISEGameDescription;
70 
71 class CruiseEngine: public Engine {
72 private:
73  bool _preLoad;
74  PCSound *_sound;
75  Common::StringArray _langStrings;
76  CursorType _savedCursor;
77  uint32 _lastTick;
78  int _gameSpeed;
79  bool _speedFlag;
80  PauseToken _gamePauseToken;
81 
82  Common::CodePage _ttsTextEncoding;
83 
84  void initialize();
85  void deinitialize();
86  bool loadLanguageStrings();
87  void mainLoop();
88  int processInput();
89 protected:
90  // Engine APIs
91  Common::Error run() override;
92 
93  void shutdown();
94 
95  bool initGame();
96 
97 public:
98  CruiseEngine(OSystem * syst, const CRUISEGameDescription *gameDesc);
99  ~ CruiseEngine() override;
100  bool hasFeature(EngineFeature f) const override;
101 
102  int getGameType() const;
103  const char *getGameId() const;
104  uint32 getFeatures() const;
105  Common::Language getLanguage() const;
106  Common::Platform getPlatform() const;
107  PCSound &sound() { return *_sound; }
108  virtual void pauseEngine(bool pause);
109  const char *langString(LangStringId langId) { return _langStrings[(int)langId].c_str(); }
110  void sayText(const Common::String &text, Common::TextToSpeechManager::Action action);
111  void sayQueuedText(Common::TextToSpeechManager::Action action);
112  void stopTextToSpeech();
113 
114  static const char *getSavegameFile(int saveGameIdx);
115  Common::Error loadGameState(int slot) override;
116  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
117  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
118  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
119  Common::String getSaveStateName(int slot) const override { return getSavegameFile(slot); }
120  void syncSoundSettings() override;
121 
122  const CRUISEGameDescription *_gameDescription;
123  void initAllData();
124 
126 
127  struct MemInfo {
128  int32 lineNum;
129  char fname[64];
130  uint32 magic;
131 
132  static uint32 const cookie = 0x41424344;
133  };
134 
135  Common::List<MemInfo *> _memList;
136 
138 
139  RectList _dirtyRects;
140  RectList _priorFrameRects;
141 
142  Common::File _currentVolumeFile;
143 
144  Common::Array<CtStruct> _polyStructNorm;
145  Common::Array<CtStruct> _polyStructExp;
146  Common::Array<CtStruct> *_polyStructs;
147  Common::Array<CtStruct> *_polyStruct;
148 
149  Common::File _PAL_file;
150 
151  Common::String _toSpeak;
152  Common::String _previousSaid;
153  bool _mouseButtonDown;
154  bool _menuJustOpened;
155 };
156 
157 extern CruiseEngine *_vm;
158 
159 #define BOOT_PRC_NAME "AUTO00.PRC"
160 
161 enum {
162  VAR_MOUSE_X_MODE = 253,
163  VAR_MOUSE_X_POS = 249,
164  VAR_MOUSE_Y_MODE = 251,
165  VAR_MOUSE_Y_POS = 250
166 };
167 
168 enum {
169  MOUSE_CURSOR_NORMAL = 0,
170  MOUSE_CURSOR_DISK,
171  MOUSE_CURSOR_CROSS
172 };
173 
174 enum {
175  kCruiseDebugScript = 1,
176  kCruiseDebugSound,
177 };
178 
179 enum {
180  kCmpEQ = (1 << 0),
181  kCmpGT = (1 << 1),
182  kCmpLT = (1 << 2)
183 };
184 
185 } // End of namespace Cruise
186 
187 #endif
Definition: engine.h:105
Definition: str.h:59
EngineFeature
Definition: engine.h:260
Definition: error.h:81
Common::Error run() override
Definition: random.h:44
Definition: list.h:44
Common::String getSaveStateName(int slot) const override
Definition: cruise.h:119
Definition: detection.h:27
Definition: cruise.h:127
Definition: cruise.h:71
bool hasFeature(EngineFeature f) const override
Common::Error loadGameState(int slot) override
Definition: actor.h:25
Definition: ustr.h:57
Definition: file.h:47
Definition: sound.h:34
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
PauseToken pauseEngine()
void syncSoundSettings() override
Definition: system.h:163
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
Definition: engine.h:146
Platform
Definition: platform.h:46
Language
Definition: language.h:45