ScummVM API documentation
mtropolis.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 MTROPOLIS_MTROPOLIS_H
23 #define MTROPOLIS_MTROPOLIS_H
24 
25 #include "engines/engine.h"
26 
27 #include "common/random.h"
28 
29 #include "mtropolis/detection.h"
30 #include "mtropolis/saveload.h"
31 
45 namespace MTropolis {
46 
47 class Runtime;
48 class RuntimeObject;
49 
51 protected:
52  // Engine APIs
53  Common::Error run() override;
54 
55 public:
56  MTropolisEngine(OSystem *syst, const MTropolisGameDescription *gameDesc);
57  ~MTropolisEngine() override;
58 
59  bool hasFeature(EngineFeature f) const override;
60  //void syncSoundSettings() override;
61 
62  const MTropolisGameDescription *_gameDescription;
63  uint32 getGameID() const;
64  Common::Platform getPlatform() const;
65 
66  bool promptSave(ISaveWriter *writer, const Graphics::Surface *screenshotOverride) override;
67  bool namedSave(ISaveWriter *writer, const Graphics::Surface *screenshotOverride, const Common::String &fileName) override;
68  bool autoSave(ISaveWriter *writer) override;
69  bool promptLoad(ISaveReader *reader) override;
70  bool namedLoad(ISaveReader *reader, const Common::String &fileName) override;
71 
72  const Graphics::Surface *getSavegameScreenshot() const;
73 
74  Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave) override;
75  bool canSaveAutosaveCurrently() override;
76  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
77 
78 public:
79  void handleEvents();
80 
81 protected:
82  void pauseEngineIntern(bool pause) override;
83 
84 private:
85  bool save(ISaveWriter *writer, const Graphics::Surface *screenshotOverride, const Common::String &fileName, const Common::String &desc);
86  bool load(ISaveReader *reader, const Common::String &fileName);
87 
88  Common::String getUnpromptedSaveFileName(const Common::String &fileName);
89 
90  static const uint kCurrentSaveFileVersion = 2;
91  static const uint kEarliestSupportedSaveFileVersion = 2;
92  static const uint kSavegameSignature = 0x6d545356; // mTSV
93 
94  ISaveWriter *_saveWriter;
95  bool _isTriggeredAutosave;
96 
98 };
99 
100 } // End of namespace MTropolis
101 
102 #endif /* MTROPOLIS_MTROPOLIS_H */
Definition: str.h:59
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave) override
Definition: surface.h:67
EngineFeature
Definition: engine.h:253
Definition: stream.h:77
Definition: error.h:84
Common::Error run() override
Definition: saveload.h:46
Definition: ptr.h:572
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
void pauseEngineIntern(bool pause) override
Definition: ustr.h:57
Definition: saveload.h:50
Definition: saveload.h:59
Definition: detection.h:202
Definition: actions.h:25
Definition: saveload.h:64
bool hasFeature(EngineFeature f) const override
Definition: mtropolis.h:50
Definition: saveload.h:54
Definition: system.h:161
Definition: engine.h:144
Platform
Definition: platform.h:46
bool canSaveAutosaveCurrently() override