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 class TitanicEngine : public Engine {
82 private:
86  bool initialize();
87 
91  void deinitialize();
92 
96  void setItemNames();
97 
101  void setRoomNames();
102 protected:
103  const TitanicGameDescription *_gameDescription;
104 
105  // Engine APIs
106  void initializePath(const Common::FSNode &gamePath) override;
107  Common::Error run() override;
108  bool hasFeature(EngineFeature f) const override;
109 public:
110  Events *_events;
111  CFilesManager *_filesManager;
112  CMovieManager _movieManager;
113  Graphics::Screen *_screen;
114  OSScreenManager *_screenManager;
115  CMainGameWindow *_window;
116  Common::RandomSource _randomSource;
117  CScriptHandler *_scriptHandler;
118  TTscriptBase *_script;
119  CTrueTalkManager *_trueTalkManager;
120  CExeResources _exeResources;
121  StringArray _itemNames;
122  StringArray _itemDescriptions;
123  StringArray _itemIds;
124  StringArray _roomNames;
125  Strings _strings;
126  CString _stateRoomExitView;
127  int _loadSaveSlot;
128 public:
129  TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc);
130  ~TitanicEngine() override;
131 
132 
136  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
137 
141  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
142 
146  Common::Error loadGameState(int slot) override;
147 
151  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
152 
156  void syncSoundSettings() override;
157 
161  uint32 getFeatures() const;
162 
166  Common::Language getLanguage() const;
167 
171  bool isGerman() const { return getLanguage() == Common::DE_DEU; }
172 
176  uint getRandomNumber(uint max) { return _randomSource.getRandomNumber(max); }
177 
181  double getRandomFloat() { return getRandomNumber(0xfffffffe) * 0.00001525855623540901; } // fffffffe=4294967294 and 0.00001525855623540901 ~= 1/65537.0
182 
187  CString getSavegameName(int slot);
188 };
189 
190 extern TitanicEngine *g_vm;
191 
192 } // End of namespace Titanic
193 
194 #endif /* TITANIC_TITANIC_H */
Definition: files_manager.h:39
Definition: true_talk_manager.h:44
Definition: str.h:59
EngineFeature
Definition: engine.h:253
Definition: error.h:84
Definition: exe_resources.h:33
Definition: random.h:44
Definition: events.h:87
uint getRandomNumber(uint max)
Definition: movie_manager.h:44
Definition: atari-screen.h:60
Definition: screen.h:48
bool isGerman() const
Definition: titanic.h:171
Definition: titanic.h:81
double getRandomFloat()
Definition: titanic.h:181
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:161
Definition: script_handler.h:36
uint getRandomNumber(uint max)
Definition: titanic.h:176
Definition: engine.h:144
Definition: tt_script_base.h:38
Language
Definition: language.h:45