ScummVM API documentation
tetraedge.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 TETRAEDGE_TETRAEDGE_H
23#define TETRAEDGE_TETRAEDGE_H
24
25#include "common/scummsys.h"
26#include "common/system.h"
27#include "common/error.h"
28#include "common/events.h"
29#include "common/file.h"
30#include "common/fs.h"
31#include "common/hash-str.h"
32#include "common/random.h"
33#include "common/serializer.h"
34#include "common/util.h"
35#include "common/formats/xmlparser.h"
36#include "engines/engine.h"
37#include "engines/savestate.h"
38#include "graphics/screen.h"
39#include "graphics/renderer.h"
40
41#include "tetraedge/detection.h"
42
43namespace Tetraedge {
44
45struct TetraedgeGameDescription;
46
47enum TETRAEDGEAction {
48 kActionNone,
49 kActionSkip,
50 kActionLoad,
51 kActionSave,
52};
53
54class Application;
55class Game;
56class TeCore;
57class TeSoundManager;
58class TeRenderer;
59class TeResourceManager;
60class TeInputMgr;
61
62class TetraedgeFSNode;
63
64class TetraedgeFSList : public Common::Array<TetraedgeFSNode> {};
66public:
67 TetraedgeFSNode() : _archive(nullptr) {}
68 explicit TetraedgeFSNode(Common::Archive *archive) : _archive(archive) {}
69 TetraedgeFSNode(Common::Archive *archive, const Common::Path &archivePath) : _archive(archive), _archivePath(archivePath) {}
70
71 Common::SeekableReadStream *createReadStream() const;
72 bool isReadable() const;
73 bool isDirectory() const;
74 Common::Path getPath() const;
75 Common::String toString() const;
76 int getDepth() const;
77 bool exists() const;
78 bool loadXML(Common::XMLParser &parser) const;
79 Common::String getName() const;
80 TetraedgeFSNode getChild(const Common::Path &path) const;
81 bool getChildren(TetraedgeFSList &fslist, Common::FSNode::ListMode mode = Common::FSNode::kListDirectoriesOnly, bool hidden = true) const;
82 bool operator<(const TetraedgeFSNode& node) const;
83 void maybeAddToSearchMan() const;
84private:
85 Common::Archive *_archive;
86 Common::Path _archivePath;
87};
88
89class TetraedgeEngine : public Engine {
90public:
91 enum TetraedgeGameType {
92 kNone,
93 kSyberia,
94 kSyberia2,
95 kAmerzone
96 };
97
98private:
99 const ADGameDescription *_gameDescription;
100 Common::RandomSource _randomSource;
101 TeCore *_core;
102 Application *_application;
103 Game *_game;
104 TeSoundManager *_soundManager;
105 TeRenderer *_renderer;
106 TeResourceManager *_resourceManager;
107 TeInputMgr *_inputMgr;
108 enum TetraedgeGameType _gameType;
110
111protected:
112 // Engine APIs
113 Common::Error run() override;
114
115public:
116 TetraedgeEngine(OSystem *syst, const ADGameDescription *gameDesc);
117 ~TetraedgeEngine() override;
118
119 const Common::Array<Common::Archive *>& getRootArchives() const { return _rootArchives; }
120
121 uint32 getFeatures() const;
122
123 void closeGameDialogs();
124
129
130 Common::Language getGameLanguage() const;
131
132 Common::Platform getGamePlatform() const;
133
134 bool isUtf8Release() const;
135
136 bool isGameDemo() const;
137
141 uint32 getRandomNumber(uint maxNum) {
142 return _randomSource.getRandomNumber(maxNum);
143 }
144
145 bool hasFeature(EngineFeature f) const override {
146 return
152 };
153
154 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
155 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
157
163
164 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
165
166 Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
167 Common::Serializer s(nullptr, stream);
168 return syncGame(s);
169 }
170
171 static void getSavegameThumbnail(Graphics::Surface &thumb);
172
173 Common::Error loadGameState(int slot) override;
175 int getDefaultScreenWidth() const;
176 int getDefaultScreenHeight() const;
177
178 Application *getApplication();
179 Game *getGame();
180 TeCore *getCore();
181 TeSoundManager *getSoundManager();
182 TeRenderer *getRenderer();
183 TeResourceManager *getResourceManager();
184 TeInputMgr *getInputMgr();
185 TetraedgeGameType gameType() const { return _gameType; }
186 bool gameIsAmerzone() const { return _gameType == kAmerzone; }
187
188 void openConfigDialog();
189 bool onActionEnd(const Common::CustomEventType &state);
190
191 static Common::StringArray splitString(const Common::String &text, char c);
192
193 /* Pick the renderer type to use.
194 Currently will only return kRendererTypeOpenGL or kRendererTypeTinyGL */
195 Graphics::RendererType preferredRendererType() const;
196
197private:
198 void configureSearchPaths();
199 void registerConfigDefaults();
200};
201
202extern TetraedgeEngine *g_engine;
203
204} // namespace Tetraedge
205
206#endif
Definition: archive.h:141
Definition: array.h:52
Definition: error.h:81
ListMode
Definition: fs.h:86
Definition: path.h:52
Definition: random.h:44
uint getRandomNumber(uint max)
Definition: stream.h:745
Definition: serializer.h:80
Definition: str.h:59
Definition: ustr.h:57
Definition: stream.h:77
Definition: xmlparser.h:98
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
@ kSupportsReturnToLauncher
Definition: engine.h:296
@ kSupportsQuitDialogOverride
Definition: engine.h:344
@ kSupportsSavingDuringRuntime
Definition: engine.h:314
@ kSupportsLoadingDuringRuntime
Definition: engine.h:305
@ kSupportsChangingOptionsDuringRuntime
Definition: engine.h:322
Definition: system.h:166
Definition: application.h:50
Definition: game.h:46
Definition: te_core.h:37
Definition: te_input_mgr.h:31
Definition: te_renderer.h:33
Definition: te_resource_manager.h:40
Definition: te_sound_manager.h:33
Definition: tetraedge.h:89
uint32 getRandomNumber(uint maxNum)
Definition: tetraedge.h:141
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
bool canSaveAutosaveCurrently() override
Common::Error run() override
bool hasFeature(EngineFeature f) const override
Definition: tetraedge.h:145
Common::String getGameId() const
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error syncGame(Common::Serializer &s)
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
Definition: tetraedge.h:166
Common::Error loadGameState(int slot) override
Definition: tetraedge.h:64
Definition: tetraedge.h:65
uint32 CustomEventType
Definition: events.h:212
Language
Definition: language.h:45
Platform
Definition: platform.h:93
Engine * g_engine
RendererType
Definition: renderer.h:45
Definition: advancedDetector.h:164
Definition: surface.h:67