ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
got.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 GOT_H
23 #define GOT_H
24 
25 #include "common/error.h"
26 #include "common/random.h"
27 #include "common/scummsys.h"
28 #include "common/serializer.h"
29 #include "common/system.h"
30 #include "engines/engine.h"
31 #include "got/events.h"
32 #include "got/vars.h"
33 
34 namespace Got {
35 
36 struct GotGameDescription;
37 
38 class GotEngine : public Engine, public Events {
39 private:
40  const ADGameDescription *_gameDescription;
41  Common::RandomSource _randomSource;
42 
43  void savegameLoaded();
44 
45 protected:
46  // Engine APIs
47  Common::Error run() override;
48 
52  bool shouldQuit() const override {
53  return Engine::shouldQuit();
54  }
55 
56 public:
57  Vars _vars;
58 
59 public:
60  GotEngine(OSystem *syst, const ADGameDescription *gameDesc);
61  ~GotEngine() override;
62 
63  uint32 getFeatures() const;
64  bool isDemo() const override;
65 
69  Common::String getGameId() const;
70 
74  uint32 getRandomNumber(uint maxNum) {
75  return _randomSource.getRandomNumber(maxNum);
76  }
77 
78  bool hasFeature(EngineFeature f) const override {
79  return (f == kSupportsLoadingDuringRuntime) ||
82  };
83 
84  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
85  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
86 
92 
93  Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
95 
96  void syncSoundSettings() override;
97  void pauseEngineIntern(bool pause) override;
98 
99  Common::String getHighScoresSaveName() const;
100 };
101 
102 extern GotEngine *g_engine;
103 #define SHOULD_QUIT ::Got::g_engine->shouldQuit()
104 
105 } // End of namespace Got
106 
107 #endif // GOT_H
void pauseEngineIntern(bool pause) override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: str.h:59
EngineFeature
Definition: engine.h:253
Definition: stream.h:77
Definition: error.h:84
Common::String getGameId() const
Definition: advancedDetector.h:163
Definition: random.h:44
uint getRandomNumber(uint max)
Definition: stream.h:745
Definition: got.h:38
Definition: events.h:264
Engine * g_engine
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
Definition: serializer.h:79
Definition: engine.h:267
Definition: ustr.h:57
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
static bool shouldQuit()
uint32 getRandomNumber(uint maxNum)
Definition: got.h:74
bool shouldQuit() const override
Definition: got.h:52
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
Definition: vars.h:88
bool hasFeature(EngineFeature f) const override
Definition: got.h:78
Common::Error syncGame(Common::Serializer &s)
Definition: console.h:28
Common::Error run() override
Definition: system.h:161
Definition: engine.h:285
Definition: engine.h:144
void syncSoundSettings() override