ScummVM API documentation
titanic.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 TITANIC_TITANIC_H
23 #define TITANIC_TITANIC_H
24 
25 #include "common/random.h"
26 #include "engines/engine.h"
27 #include "titanic/support/exe_resources.h"
28 #include "titanic/support/movie_manager.h"
29 #include "titanic/support/string.h"
30 #include "titanic/support/strings.h"
31 #include "common/language.h"
32 
42 class OSystem;
43 
44 namespace Graphics {
45 class Screen;
46 }
47 
48 namespace Common {
49 class Error;
50 class FSNode;
51 }
52 
53 namespace Titanic {
54 
55 #define TITANIC_SAVEGAME_VERSION 1
56 
57 #define SCREEN_WIDTH 640
58 #define SCREEN_HEIGHT 480
59 
60 #define TOTAL_ITEMS 46
61 #define TOTAL_ROOMS 34
62 
63 #define MAX_SAVES 99
64 
65 // If enabled, fixes an original bug where dispensed chickens weren't
66 // meant to be hot unless the Yellow fuse was left in the Fusebox.
67 // This is being left disabled for now, since most walkthroughs for
68 // the game redundantly suggest removing the fuse, which is wrong
69 //#define FIX_DISPENSOR_TEMPATURE
70 
71 class CFilesManager;
72 class CMainGameWindow;
73 class CString;
74 class CTrueTalkManager;
75 class Events;
76 class OSScreenManager;
77 class CScriptHandler;
78 class TTscriptBase;
79 struct TitanicGameDescription;
80 
81 enum TITANICActions {
82  kActionNone,
83  kActionUp,
84  kActionDown,
85  kActionSelect,
86  kActionCheat,
87  kActionSave,
88  kActionLoad,
89  kActionQuit,
90  kActionShift,
91  kActionPETConversation,
92  kActionPETInventory,
93  kActionPETRemote,
94  kActionPETRooms,
95  kActionPETRealLife,
96  kActionPETTranslation,
97  kActionPETScrollPageUp,
98  kActionPETScrollPageDown,
99  kActionPETScrollTop,
100  kActionPeTScrollBottom,
101  kActionStarMapToggle,
102  kActionStarMapLeft,
103  kActionStarMapRight,
104  kActionStarMapUp,
105  kActionStarMapDown,
106  kActionStarMapForward,
107  kActionStarMapBackward,
108  kActionStarMapStop,
109  kActionStarMapLock,
110  kActionStarMapUnlock,
111  kActionStarMapConstellations,
112  kActionStarMapBoundaries,
113  kActionMovementNone,
114  kActionMovementForwards,
115  kActionMovementBackwards,
116  kActionMovementLeft,
117  kActionMovementRight,
118 
119 };
120 
121 class TitanicEngine : public Engine {
122 private:
126  bool initialize();
127 
131  void deinitialize();
132 
136  void setItemNames();
137 
141  void setRoomNames();
142 protected:
143  const TitanicGameDescription *_gameDescription;
144 
145  // Engine APIs
146  void initializePath(const Common::FSNode &gamePath) override;
147  Common::Error run() override;
148  bool hasFeature(EngineFeature f) const override;
149 public:
150  Events *_events;
151  CFilesManager *_filesManager;
152  CMovieManager _movieManager;
153  Graphics::Screen *_screen;
154  OSScreenManager *_screenManager;
155  CMainGameWindow *_window;
156  Common::RandomSource _randomSource;
157  CScriptHandler *_scriptHandler;
158  TTscriptBase *_script;
159  CTrueTalkManager *_trueTalkManager;
160  CExeResources _exeResources;
161  StringArray _itemNames;
162  StringArray _itemDescriptions;
163  StringArray _itemIds;
164  StringArray _roomNames;
165  Strings _strings;
166  CString _stateRoomExitView;
167  int _loadSaveSlot;
168 public:
169  TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc);
170  ~TitanicEngine() override;
171 
172 
176  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
177 
181  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
182 
186  Common::Error loadGameState(int slot) override;
187 
191  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
192 
196  void syncSoundSettings() override;
197 
201  uint32 getFeatures() const;
202 
206  Common::Language getLanguage() const;
207 
211  bool isGerman() const { return getLanguage() == Common::DE_DEU; }
212 
216  uint getRandomNumber(uint max) { return _randomSource.getRandomNumber(max); }
217 
221  double getRandomFloat() { return getRandomNumber(0xfffffffe) * 0.00001525855623540901; } // fffffffe=4294967294 and 0.00001525855623540901 ~= 1/65537.0
222 
227  CString getSavegameName(int slot);
228 };
229 
230 extern TitanicEngine *g_vm;
231 
232 } // End of namespace Titanic
233 
234 #endif /* TITANIC_TITANIC_H */
Definition: files_manager.h:39
Definition: true_talk_manager.h:44
Definition: str.h:59
EngineFeature
Definition: engine.h:260
Definition: error.h:81
Definition: exe_resources.h:33
Definition: random.h:44
Definition: events.h:88
uint getRandomNumber(uint max)
Definition: movie_manager.h:44
Definition: atari-screen.h:58
Definition: screen.h:48
bool isGerman() const
Definition: titanic.h:211
Definition: titanic.h:121
double getRandomFloat()
Definition: titanic.h:221
Definition: ustr.h:57
Definition: algorithm.h:29
Definition: fs.h:69
Definition: formatinfo.h:28
Definition: arm.h:30
Definition: string.h:40
Definition: detection.h:27
Definition: screen_manager.h:238
Definition: strings.h:237
Definition: main_game_window.h:42
Definition: system.h:163
Definition: script_handler.h:36
uint getRandomNumber(uint max)
Definition: titanic.h:216
Definition: engine.h:146
Definition: tt_script_base.h:38
Language
Definition: language.h:45