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
40namespace AGS3 {
41class Globals;
42}
43
44namespace AGS {
45
51/* Synced up to upstream: ---
52 * ----
53 */
54#define SCREEN_WIDTH 320
55#define SCREEN_HEIGHT 200
56
57struct AGSGameDescription;
58struct PluginVersion;
59class EventsManager;
60class Music;
61
63 const char *_plugin;
64 int _version;
65};
66
67enum AGSSteamVersion { kAGSteam = 0, kWadjetEye = 1 };
68enum AGSSpriteFontVersion { kAGSSpriteFont = 0, kClifftopGames = 1 };
69
70class AGSEngine : public Engine {
71private:
72 const AGSGameDescription *_gameDescription;
73 Common::RandomSource _randomSource;
74public:
75 EventsManager *_events;
76 Music *_music;
77 ::AGS3::GFX_DRIVER *_gfxDriver;
78 ::AGS3::Globals *_globals;
79 bool _forceTextAA;
80protected:
81 // Engine APIs
82 Common::Error run() override;
83public:
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
100
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
135 };
136
141 bool isUnsupportedPre25() const;
142
146 bool isUnsupportedAGS4() const;
147
148 /*
149 * Returns true if the game has data files greater than 2Gb
150 */
151 bool is64BitGame() const;
152
157
161 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
162
166 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
167
171 Common::Error loadGameState(int slot) override;
172
176 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
177
181 int getAutosaveSlot() const override;
182
186 void syncSoundSettings() override;
187};
188
189extern AGSEngine *g_vm;
190#define gfx_driver ::AGS::g_vm->_gfxDriver
191#define SHOULD_QUIT ::AGS::g_vm->shouldQuit()
192
193} // namespace AGS
194
195#endif
Definition: globals.h:189
Definition: ags.h:70
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
int getAutosaveSlot() const override
bool getPixelFormat(int depth, Graphics::PixelFormat &format) const
Common::Error loadGameState(int slot) override
void setGraphicsMode(size_t w, size_t h, int depth)
bool hasFeature(EngineFeature f) const override
Definition: ags.h:130
bool isUnsupportedAGS4() const
bool isUnsupportedPre25() const
uint32 getRandomNumber(uint maxNum)
Definition: ags.h:109
Common::FSNode getGameFolder()
Common::String getGameId() const
void syncSoundSettings() override
void setRandomNumberSeed(uint32 seed)
Definition: ags.h:116
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error run() override
SaveStateList listSaves() const
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
Definition: events.h:32
Definition: music.h:32
Definition: error.h:81
Definition: fs.h:69
Definition: random.h:44
void setSeed(uint32 seed)
uint getRandomNumber(uint max)
Definition: str.h:59
Definition: ustr.h:57
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
@ kSupportsReturnToLauncher
Definition: engine.h:296
@ kSupportsSavingDuringRuntime
Definition: engine.h:314
@ kSupportsLoadingDuringRuntime
Definition: engine.h:305
Definition: system.h:166
Definition: system.h:96
Definition: detection.h:47
Definition: ags.h:62
Definition: pixelformat.h:138