diff options
author | Filippos Karapetis | 2015-12-28 00:31:50 +0200 |
---|---|---|
committer | Filippos Karapetis | 2015-12-28 00:31:50 +0200 |
commit | e52cf3e7aae1adde1c4674a6f5686d9f633bd2f8 (patch) | |
tree | 9fb8e997d6e7d21c219ccdef3fa1077d5a8bc903 /engines | |
parent | 3977a7ffa15d1db55d787b450307ef1c62fcda26 (diff) | |
download | scummvm-rg350-e52cf3e7aae1adde1c4674a6f5686d9f633bd2f8.tar.gz scummvm-rg350-e52cf3e7aae1adde1c4674a6f5686d9f633bd2f8.tar.bz2 scummvm-rg350-e52cf3e7aae1adde1c4674a6f5686d9f633bd2f8.zip |
CINE: Add support for ScummVM save/load menus
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/cine.cpp | 3 | ||||
-rw-r--r-- | engines/cine/cine.h | 1 | ||||
-rw-r--r-- | engines/cine/detection.cpp | 15 | ||||
-rw-r--r-- | engines/cine/various.cpp | 67 |
4 files changed, 85 insertions, 1 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index d2f088dcd8..0d3f99b49f 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -52,6 +52,9 @@ CineEngine::CineEngine(OSystem *syst, const CINEGameDescription *gameDesc) // Setup mixer syncSoundSettings(); + // Assign default values to the config manager, in case settings are missing + ConfMan.registerDefault("originalsaveload", "false"); + DebugMan.addDebugChannel(kCineDebugScript, "Script", "Script debug level"); DebugMan.addDebugChannel(kCineDebugPart, "Part", "Part debug level"); DebugMan.addDebugChannel(kCineDebugSound, "Sound", "Sound debug level"); diff --git a/engines/cine/cine.h b/engines/cine/cine.h index 71a0c242b6..1618899af3 100644 --- a/engines/cine/cine.h +++ b/engines/cine/cine.h @@ -123,6 +123,7 @@ public: bool loadSaveDirectory(); void makeSystemMenu(); + int scummVMSaveLoadDialog(bool isSave); int modifyGameSpeed(int speedChange); int getTimerDelay() const; Common::Error loadGameState(int slot); diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index 4202bdc942..5b839b8043 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -24,8 +24,10 @@ #include "engines/advancedDetector.h" #include "engines/obsolete.h" + #include "common/system.h" #include "common/textconsole.h" +#include "common/translation.h" #include "cine/cine.h" #include "cine/various.h" @@ -61,6 +63,13 @@ static const Engines::ObsoleteGameID obsoleteGameIDsTable[] = { #include "cine/detection_tables.h" +static const ExtraGuiOption cineExtraGuiOption = { + _s("Use original save/load screens"), + _s("Use the original save/load screens, instead of the ScummVM ones"), + "originalsaveload", + false +}; + class CineMetaEngine : public AdvancedMetaEngine { public: CineMetaEngine() : AdvancedMetaEngine(Cine::gameDescriptions, sizeof(Cine::CINEGameDescription), cineGames) { @@ -86,6 +95,12 @@ public: } virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + const ExtraGuiOptions CineMetaEngine::getExtraGuiOptions(const Common::String &target) const { + ExtraGuiOptions options; + options.push_back(cineExtraGuiOption); + return options; + } + virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; virtual int getMaximumSaveSlot() const; diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 8687699a44..fa05369f8d 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -21,12 +21,16 @@ */ +#include "common/config-manager.h" #include "common/endian.h" #include "common/events.h" #include "common/textconsole.h" +#include "common/translation.h" #include "graphics/cursorman.h" +#include "gui/saveload.h" + #include "cine/cine.h" #include "cine/main_loop.h" #include "cine/object.h" @@ -335,6 +339,56 @@ void CineEngine::resetEngine() { } } +int CineEngine::scummVMSaveLoadDialog(bool isSave) { + GUI::SaveLoadChooser *dialog; + Common::String desc; + int slot; + + if (isSave) { + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); + + slot = dialog->runModalWithCurrentTarget(); + desc = dialog->getResultString(); + + if (desc.empty()) { + // create our own description for the saved game, the user didnt enter it + desc = dialog->createDefaultSaveDescription(slot); + } + } + else { + dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + slot = dialog->runModalWithCurrentTarget(); + } + + delete dialog; + + if (slot < 0) + return true; + + char saveFileName[256]; + sprintf(saveFileName, "%s.%1d", _targetName.c_str(), slot); + + if (isSave) { + Common::String tmp = Common::String::format("%s.dir", _targetName.c_str()); + + Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(tmp); + if (!fHandle) { + warning("Unable to open file %s for saving", tmp.c_str()); + return false; + } + + Common::strlcpy(currentSaveName[slot], desc.c_str(), 20); + + fHandle->write(currentSaveName, 200); + delete fHandle; + + makeSave(saveFileName); + return true; + } else { + return makeLoad(saveFileName); + } +} + void CineEngine::makeSystemMenu() { int16 numEntry, systemCommand; int16 mouseX, mouseY, mouseButton; @@ -381,7 +435,11 @@ void CineEngine::makeSystemMenu() { } case 4: { // load game if (loadSaveDirectory()) { -// int16 selectedSave; + if (!ConfMan.getBool("originalsaveload")) { + scummVMSaveLoadDialog(false); + inMenu = false; + return; + } getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY); selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180); @@ -417,6 +475,13 @@ void CineEngine::makeSystemMenu() { } case 5: { // Save game loadSaveDirectory(); + + if (!ConfMan.getBool("originalsaveload")) { + scummVMSaveLoadDialog(true); + inMenu = false; + return; + } + selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180); if (selectedSave >= 0) { |