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 struct PluginVersion {
63  const char *_plugin;
64  int _version;
65 };
66 
67 enum AGSSteamVersion { kAGSteam = 0, kWadjetEye = 1 };
68 enum AGSSpriteFontVersion { kAGSSpriteFont = 0, kClifftopGames = 1 };
69 
70 class AGSEngine : public Engine {
71 private:
72  const AGSGameDescription *_gameDescription;
73  Common::RandomSource _randomSource;
74 public:
75  EventsManager *_events;
76  Music *_music;
77  ::AGS3::GFX_DRIVER *_gfxDriver;
78  ::AGS3::Globals *_globals;
79  bool _forceTextAA;
80 protected:
81  // Engine APIs
82  Common::Error run() override;
83 public:
84  AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc);
85  ~AGSEngine() override;
86  void GUIError(const Common::String &msg);
87 
88  void set_window_title(const char *str) {
89  // No implementation
90  }
91 
92  uint32 getFeatures() const;
93 
94  const PluginVersion *getNeededPlugins() const;
95 
99  Common::String getGameId() const;
100 
104  SaveStateList listSaves() const;
105 
109  uint32 getRandomNumber(uint maxNum) {
110  return _randomSource.getRandomNumber(maxNum);
111  }
112 
116  void setRandomNumberSeed(uint32 seed) {
117  _randomSource.setSeed(seed);
118  }
119 
123  bool getPixelFormat(int depth, Graphics::PixelFormat &format) const;
124 
128  void setGraphicsMode(size_t w, size_t h, int depth);
129 
130  bool hasFeature(EngineFeature f) const override {
131  return
132  (f == kSupportsLoadingDuringRuntime) ||
133  (f == kSupportsSavingDuringRuntime) ||
134  (f == kSupportsReturnToLauncher);
135  };
136 
141  bool isUnsupportedPre25() const;
142 
143  /*
144  * Returns true if the game has data files greater than 2Gb
145  */
146  bool is64BitGame() const;
147 
151  Common::FSNode getGameFolder();
152 
156  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
157 
161  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
162 
166  Common::Error loadGameState(int slot) override;
167 
171  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
172 
176  int getAutosaveSlot() const override;
177 
181  void syncSoundSettings() override;
182 };
183 
184 extern AGSEngine *g_vm;
185 #define gfx_driver ::AGS::g_vm->_gfxDriver
186 #define SHOULD_QUIT ::AGS::g_vm->shouldQuit()
187 
188 } // namespace AGS
189 
190 #endif
Definition: achievements_tables.h:27
Definition: globals.h:189
Definition: str.h:59
EngineFeature
Definition: engine.h:253
Definition: detection.h:47
Definition: error.h:84
Definition: pixelformat.h:138
Definition: random.h:44
Definition: ags.h:70
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:130
void setRandomNumberSeed(uint32 seed)
Definition: ags.h:116
Definition: music.h:32
void setSeed(uint32 seed)
uint32 getRandomNumber(uint maxNum)
Definition: ags.h:109
Definition: system.h:161
Definition: ags.h:62
Definition: engine.h:144
Definition: ags.h:40