2020-11-21 16:21:10 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 17:47:58 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2020-11-21 16:21:10 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 17:47:58 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2020-11-21 16:21:10 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AGS_AGS_H
|
|
|
|
#define AGS_AGS_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/system.h"
|
|
|
|
#include "common/error.h"
|
2021-07-21 04:17:28 +00:00
|
|
|
#include "common/fs.h"
|
2020-11-21 16:21:10 +00:00
|
|
|
#include "common/random.h"
|
|
|
|
#include "common/hash-str.h"
|
|
|
|
#include "common/util.h"
|
|
|
|
#include "engines/engine.h"
|
|
|
|
#include "engines/savestate.h"
|
|
|
|
#include "graphics/surface.h"
|
|
|
|
|
2021-05-22 11:45:21 +00:00
|
|
|
#include "ags/detection.h"
|
2020-11-25 06:23:07 +00:00
|
|
|
#include "ags/shared/gfx/bitmap.h"
|
|
|
|
#include "ags/lib/allegro/system.h"
|
|
|
|
|
2021-01-18 19:14:56 +00:00
|
|
|
namespace AGS3 {
|
|
|
|
class Globals;
|
|
|
|
}
|
|
|
|
|
2020-11-21 16:21:10 +00:00
|
|
|
namespace AGS {
|
|
|
|
|
2021-05-21 19:02:09 +00:00
|
|
|
/**
|
|
|
|
* @defgroup agsengine AGS Engine
|
|
|
|
* @brief Engine to run Adventure Game Studio games.
|
|
|
|
*/
|
|
|
|
|
2022-03-19 15:49:23 +00:00
|
|
|
/* Synced up to upstream: ---
|
|
|
|
* ----
|
2021-06-11 05:32:13 +00:00
|
|
|
*/
|
2020-11-21 16:21:10 +00:00
|
|
|
#define SCREEN_WIDTH 320
|
|
|
|
#define SCREEN_HEIGHT 200
|
|
|
|
|
|
|
|
struct AGSGameDescription;
|
2021-01-24 18:08:42 +00:00
|
|
|
struct PluginVersion;
|
2021-01-10 23:53:06 +00:00
|
|
|
class EventsManager;
|
2021-01-11 04:16:16 +00:00
|
|
|
class Music;
|
2020-11-21 16:21:10 +00:00
|
|
|
|
|
|
|
class AGSEngine : public Engine {
|
|
|
|
private:
|
|
|
|
const AGSGameDescription *_gameDescription;
|
|
|
|
Common::RandomSource _randomSource;
|
2020-11-25 06:23:07 +00:00
|
|
|
public:
|
2021-01-10 23:53:06 +00:00
|
|
|
EventsManager *_events;
|
2021-01-11 04:16:16 +00:00
|
|
|
Music *_music;
|
2020-11-25 06:23:07 +00:00
|
|
|
::AGS3::GFX_DRIVER *_gfxDriver;
|
2021-01-18 19:14:56 +00:00
|
|
|
::AGS3::Globals *_globals;
|
2021-04-07 23:42:04 +00:00
|
|
|
bool _forceTextAA;
|
2020-11-21 16:21:10 +00:00
|
|
|
protected:
|
|
|
|
// Engine APIs
|
2021-01-23 02:49:55 +00:00
|
|
|
Common::Error run() override;
|
2020-11-21 16:21:10 +00:00
|
|
|
public:
|
|
|
|
AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc);
|
2021-01-23 02:49:55 +00:00
|
|
|
~AGSEngine() override;
|
2020-11-21 16:21:10 +00:00
|
|
|
void GUIError(const Common::String &msg);
|
|
|
|
|
|
|
|
void set_window_title(const char *str) {
|
|
|
|
// No implementation
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 getFeatures() const;
|
|
|
|
|
2021-01-24 18:08:42 +00:00
|
|
|
const PluginVersion *getNeededPlugins() const;
|
|
|
|
|
2021-02-12 02:51:11 +00:00
|
|
|
/**
|
|
|
|
* Returns the game Id
|
|
|
|
*/
|
|
|
|
Common::String getGameId() const;
|
|
|
|
|
2020-11-21 16:21:10 +00:00
|
|
|
/**
|
|
|
|
* Returns the current list of savegames
|
|
|
|
*/
|
|
|
|
SaveStateList listSaves() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a random number
|
|
|
|
*/
|
|
|
|
uint32 getRandomNumber(uint maxNum) {
|
|
|
|
return _randomSource.getRandomNumber(maxNum);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the random number seed
|
|
|
|
*/
|
|
|
|
void setRandomNumberSeed(uint32 seed) {
|
|
|
|
_randomSource.setSeed(seed);
|
|
|
|
}
|
2021-01-10 18:30:47 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-21 01:24:32 +00:00
|
|
|
* Returns a pixel format for the given color depth.
|
2021-01-10 18:30:47 +00:00
|
|
|
*/
|
2021-06-21 01:24:32 +00:00
|
|
|
bool getPixelFormat(int depth, Graphics::PixelFormat &format) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up the graphics mode
|
|
|
|
*/
|
|
|
|
void setGraphicsMode(size_t w, size_t h, int depth);
|
2021-01-14 02:35:12 +00:00
|
|
|
|
2021-01-28 02:39:22 +00:00
|
|
|
bool hasFeature(EngineFeature f) const override {
|
|
|
|
return
|
2021-05-25 14:52:55 +00:00
|
|
|
(f == kSupportsLoadingDuringRuntime) ||
|
|
|
|
(f == kSupportsSavingDuringRuntime) ||
|
|
|
|
(f == kSupportsReturnToLauncher);
|
2021-01-28 02:39:22 +00:00
|
|
|
};
|
|
|
|
|
2021-07-06 03:11:20 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the selected game is an unsupported one
|
|
|
|
* earlier than version 2.5
|
|
|
|
*/
|
|
|
|
bool isUnsupportedPre25() const;
|
|
|
|
|
2021-07-04 22:03:21 +00:00
|
|
|
/*
|
|
|
|
* Returns true if the game has data files greater than 2Gb
|
|
|
|
*/
|
|
|
|
bool is64BitGame() const;
|
|
|
|
|
2021-07-21 04:17:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the game folder as a ScummVM filesystem node
|
|
|
|
*/
|
|
|
|
Common::FSNode getGameFolder();
|
|
|
|
|
2021-01-28 02:39:22 +00:00
|
|
|
/**
|
|
|
|
* Indicate whether a game state can be loaded.
|
|
|
|
*/
|
2023-12-04 20:19:26 +00:00
|
|
|
bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
|
2021-01-28 02:39:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicate whether a game state can be saved.
|
|
|
|
*/
|
2023-12-04 20:19:26 +00:00
|
|
|
bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
|
2021-01-28 02:39:22 +00:00
|
|
|
|
2021-01-14 02:35:12 +00:00
|
|
|
/**
|
|
|
|
* Load a savegame
|
|
|
|
*/
|
|
|
|
Common::Error loadGameState(int slot) override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save a savegame
|
|
|
|
*/
|
|
|
|
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
|
2021-09-10 13:02:27 +00:00
|
|
|
|
2023-12-09 00:27:45 +00:00
|
|
|
/**
|
|
|
|
* Returns autosave slot (-1 if unavailable)
|
|
|
|
*/
|
|
|
|
int getAutosaveSlot() const override;
|
|
|
|
|
2021-09-10 13:02:27 +00:00
|
|
|
/**
|
|
|
|
* Synchronize user volume settings
|
|
|
|
*/
|
|
|
|
void syncSoundSettings() override;
|
2020-11-21 16:21:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern AGSEngine *g_vm;
|
2020-11-25 06:23:07 +00:00
|
|
|
#define gfx_driver ::AGS::g_vm->_gfxDriver
|
2021-01-10 23:53:06 +00:00
|
|
|
#define SHOULD_QUIT ::AGS::g_vm->shouldQuit()
|
2020-11-21 16:21:10 +00:00
|
|
|
|
|
|
|
} // namespace AGS
|
|
|
|
|
|
|
|
#endif
|