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