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
42class OSystem;
43
44namespace Graphics {
45class Screen;
46}
47
48namespace Common {
49class Error;
50class FSNode;
51}
52
53namespace 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
71class CFilesManager;
72class CMainGameWindow;
73class CString;
74class CTrueTalkManager;
75class Events;
76class OSScreenManager;
77class CScriptHandler;
78class TTscriptBase;
79struct TitanicGameDescription;
80
81enum 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
121class TitanicEngine : public Engine {
122private:
126 bool initialize();
127
131 void deinitialize();
132
136 void setItemNames();
137
141 void setRoomNames();
142protected:
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;
149public:
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;
168public:
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
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
228};
229
230extern TitanicEngine *g_vm;
231
232} // End of namespace Titanic
233
234#endif /* TITANIC_TITANIC_H */
Definition: error.h:81
Definition: fs.h:69
Definition: random.h:44
uint getRandomNumber(uint max)
Definition: str.h:59
Definition: ustr.h:57
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
Definition: screen.h:47
Definition: system.h:166
Definition: exe_resources.h:33
Definition: files_manager.h:39
Definition: main_game_window.h:42
Definition: movie_manager.h:44
Definition: script_handler.h:36
Definition: string.h:40
Definition: true_talk_manager.h:44
Definition: events.h:88
Definition: screen_manager.h:238
Definition: strings.h:237
Definition: tt_script_base.h:38
Definition: titanic.h:121
uint32 getFeatures() const
bool hasFeature(EngineFeature f) const override
bool isGerman() const
Definition: titanic.h:211
Common::Error run() override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error loadGameState(int slot) override
Common::Language getLanguage() const
CString getSavegameName(int slot)
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
void initializePath(const Common::FSNode &gamePath) override
double getRandomFloat()
Definition: titanic.h:221
uint getRandomNumber(uint max)
Definition: titanic.h:216
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
void syncSoundSettings() override
Language
Definition: language.h:45
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: atari-screen.h:58
Definition: detection.h:27