| CODENOTIFIER | HelpYou are not signed inSign in |
Project: ScummVM
Revision: 34755
Author: fingolfin
Date: 06 Oct 2008 08:48:52
Changes:Added new type Engine::Feature; pushed down some #include dependencies
Files:| ... | ...@@ -25,6 +25,7 @@ | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | #include "common/md5.h" |
| 28 | #include "common/events.h" | |
| 28 | 29 | #include "common/file.h" |
| 29 | 30 | #include "common/savefile.h" |
| 30 | 31 | #include "common/config-manager.h" |
| ... | ...@@ -31,6 +31,7 @@ | |
| 31 | 31 | |
| 32 | 32 | #include "engines/engine.h" |
| 33 | 33 | #include "common/config-manager.h" |
| 34 | #include "common/events.h" | |
| 34 | 35 | #include "common/file.h" |
| 35 | 36 | #include "common/timer.h" |
| 36 | 37 | #include "common/savefile.h" |
| ... | ...@@ -250,13 +251,20 @@ | |
| 250 | 251 | _eventMan->pushEvent(event); |
| 251 | 252 | } |
| 252 | 253 | |
| 253 | bool Engine::hasFeature(MetaEngine::MetaEngineFeature f) { | |
| 254 | // TODO: In each engine, keep a ref to the corresponding MetaEngine? | |
| 254 | bool Engine::shouldQuit() const { | |
| 255 | return (_eventMan->shouldQuit() || _eventMan->shouldRTL()); | |
| 256 | } | |
| 257 | ||
| 258 | bool Engine::hasFeature(EngineFeature f) { | |
| 259 | // TODO: Get rid of this hack!!! | |
| 260 | if (f != kSupportsRTL) | |
| 261 | return false; | |
| 262 | ||
| 255 | 263 | const EnginePlugin *plugin = 0; |
| 256 | 264 | Common::String gameid = ConfMan.get("gameid"); |
| 257 | 265 | gameid.toLowercase(); |
| 258 | 266 | EngineMan.findGame(gameid, &plugin); |
| 259 | 267 | assert(plugin); |
| 260 | return ( (*plugin)->hasFeature(f) ); | |
| 268 | return ( (*plugin)->hasFeature(MetaEngine::kSupportsRTL) ); | |
| 261 | 269 | } |
| 262 | 270 |
| ... | ...@@ -26,6 +26,7 @@ | |
| 26 | 26 | #include "common/config-manager.h" |
| 27 | 27 | #include "common/advancedDetector.h" |
| 28 | 28 | #include "common/savefile.h" |
| 29 | #include "common/system.h" | |
| 29 | 30 | |
| 30 | 31 | #include "base/plugins.h" |
| 31 | 32 |
| ... | ...@@ -25,6 +25,7 @@ | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | #include "common/endian.h" |
| 28 | #include "common/events.h" | |
| 28 | 29 | #include "common/savefile.h" |
| 29 | 30 | |
| 30 | 31 | #include "cine/cine.h" |
| ... | ...@@ -28,6 +28,7 @@ | |
| 28 | 28 | #include "common/advancedDetector.h" |
| 29 | 29 | #include "common/config-manager.h" |
| 30 | 30 | #include "common/savefile.h" |
| 31 | #include "common/system.h" | |
| 31 | 32 | |
| 32 | 33 | #include "agos/agos.h" |
| 33 | 34 |
| ... | ...@@ -26,6 +26,7 @@ | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | #include "common/endian.h" |
| 29 | #include "common/events.h" | |
| 29 | 30 | #include "common/system.h" |
| 30 | 31 | |
| 31 | 32 | #include "graphics/cursorman.h" |
| ... | ...@@ -23,6 +23,7 @@ | |
| 23 | 23 | * |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | #include "common/events.h" | |
| 26 | 27 | #include "common/savefile.h" |
| 27 | 28 | #include "common/stream.h" |
| 28 | 29 |
| ... | ...@@ -38,6 +38,25 @@ | |
| 38 | 38 | return 0; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | GameDescriptor::GameDescriptor() { | |
| 42 | setVal("gameid", ""); | |
| 43 | setVal("description", ""); | |
| 44 | } | |
| 45 | ||
| 46 | GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd) { | |
| 47 | setVal("gameid", pgd.gameid); | |
| 48 | setVal("description", pgd.description); | |
| 49 | } | |
| 50 | ||
| 51 | GameDescriptor::GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l, Common::Platform p) { | |
| 52 | setVal("gameid", g); | |
| 53 | setVal("description", d); | |
| 54 | if (l != Common::UNK_LANG) | |
| 55 | setVal("language", Common::getLanguageCode(l)); | |
| 56 | if (p != Common::kPlatformUnknown) | |
| 57 | setVal("platform", Common::getPlatformCode(p)); | |
| 58 | } | |
| 59 | ||
| 41 | 60 | void GameDescriptor::updateDesc(const char *extra) { |
| 42 | 61 | // TODO: The format used here (LANG/PLATFORM/EXTRA) is not set in stone. |
| 43 | 62 | // We may want to change the order (PLATFORM/EXTRA/LANG, anybody?), or |
| ... | ...@@ -26,12 +26,9 @@ | |
| 26 | 26 | #define ENGINES_ENGINE_H |
| 27 | 27 | |
| 28 | 28 | #include "common/scummsys.h" |
| 29 | #include "common/events.h" | |
| 30 | 29 | #include "common/fs.h" |
| 31 | 30 | #include "common/str.h" |
| 32 | 31 | |
| 33 | #include "engines/metaengine.h" | |
| 34 | ||
| 35 | 32 | class OSystem; |
| 36 | 33 | |
| 37 | 34 | namespace Audio { |
| ... | ...@@ -73,7 +70,7 @@ | |
| 73 | 70 | |
| 74 | 71 | const Common::String _targetName; // target name for saves |
| 75 | 72 | |
| 76 | const Common::FSNode _gameDataDir; | |
| 73 | const Common::FSNode _gameDataDir; // FIXME: Get rid of this | |
| 77 | 74 | |
| 78 | 75 | private: |
| 79 | 76 | /** |
| ... | ...@@ -151,7 +148,7 @@ | |
| 151 | 148 | * Return whether the ENGINE should quit respectively should return to the |
| 152 | 149 | * launcher. |
| 153 | 150 | */ |
| 154 | bool shouldQuit() const { return (_eventMan->shouldQuit() || _eventMan->shouldRTL()); } | |
| 151 | bool shouldQuit() const; | |
| 155 | 152 | |
| 156 | 153 | /** |
| 157 | 154 | * Pause or resume the engine. This should stop/resume any audio playback |
| ... | ...@@ -176,14 +173,24 @@ | |
| 176 | 173 | */ |
| 177 | 174 | void openMainMenuDialog(); |
| 178 | 175 | |
| 176 | ||
| 177 | /** | |
| 178 | * A feature in this context means an ability of the engine which can be | |
| 179 | * either available or not. | |
| 180 | */ | |
| 181 | enum EngineFeature { | |
| 182 | /** | |
| 183 | * 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled. | |
| 184 | */ | |
| 185 | kSupportsRTL | |
| 186 | }; | |
| 187 | ||
| 179 | 188 | /** |
| 180 | * Determine whether the engine supports the specified MetaEngine feature. | |
| 189 | * Determine whether the engine supports the specified feature. | |
| 181 | 190 | * |
| 182 | * FIXME: This should not call through to the MetaEngine, but rather should support | |
| 183 | * its own list of features. In particular, kSupportsRTL should be an EngineFeature, | |
| 184 | * not a MetaEngineFeature. | |
| 191 | * @todo Let this return false by default, or even turn it into a pure virtual method. | |
| 185 | 192 | */ |
| 186 | bool hasFeature(MetaEngine::MetaEngineFeature f); | |
| 193 | bool hasFeature(EngineFeature f); | |
| 187 | 194 | |
| 188 | 195 | public: |
| 189 | 196 |
| ... | ...@@ -62,25 +62,12 @@ | |
| 62 | 62 | */ |
| 63 | 63 | class GameDescriptor : public Common::StringMap { |
| 64 | 64 | public: |
| 65 | GameDescriptor() { | |
| 66 | setVal("gameid", ""); | |
| 67 | setVal("description", ""); | |
| 68 | } | |
| 69 | ||
| 70 | GameDescriptor(const PlainGameDescriptor &pgd) { | |
| 71 | setVal("gameid", pgd.gameid); | |
| 72 | setVal("description", pgd.description); | |
| 73 | } | |
| 74 | ||
| 75 | GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l = Common::UNK_LANG, | |
| 76 | Common::Platform p = Common::kPlatformUnknown) { | |
| 77 | setVal("gameid", g); | |
| 78 | setVal("description", d); | |
| 79 | if (l != Common::UNK_LANG) | |
| 80 | setVal("language", Common::getLanguageCode(l)); | |
| 81 | if (p != Common::kPlatformUnknown) | |
| 82 | setVal("platform", Common::getPlatformCode(p)); | |
| 83 | } | |
| 65 | GameDescriptor(); | |
| 66 | GameDescriptor(const PlainGameDescriptor &pgd); | |
| 67 | GameDescriptor(const Common::String &gameid, | |
| 68 | const Common::String &description, | |
| 69 | Common::Language language = Common::UNK_LANG, | |
| 70 | Common::Platform platform = Common::kPlatformUnknown); | |
| 84 | 71 | |
| 85 | 72 | /** |
| 86 | 73 | * Update the description string by appending (LANG/PLATFORM/EXTRA) to it. |
| ... | ...@@ -24,6 +24,7 @@ | |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | #include "common/endian.h" |
| 27 | #include "common/events.h" | |
| 27 | 28 | |
| 28 | 29 | #include "base/plugins.h" |
| 29 | 30 | #include "common/config-manager.h" |
| ... | ...@@ -30,6 +30,8 @@ | |
| 30 | 30 | |
| 31 | 31 | #include "agi/preagi_common.h" |
| 32 | 32 | |
| 33 | #include "common/events.h" | |
| 34 | ||
| 33 | 35 | namespace Agi { |
| 34 | 36 | |
| 35 | 37 | // Screen functions |
| ... | ...@@ -29,6 +29,7 @@ | |
| 29 | 29 | |
| 30 | 30 | #include "graphics/cursorman.h" |
| 31 | 31 | |
| 32 | #include "common/events.h" | |
| 32 | 33 | #include "common/savefile.h" |
| 33 | 34 | #include "common/stream.h" |
| 34 | 35 |
| ... | ...@@ -26,7 +26,6 @@ | |
| 26 | 26 | #define ENGINES_METAENGINE_H |
| 27 | 27 | |
| 28 | 28 | #include "common/scummsys.h" |
| 29 | #include "common/str.h" | |
| 30 | 29 | #include "common/error.h" |
| 31 | 30 | |
| 32 | 31 | #include "engines/game.h" |
| ... | ...@@ -37,6 +36,7 @@ | |
| 37 | 36 | |
| 38 | 37 | namespace Common { |
| 39 | 38 | class FSList; |
| 39 | class String; | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| ... | ...@@ -134,7 +134,7 @@ | |
| 134 | 134 | */ |
| 135 | 135 | enum MetaEngineFeature { |
| 136 | 136 | /** |
| 137 | * 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled- | |
| 137 | * 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled. | |
| 138 | 138 | */ |
| 139 | 139 | kSupportsRTL, |
| 140 | 140 |
| ... | ...@@ -103,7 +103,7 @@ | |
| 103 | 103 | new GUI::ButtonWidget(this, "globalmain_about", "About", kAboutCmd, 'A'); |
| 104 | 104 | |
| 105 | 105 | _rtlButton = new GUI::ButtonWidget(this, "globalmain_rtl", "Return to Launcher", kRTLCmd, 'R'); |
| 106 | _rtlButton->setEnabled(_engine->hasFeature(MetaEngine::kSupportsRTL)); | |
| 106 | _rtlButton->setEnabled(_engine->hasFeature(Engine::kSupportsRTL)); | |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | new GUI::ButtonWidget(this, "globalmain_quit", "Quit", kQuitCmd, 'Q'); |
| ... | ...@@ -28,6 +28,8 @@ | |
| 28 | 28 | #include "agi/preagi_troll.h" |
| 29 | 29 | #include "agi/graphics.h" |
| 30 | 30 | |
| 31 | #include "common/events.h" | |
| 32 | ||
| 31 | 33 | #include "graphics/cursorman.h" |
| 32 | 34 | |
| 33 | 35 | namespace Agi { |
| ... | ...@@ -33,6 +33,8 @@ | |
| 33 | 33 | #include "gob/video.h" |
| 34 | 34 | #include "gob/sound/sound.h" |
| 35 | 35 | |
| 36 | #include "common/events.h" | |
| 37 | ||
| 36 | 38 | namespace Gob { |
| 37 | 39 | |
| 38 | 40 | Util::Util(GobEngine *vm) : _vm(vm) { |
| ... | ...@@ -27,6 +27,7 @@ | |
| 27 | 27 | |
| 28 | 28 | #include "common/config-manager.h" |
| 29 | 29 | #include "common/advancedDetector.h" |
| 30 | #include "common/system.h" | |
| 30 | 31 | |
| 31 | 32 | #include "parallaction/parallaction.h" |
| 32 | 33 |
| ... | ...@@ -31,6 +31,7 @@ | |
| 31 | 31 | |
| 32 | 32 | #include "common/config-manager.h" |
| 33 | 33 | #include "common/advancedDetector.h" |
| 34 | #include "common/system.h" | |
| 34 | 35 | |
| 35 | 36 | #include "saga/displayinfo.h" |
| 36 | 37 | #include "saga/rscfile.h" |
| ... | ...@@ -25,6 +25,7 @@ | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | #include "common/scummsys.h" |
| 28 | #include "common/events.h" | |
| 28 | 29 | #include "common/system.h" |
| 29 | 30 | |
| 30 | 31 | #include "cine/main_loop.h" |
| ... | ...@@ -28,6 +28,7 @@ | |
| 28 | 28 | #include "base/plugins.h" |
| 29 | 29 | |
| 30 | 30 | #include "common/advancedDetector.h" |
| 31 | #include "common/system.h" | |
| 31 | 32 | |
| 32 | 33 | #include "cine/cine.h" |
| 33 | 34 |
| ... | ...@@ -23,6 +23,7 @@ | |
| 23 | 23 | * |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | #include "common/events.h" | |
| 26 | 27 | #include "common/file.h" |
| 27 | 28 | #include "common/savefile.h" |
| 28 | 29 | #include "common/config-manager.h" |