diff options
Diffstat (limited to 'engines/sword2/sword2.cpp')
-rw-r--r-- | engines/sword2/sword2.cpp | 54 |
1 files changed, 11 insertions, 43 deletions
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 4f942c0d25..7331d1f761 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -33,7 +33,6 @@ #include "common/file.h" #include "common/fs.h" #include "common/events.h" -#include "common/savefile.h" #include "common/system.h" #include "engines/metaengine.h" @@ -80,23 +79,13 @@ public: return "Broken Sword Games (C) Revolution"; } - virtual bool hasFeature(MetaEngineFeature f) const; virtual GameList getSupportedGames() const; virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const FSList &fslist) const; - virtual SaveStateList listSaves(const char *target) const; virtual PluginError createInstance(OSystem *syst, Engine **engine) const; }; -bool Sword2MetaEngine::hasFeature(MetaEngineFeature f) const { - return - (f == kSupportsRTL) || - (f == kSupportsListSaves) || - (f == kSupportsDirectLoad) || - (f == kSupportsDeleteSave); -} - GameList Sword2MetaEngine::getSupportedGames() const { const Sword2::GameSettings *g = Sword2::sword2_settings; GameList games; @@ -167,35 +156,6 @@ GameList Sword2MetaEngine::detectGames(const FSList &fslist) const { return detectedGames; } -SaveStateList Sword2MetaEngine::listSaves(const char *target) const { - Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); - Common::StringList filenames; - char saveDesc[SAVE_DESCRIPTION_LEN]; - Common::String pattern = target; - pattern += ".???"; - - filenames = saveFileMan->listSavefiles(pattern.c_str()); - sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) - - SaveStateList saveList; - for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - if (slotNum >= 0 && slotNum <= 999) { - Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); - if (in) { - in->readUint32LE(); - in->read(saveDesc, SAVE_DESCRIPTION_LEN); - saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file)); - delete in; - } - } - } - - return saveList; -} - PluginError Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) const { assert(syst); assert(engine); @@ -269,6 +229,7 @@ Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) { _gameCycle = 0; _gameSpeed = 1; + _quit = false; syst->getEventManager()->registerRandomSource(_rnd, "sword2"); } @@ -410,7 +371,7 @@ int Sword2Engine::init() { // player will kill the music for us. Otherwise, the restore // will either have killed the music, or done a crossfade. - if (quit()) + if (_quit) return 0; if (result) @@ -482,7 +443,7 @@ int Sword2Engine::go() { // because we want the break to happen before updating the // screen again. - if (quit()) + if (_quit) break; // creates the debug text blocks @@ -499,7 +460,11 @@ int Sword2Engine::go() { #endif } - return _eventMan->shouldRTL(); + return 0; +} + +void Sword2Engine::closeGame() { + _quit = true; } void Sword2Engine::restartGame() { @@ -645,6 +610,9 @@ void Sword2Engine::parseInputEvents() { _mouseEvent.buttons = RD_WHEELDOWN; } break; + case Common::EVENT_QUIT: + closeGame(); + break; default: break; } |