diff options
author | Christopher Page | 2008-07-25 21:24:09 +0000 |
---|---|---|
committer | Christopher Page | 2008-07-25 21:24:09 +0000 |
commit | cbe0af1c194525543ef7cd5c3605b738c90cc010 (patch) | |
tree | 2130016bc98eea682a48c72694fa0ede58ab8dc0 /engines | |
parent | dac805c281d9dd37140644315bc968d7f312a265 (diff) | |
download | scummvm-rg350-cbe0af1c194525543ef7cd5c3605b738c90cc010.tar.gz scummvm-rg350-cbe0af1c194525543ef7cd5c3605b738c90cc010.tar.bz2 scummvm-rg350-cbe0af1c194525543ef7cd5c3605b738c90cc010.zip |
Added --list-saves support for PARALLACTION, and -x support for NipponSafes
svn-id: r33292
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/detection.cpp | 29 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 1 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 1 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 16 |
4 files changed, 46 insertions, 1 deletions
diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp index 8841b9ca40..da94e0c5d7 100644 --- a/engines/parallaction/detection.cpp +++ b/engines/parallaction/detection.cpp @@ -212,6 +212,7 @@ public: } virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; + virtual SaveStateList listSaves(const char *target) const; }; bool ParallactionMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { @@ -233,6 +234,34 @@ bool ParallactionMetaEngine::createInstance(OSystem *syst, Engine **engine, cons return res; } +SaveStateList ParallactionMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringList filenames; + char saveDesc[200]; + Common::String pattern = target; + pattern += ".0??"; + + 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 2 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 2); + + if (slotNum >= 0 && slotNum <= 99) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + in->readLine(saveDesc, 199); + saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file)); + delete in; + } + } + } + + return saveList; +} + #if PLUGIN_ENABLED_DYNAMIC(PARALLACTION) REGISTER_PLUGIN_DYNAMIC(PARALLACTION, PLUGIN_TYPE_ENGINE, ParallactionMetaEngine); #else diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index fff50b48df..2845fcb94b 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -114,6 +114,7 @@ int Parallaction::init() { _location._hasSound = false; _baseTime = 0; _numLocations = 0; + _gameToLoad = -1; _location._startPosition.x = -1000; _location._startPosition.y = -1000; _location._startFrame = 0; diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 115099addd..e9897b67c3 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -345,6 +345,7 @@ protected: // data uint32 _baseTime; char _characterName1[50]; // only used in changeCharacter + int _gameToLoad; Common::String _saveFileName; diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index e8264238a1..2f7c3dc572 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -240,7 +240,21 @@ int Parallaction_ns::go() { _globalTable = _disk->loadTable("global"); - guiStart(); + // If requested, load a savegame instead of showing the intro + if (ConfMan.hasKey("save_slot")) { + _gameToLoad = ConfMan.getInt("save_slot"); + if (_gameToLoad < 0 || _gameToLoad > 99) + _gameToLoad = -1; + } + if (_gameToLoad == -1) { + guiStart(); + } else { + _disk->selectArchive((getFeatures() & GF_DEMO) ? "disk0" : "disk1"); + _language = guiChooseLanguage(); + _disk->setLanguage(_language); + doLoadGame(_gameToLoad); + } + if (quit()) return _eventMan->shouldRTL(); |