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