diff options
author | Adrian Frühwirth | 2018-05-06 02:16:40 +0200 |
---|---|---|
committer | Adrian Frühwirth | 2018-05-06 02:26:28 +0200 |
commit | 589f0f875070f0e8bd7b2cbf395818fbc934f822 (patch) | |
tree | 87b8ec0e6a509fb3a37274eba39c49af722339da /engines/prince/saveload.cpp | |
parent | 488c22631b867c7265e901333cd087f3ddf2069a (diff) | |
download | scummvm-rg350-589f0f875070f0e8bd7b2cbf395818fbc934f822.tar.gz scummvm-rg350-589f0f875070f0e8bd7b2cbf395818fbc934f822.tar.bz2 scummvm-rg350-589f0f875070f0e8bd7b2cbf395818fbc934f822.zip |
PRINCE: Use ScummVM save/load dialogs
The original option dialogs do not seem to be implemented yet so we
always show the ScummVM ones when using the save/load hotkeys for now.
This partly fixes Trac#9866.
Diffstat (limited to 'engines/prince/saveload.cpp')
-rw-r--r-- | engines/prince/saveload.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/engines/prince/saveload.cpp b/engines/prince/saveload.cpp index e91bc3476b..b1d9fc49fd 100644 --- a/engines/prince/saveload.cpp +++ b/engines/prince/saveload.cpp @@ -30,12 +30,15 @@ #include "common/system.h" #include "common/config-manager.h" #include "common/memstream.h" +#include "common/translation.h" #include "graphics/thumbnail.h" #include "graphics/surface.h" #include "graphics/palette.h" #include "graphics/scaler.h" +#include "gui/saveload.h" + namespace Prince { #define kSavegameVersion 1 @@ -43,6 +46,37 @@ namespace Prince { class InterpreterFlags; class Interpreter; +bool PrinceEngine::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()) { + desc = dialog->createDefaultSaveDescription(slot); + } + } else { + dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + slot = dialog->runModalWithCurrentTarget(); + } + + delete dialog; + + if (slot < 0) + return false; + + if (isSave) { + return saveGameState(slot, desc).getCode() == Common::kNoError; + } else { + return loadGameState(slot).getCode() == Common::kNoError; + } +} + WARN_UNUSED_RESULT bool PrinceEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header, bool skipThumbnail) { header.version = 0; header.saveName.clear(); |