Added new type Engine::Feature; pushed down some #include dependencies
svn-id: r34755
This commit is contained in:
parent
6ca906d7aa
commit
6a2f3dc0b9
22 changed files with 76 additions and 36 deletions
|
@ -25,6 +25,7 @@
|
|||
|
||||
|
||||
#include "common/md5.h"
|
||||
#include "common/events.h"
|
||||
#include "common/file.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/config-manager.h"
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include "agi/preagi_common.h"
|
||||
|
||||
#include "common/events.h"
|
||||
|
||||
namespace Agi {
|
||||
|
||||
// Screen functions
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "common/events.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "agi/preagi_troll.h"
|
||||
#include "agi/graphics.h"
|
||||
|
||||
#include "common/events.h"
|
||||
|
||||
#include "graphics/cursorman.h"
|
||||
|
||||
namespace Agi {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "graphics/cursorman.h"
|
||||
|
||||
#include "common/events.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
|
||||
#include "common/endian.h"
|
||||
#include "common/events.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "graphics/cursorman.h"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "common/advancedDetector.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "agos/agos.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "common/events.h"
|
||||
#include "common/file.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/config-manager.h"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "base/plugins.h"
|
||||
|
||||
#include "common/advancedDetector.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "cine/cine.h"
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/events.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "cine/main_loop.h"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
|
||||
#include "common/endian.h"
|
||||
#include "common/events.h"
|
||||
#include "common/savefile.h"
|
||||
|
||||
#include "cine/cine.h"
|
||||
|
|
|
@ -103,7 +103,7 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
|
|||
new GUI::ButtonWidget(this, "globalmain_about", "About", kAboutCmd, 'A');
|
||||
|
||||
_rtlButton = new GUI::ButtonWidget(this, "globalmain_rtl", "Return to Launcher", kRTLCmd, 'R');
|
||||
_rtlButton->setEnabled(_engine->hasFeature(MetaEngine::kSupportsRTL));
|
||||
_rtlButton->setEnabled(_engine->hasFeature(Engine::kSupportsRTL));
|
||||
|
||||
|
||||
new GUI::ButtonWidget(this, "globalmain_quit", "Quit", kQuitCmd, 'Q');
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "engines/engine.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/events.h"
|
||||
#include "common/file.h"
|
||||
#include "common/timer.h"
|
||||
#include "common/savefile.h"
|
||||
|
@ -250,13 +251,20 @@ void Engine::quitGame() {
|
|||
_eventMan->pushEvent(event);
|
||||
}
|
||||
|
||||
bool Engine::hasFeature(MetaEngine::MetaEngineFeature f) {
|
||||
// TODO: In each engine, keep a ref to the corresponding MetaEngine?
|
||||
bool Engine::shouldQuit() const {
|
||||
return (_eventMan->shouldQuit() || _eventMan->shouldRTL());
|
||||
}
|
||||
|
||||
bool Engine::hasFeature(EngineFeature f) {
|
||||
// TODO: Get rid of this hack!!!
|
||||
if (f != kSupportsRTL)
|
||||
return false;
|
||||
|
||||
const EnginePlugin *plugin = 0;
|
||||
Common::String gameid = ConfMan.get("gameid");
|
||||
gameid.toLowercase();
|
||||
EngineMan.findGame(gameid, &plugin);
|
||||
assert(plugin);
|
||||
return ( (*plugin)->hasFeature(f) );
|
||||
return ( (*plugin)->hasFeature(MetaEngine::kSupportsRTL) );
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,9 @@
|
|||
#define ENGINES_ENGINE_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/events.h"
|
||||
#include "common/fs.h"
|
||||
#include "common/str.h"
|
||||
|
||||
#include "engines/metaengine.h"
|
||||
|
||||
class OSystem;
|
||||
|
||||
namespace Audio {
|
||||
|
@ -73,7 +70,7 @@ protected:
|
|||
|
||||
const Common::String _targetName; // target name for saves
|
||||
|
||||
const Common::FSNode _gameDataDir;
|
||||
const Common::FSNode _gameDataDir; // FIXME: Get rid of this
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -151,7 +148,7 @@ public:
|
|||
* Return whether the ENGINE should quit respectively should return to the
|
||||
* launcher.
|
||||
*/
|
||||
bool shouldQuit() const { return (_eventMan->shouldQuit() || _eventMan->shouldRTL()); }
|
||||
bool shouldQuit() const;
|
||||
|
||||
/**
|
||||
* Pause or resume the engine. This should stop/resume any audio playback
|
||||
|
@ -176,14 +173,24 @@ public:
|
|||
*/
|
||||
void openMainMenuDialog();
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether the engine supports the specified MetaEngine feature.
|
||||
*
|
||||
* FIXME: This should not call through to the MetaEngine, but rather should support
|
||||
* its own list of features. In particular, kSupportsRTL should be an EngineFeature,
|
||||
* not a MetaEngineFeature.
|
||||
* A feature in this context means an ability of the engine which can be
|
||||
* either available or not.
|
||||
*/
|
||||
bool hasFeature(MetaEngine::MetaEngineFeature f);
|
||||
enum EngineFeature {
|
||||
/**
|
||||
* 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled.
|
||||
*/
|
||||
kSupportsRTL
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine whether the engine supports the specified feature.
|
||||
*
|
||||
* @todo Let this return false by default, or even turn it into a pure virtual method.
|
||||
*/
|
||||
bool hasFeature(EngineFeature f);
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -38,6 +38,25 @@ const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const Pla
|
|||
return 0;
|
||||
}
|
||||
|
||||
GameDescriptor::GameDescriptor() {
|
||||
setVal("gameid", "");
|
||||
setVal("description", "");
|
||||
}
|
||||
|
||||
GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd) {
|
||||
setVal("gameid", pgd.gameid);
|
||||
setVal("description", pgd.description);
|
||||
}
|
||||
|
||||
GameDescriptor::GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l, Common::Platform p) {
|
||||
setVal("gameid", g);
|
||||
setVal("description", d);
|
||||
if (l != Common::UNK_LANG)
|
||||
setVal("language", Common::getLanguageCode(l));
|
||||
if (p != Common::kPlatformUnknown)
|
||||
setVal("platform", Common::getPlatformCode(p));
|
||||
}
|
||||
|
||||
void GameDescriptor::updateDesc(const char *extra) {
|
||||
// TODO: The format used here (LANG/PLATFORM/EXTRA) is not set in stone.
|
||||
// We may want to change the order (PLATFORM/EXTRA/LANG, anybody?), or
|
||||
|
|
|
@ -62,25 +62,12 @@ const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const Pla
|
|||
*/
|
||||
class GameDescriptor : public Common::StringMap {
|
||||
public:
|
||||
GameDescriptor() {
|
||||
setVal("gameid", "");
|
||||
setVal("description", "");
|
||||
}
|
||||
|
||||
GameDescriptor(const PlainGameDescriptor &pgd) {
|
||||
setVal("gameid", pgd.gameid);
|
||||
setVal("description", pgd.description);
|
||||
}
|
||||
|
||||
GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l = Common::UNK_LANG,
|
||||
Common::Platform p = Common::kPlatformUnknown) {
|
||||
setVal("gameid", g);
|
||||
setVal("description", d);
|
||||
if (l != Common::UNK_LANG)
|
||||
setVal("language", Common::getLanguageCode(l));
|
||||
if (p != Common::kPlatformUnknown)
|
||||
setVal("platform", Common::getPlatformCode(p));
|
||||
}
|
||||
GameDescriptor();
|
||||
GameDescriptor(const PlainGameDescriptor &pgd);
|
||||
GameDescriptor(const Common::String &gameid,
|
||||
const Common::String &description,
|
||||
Common::Language language = Common::UNK_LANG,
|
||||
Common::Platform platform = Common::kPlatformUnknown);
|
||||
|
||||
/**
|
||||
* Update the description string by appending (LANG/PLATFORM/EXTRA) to it.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "common/endian.h"
|
||||
#include "common/events.h"
|
||||
|
||||
#include "base/plugins.h"
|
||||
#include "common/config-manager.h"
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "gob/video.h"
|
||||
#include "gob/sound/sound.h"
|
||||
|
||||
#include "common/events.h"
|
||||
|
||||
namespace Gob {
|
||||
|
||||
Util::Util(GobEngine *vm) : _vm(vm) {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#define ENGINES_METAENGINE_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/str.h"
|
||||
#include "common/error.h"
|
||||
|
||||
#include "engines/game.h"
|
||||
|
@ -37,6 +36,7 @@ class OSystem;
|
|||
|
||||
namespace Common {
|
||||
class FSList;
|
||||
class String;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
*/
|
||||
enum MetaEngineFeature {
|
||||
/**
|
||||
* 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled-
|
||||
* 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled.
|
||||
*/
|
||||
kSupportsRTL,
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/advancedDetector.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "parallaction/parallaction.h"
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/advancedDetector.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "saga/displayinfo.h"
|
||||
#include "saga/rscfile.h"
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "common/config-manager.h"
|
||||
#include "common/advancedDetector.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "base/plugins.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue