ScummVM API documentation
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
34namespace Got {
35
36struct GotGameDescription;
37
38class GotEngine : public Engine, public Events {
39private:
40 const ADGameDescription *_gameDescription;
41 Common::RandomSource _randomSource;
42
43 void savegameLoaded();
44
45protected:
46 // Engine APIs
47 Common::Error run() override;
48
52 bool shouldQuit() const override {
53 return Engine::shouldQuit();
54 }
55
56public:
57 Vars _vars;
58
59public:
60 GotEngine(OSystem *syst, const ADGameDescription *gameDesc);
61 ~GotEngine() override;
62
63 uint32 getFeatures() const;
64 bool isDemo() const override;
65
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
102extern GotEngine *g_engine;
103#define SHOULD_QUIT ::Got::g_engine->shouldQuit()
104
105} // End of namespace Got
106
107#endif // GOT_H
Definition: error.h:81
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: engine.h:149
static bool shouldQuit()
EngineFeature
Definition: engine.h:282
@ kSupportsReturnToLauncher
Definition: engine.h:296
@ kSupportsSavingDuringRuntime
Definition: engine.h:314
@ kSupportsLoadingDuringRuntime
Definition: engine.h:305
Definition: events.h:274
Definition: got.h:38
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
uint32 getRandomNumber(uint maxNum)
Definition: got.h:74
Common::Error syncGame(Common::Serializer &s)
Common::Error run() override
Common::String getGameId() const
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
bool hasFeature(EngineFeature f) const override
Definition: got.h:78
void syncSoundSettings() override
void pauseEngineIntern(bool pause) override
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
bool shouldQuit() const override
Definition: got.h:52
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: vars.h:88
Definition: system.h:166
Engine * g_engine
Definition: advancedDetector.h:164