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/fs.h"
30 #include "common/hash-str.h"
31 #include "common/random.h"
32 #include "common/serializer.h"
33 #include "common/util.h"
34 #include "engines/engine.h"
35 #include "engines/savestate.h"
36 #include "graphics/screen.h"
37 #include "graphics/renderer.h"
38 
39 #include "tetraedge/detection.h"
40 
41 namespace Tetraedge {
42 
43 struct TetraedgeGameDescription;
44 
45 class Application;
46 class Game;
47 class TeCore;
48 class TeSoundManager;
49 class TeRenderer;
50 class TeResourceManager;
51 class TeInputMgr;
52 
53 class TetraedgeEngine : public Engine {
54 public:
55  enum TetraedgeGameType {
56  kNone,
57  kSyberia,
58  kSyberia2,
59  kAmerzone
60  };
61 
62 private:
63  const ADGameDescription *_gameDescription;
64  Common::RandomSource _randomSource;
65  TeCore *_core;
66  Application *_application;
67  Game *_game;
68  TeSoundManager *_soundManager;
69  TeRenderer *_renderer;
70  TeResourceManager *_resourceManager;
71  TeInputMgr *_inputMgr;
72  enum TetraedgeGameType _gameType;
73 
74 protected:
75  // Engine APIs
76  Common::Error run() override;
77 
78 public:
79  TetraedgeEngine(OSystem *syst, const ADGameDescription *gameDesc);
80  ~TetraedgeEngine() override;
81 
82  uint32 getFeatures() const;
83 
84  void closeGameDialogs();
85 
89  Common::String getGameId() const;
90 
91  Common::Language getGameLanguage() const;
92 
93  Common::Platform getGamePlatform() const;
94 
95  bool isGameDemo() const;
96 
100  uint32 getRandomNumber(uint maxNum) {
101  return _randomSource.getRandomNumber(maxNum);
102  }
103 
104  bool hasFeature(EngineFeature f) const override {
105  return
108  (f == kSupportsReturnToLauncher) ||
111  };
112 
113  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
114  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
115  bool canSaveAutosaveCurrently() override;
116 
122 
123  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
124 
125  Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
126  Common::Serializer s(nullptr, stream);
127  return syncGame(s);
128  }
129 
130  static void getSavegameThumbnail(Graphics::Surface &thumb);
131 
132  Common::Error loadGameState(int slot) override;
134  int getDefaultScreenWidth() const;
135  int getDefaultScreenHeight() const;
136 
137  Application *getApplication();
138  Game *getGame();
139  TeCore *getCore();
140  TeSoundManager *getSoundManager();
141  TeRenderer *getRenderer();
142  TeResourceManager *getResourceManager();
143  TeInputMgr *getInputMgr();
144  TetraedgeGameType gameType() const { return _gameType; }
145  bool gameIsAmerzone() const { return _gameType == kAmerzone; }
146 
147  void openConfigDialog();
148  bool onKeyUp(const Common::KeyState &state);
149 
150  static Common::StringArray splitString(const Common::String &text, char c);
151 
152  /* Pick the renderer type to use.
153  Currently will only return kRendererTypeOpenGL or kRendererTypeTinyGL */
154  Graphics::RendererType preferredRendererType() const;
155 
156 private:
157  void configureSearchPaths();
158  void registerConfigDefaults();
159 };
160 
161 extern TetraedgeEngine *g_engine;
162 
163 } // namespace Tetraedge
164 
165 #endif
Definition: game.h:46
Definition: str.h:59
Definition: detection.h:27
Definition: surface.h:67
RendererType
Definition: renderer.h:45
EngineFeature
Definition: engine.h:253
Definition: stream.h:77
Definition: error.h:84
Common::Error run() override
Definition: tetraedge.h:53
Definition: advancedDetector.h:163
Definition: random.h:44
bool hasFeature(EngineFeature f) const override
Definition: tetraedge.h:104
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
uint getRandomNumber(uint max)
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override
Definition: stream.h:745
Definition: te_resource_manager.h:40
Engine * g_engine
Definition: serializer.h:79
Definition: engine.h:267
Common::Error syncGame(Common::Serializer &s)
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
Definition: tetraedge.h:125
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: te_renderer.h:33
Definition: ustr.h:57
Definition: application.h:50
bool canSaveAutosaveCurrently() override
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
Common::String getGameId() const
Definition: keyboard.h:294
Definition: engine.h:315
uint32 getRandomNumber(uint maxNum)
Definition: tetraedge.h:100
Definition: system.h:161
Definition: te_sound_manager.h:33
Definition: engine.h:285
Definition: te_input_mgr.h:31
Definition: engine.h:144
Platform
Definition: platform.h:46
Common::Error loadGameState(int slot) override
Definition: te_core.h:37
Language
Definition: language.h:45