ScummVM API documentation
ultima.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 ULTIMA_SHARED_ENGINE_ULTIMA_H
23 #define ULTIMA_SHARED_ENGINE_ULTIMA_H
24 
25 #include "ultima/detection.h"
26 #include "common/archive.h"
27 #include "common/random.h"
28 #include "engines/engine.h"
29 
30 namespace Ultima {
31 namespace Shared {
32 
33 class UltimaEngine : public Engine {
34 private:
35  Common::RandomSource _randomSource;
36 protected:
37  const UltimaGameDescription *_gameDescription;
38  Common::Archive *_dataArchive;
39 protected:
43  virtual bool initialize();
44 
48  virtual void deinitialize() {}
49 
53  virtual bool isDataRequired(Common::Path &folder, int &majorVersion, int &minorVersion) {
54  return false;
55  }
56 
57 public:
58  UltimaEngine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
59  ~UltimaEngine() override;
60 
64  bool hasFeature(EngineFeature f) const override;
65 
69  uint32 getFeatures() const;
70 
75 
79  GameId getGameId() const;
80 
85  bool isEnhanced() const {
86  return getFeatures() & GF_VGA_ENHANCED;
87  }
88 
92  void GUIError(const Common::U32String &msg);
93 
97  uint getRandomNumber(uint maxVal) { return _randomSource.getRandomNumber(maxVal); }
98 
102  uint getRandomNumber(uint min, uint max) {
103  return min + _randomSource.getRandomNumber(max - min);
104  }
105 
110 
115  virtual bool canLoadGameStateCurrently(bool isAutosave) = 0;
116 
120  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
121  return canLoadGameStateCurrently(false);
122  }
123 
128  virtual bool canSaveGameStateCurrently(bool isAutosave) = 0;
129 
133  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
134  return canSaveGameStateCurrently(false);
135  }
136 };
137 
138 extern UltimaEngine *g_ultima;
139 
140 } // End of namespace Shared
141 } // End of namespace Ultima
142 
143 #endif
EngineFeature
Definition: engine.h:250
uint getRandomNumber(uint maxVal)
Definition: ultima.h:97
virtual void deinitialize()
Definition: ultima.h:48
Definition: random.h:44
Common::FSNode getGameDirectory() const
Definition: path.h:52
uint getRandomNumber(uint max)
Definition: detection.h:65
Definition: ultima.h:33
Common::Language getLanguage() const
Definition: archive.h:141
virtual bool canLoadGameStateCurrently(bool isAutosave)=0
virtual bool isDataRequired(Common::Path &folder, int &majorVersion, int &minorVersion)
Definition: ultima.h:53
virtual bool canSaveGameStateCurrently(bool isAutosave)=0
Definition: detection.h:27
Definition: ustr.h:57
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: ultima.h:133
Definition: fs.h:69
void GUIError(const Common::U32String &msg)
uint getRandomNumber(uint min, uint max)
Definition: ultima.h:102
bool hasFeature(EngineFeature f) const override
Definition: system.h:175
Definition: engine.h:143
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: ultima.h:120
bool isEnhanced() const
Definition: ultima.h:85
Language
Definition: language.h:45