diff options
author | Filippos Karapetis | 2008-11-12 23:21:05 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-11-12 23:21:05 +0000 |
commit | 28da377ccb945797aedf76c73eaec4773d03a0ef (patch) | |
tree | afa63dff0e85beff800b87ed108da91028534702 /engines/cine/detection.cpp | |
parent | f1b1327b3359c6b43dff663094c9451b7d1e246b (diff) | |
download | scummvm-rg350-28da377ccb945797aedf76c73eaec4773d03a0ef.tar.gz scummvm-rg350-28da377ccb945797aedf76c73eaec4773d03a0ef.tar.bz2 scummvm-rg350-28da377ccb945797aedf76c73eaec4773d03a0ef.zip |
Saving and loading from the GMM is now supported in the cine engine
svn-id: r35031
Diffstat (limited to 'engines/cine/detection.cpp')
-rw-r--r-- | engines/cine/detection.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index eefd60e26c..07195fa7b9 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -31,6 +31,7 @@ #include "common/system.h" #include "cine/cine.h" +#include "cine/various.h" namespace Cine { @@ -547,7 +548,9 @@ bool CineMetaEngine::hasFeature(MetaEngineFeature f) const { bool Cine::CineEngine::hasFeature(EngineFeature f) const { return - (f == kSupportsRTL); + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); } bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { @@ -609,3 +612,53 @@ int CineMetaEngine::getMaximumSaveSlot() const { return 9; } #else REGISTER_PLUGIN_STATIC(CINE, PLUGIN_TYPE_ENGINE, CineMetaEngine); #endif + +namespace Cine { + +Common::Error CineEngine::loadGameState(int slot) { + char saveNameBuffer[256]; + sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), slot); + bool gameLoaded = makeLoad(saveNameBuffer); + + return gameLoaded ? Common::kNoError : Common::kUnknownError; +} + +Common::Error CineEngine::saveGameState(int slot, const char *desc) { + // Load savegame descriptions from index file + loadSaveDirectory(); + + // Set description for selected slot + strncpy(currentSaveName[slot], desc, 20); + + // Update savegame descriptions + char indexFile[80]; + snprintf(indexFile, 80, "%s.dir", _targetName.c_str()); + + Common::OutSaveFile *fHandle = g_saveFileMan->openForSaving(indexFile); + if (!fHandle) { + warning("Unable to open file %s for saving", indexFile); + return Common::kUnknownError; + } + + fHandle->write(currentSaveName, 10 * 20); + delete fHandle; + + // Save game + char saveFileName[256]; + sprintf(saveFileName, "%s.%1d", _targetName.c_str(), slot); + makeSave(saveFileName); + + checkDataDisk(-1); + + return Common::kNoError; +} + +bool CineEngine::canLoadGameStateCurrently() { + return (!disableSystemMenu && !inMenu); +} + +bool CineEngine::canSaveGameStateCurrently() { + return (allowPlayerInput && !disableSystemMenu && !inMenu); +} + +} // End of namespace Cine |