ScummVM API documentation
ags.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 AGS_AGS_H
23 #define AGS_AGS_H
24 
25 #include "common/scummsys.h"
26 #include "common/system.h"
27 #include "common/error.h"
28 #include "common/fs.h"
29 #include "common/random.h"
30 #include "common/hash-str.h"
31 #include "common/util.h"
32 #include "engines/engine.h"
33 #include "engines/savestate.h"
34 #include "graphics/surface.h"
35 
36 #include "ags/detection.h"
37 #include "ags/shared/gfx/bitmap.h"
38 #include "ags/lib/allegro/system.h"
39 
40 namespace AGS3 {
41 class Globals;
42 }
43 
44 namespace AGS {
45 
51 /* Synced up to upstream: ---
52  * ----
53  */
54 #define SCREEN_WIDTH 320
55 #define SCREEN_HEIGHT 200
56 
57 struct AGSGameDescription;
58 struct PluginVersion;
59 class EventsManager;
60 class Music;
61 
62 class AGSEngine : public Engine {
63 private:
64  const AGSGameDescription *_gameDescription;
65  Common::RandomSource _randomSource;
66 public:
67  EventsManager *_events;
68  Music *_music;
69  ::AGS3::GFX_DRIVER *_gfxDriver;
70  ::AGS3::Globals *_globals;
71  bool _forceTextAA;
72 protected:
73  // Engine APIs
74  Common::Error run() override;
75 public:
76  AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc);
77  ~AGSEngine() override;
78  void GUIError(const Common::String &msg);
79 
80  void set_window_title(const char *str) {
81  // No implementation
82  }
83 
84  uint32 getFeatures() const;
85 
86  const PluginVersion *getNeededPlugins() const;
87 
91  Common::String getGameId() const;
92 
96  SaveStateList listSaves() const;
97 
101  uint32 getRandomNumber(uint maxNum) {
102  return _randomSource.getRandomNumber(maxNum);
103  }
104 
108  void setRandomNumberSeed(uint32 seed) {
109  _randomSource.setSeed(seed);
110  }
111 
115  bool getPixelFormat(int depth, Graphics::PixelFormat &format) const;
116 
120  void setGraphicsMode(size_t w, size_t h, int depth);
121 
122  bool hasFeature(EngineFeature f) const override {
123  return
124  (f == kSupportsLoadingDuringRuntime) ||
125  (f == kSupportsSavingDuringRuntime) ||
126  (f == kSupportsReturnToLauncher);
127  };
128 
133  bool isUnsupportedPre25() const;
134 
135  /*
136  * Returns true if the game has data files greater than 2Gb
137  */
138  bool is64BitGame() const;
139 
143  Common::FSNode getGameFolder();
144 
148  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
149 
153  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
154 
158  Common::Error loadGameState(int slot) override;
159 
163  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
164 
168  int getAutosaveSlot() const override;
169 
173  void syncSoundSettings() override;
174 };
175 
176 extern AGSEngine *g_vm;
177 #define gfx_driver ::AGS::g_vm->_gfxDriver
178 #define SHOULD_QUIT ::AGS::g_vm->shouldQuit()
179 
180 } // namespace AGS
181 
182 #endif
Definition: achievements_tables.h:27
Definition: globals.h:185
Definition: str.h:59
EngineFeature
Definition: engine.h:250
Definition: detection.h:47
Definition: error.h:84
Definition: pixelformat.h:138
Definition: random.h:44
Definition: ags.h:62
uint getRandomNumber(uint max)
Definition: events.h:32
Definition: system.h:96
Definition: ustr.h:57
Definition: fs.h:69
bool hasFeature(EngineFeature f) const override
Definition: ags.h:122
void setRandomNumberSeed(uint32 seed)
Definition: ags.h:108
Definition: music.h:32
void setSeed(uint32 seed)
uint32 getRandomNumber(uint maxNum)
Definition: ags.h:101
Definition: system.h:175
Definition: detection.h:42
Definition: engine.h:143
Definition: ags.h:40