aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/core
diff options
context:
space:
mode:
authorFilippos Karapetis2014-12-08 01:08:27 +0200
committerFilippos Karapetis2014-12-08 01:08:27 +0200
commitec1fdeb25ad6b2d9aae69a544f45eb7fc5e189b8 (patch)
tree208ba880f260ae7bc9e3e2239bc2db28dfc0c7d6 /engines/zvision/core
parentf2511e5a9ecfebdf5c03319acb9466e070fa3d06 (diff)
downloadscummvm-rg350-ec1fdeb25ad6b2d9aae69a544f45eb7fc5e189b8.tar.gz
scummvm-rg350-ec1fdeb25ad6b2d9aae69a544f45eb7fc5e189b8.tar.bz2
scummvm-rg350-ec1fdeb25ad6b2d9aae69a544f45eb7fc5e189b8.zip
ZVISION: Implement several advanced engine features and ScummVM dialogs
The functionality to return to launcher, list saves, delete saves, load games from the launcher and load and save games during runtime has been implemented. Also, ScummVM save/load dialogs have been implemented. Saved games now have three numbers in their file extension, bumping the possible save game slots up to 999
Diffstat (limited to 'engines/zvision/core')
-rw-r--r--engines/zvision/core/save_manager.cpp40
-rw-r--r--engines/zvision/core/save_manager.h1
2 files changed, 40 insertions, 1 deletions
diff --git a/engines/zvision/core/save_manager.cpp b/engines/zvision/core/save_manager.cpp
index 11d3dd391a..20bd39fde5 100644
--- a/engines/zvision/core/save_manager.cpp
+++ b/engines/zvision/core/save_manager.cpp
@@ -23,22 +23,60 @@
#include "common/scummsys.h"
#include "zvision/core/save_manager.h"
-
#include "zvision/zvision.h"
#include "zvision/scripting/script_manager.h"
#include "zvision/graphics/render_manager.h"
#include "common/system.h"
+#include "common/translation.h"
#include "graphics/surface.h"
#include "graphics/thumbnail.h"
#include "gui/message.h"
+#include "gui/saveload.h"
namespace ZVision {
const uint32 SaveManager::SAVEGAME_ID = MKTAG('Z', 'E', 'N', 'G');
+bool SaveManager::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);
+ }
+
+ if (desc.size() > 28)
+ desc = Common::String(desc.c_str(), 28);
+ } else {
+ dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
+ slot = dialog->runModalWithCurrentTarget();
+ }
+
+ delete dialog;
+
+ if (slot < 0)
+ return false;
+
+ if (isSave) {
+ saveGame(slot, desc);
+ return true;
+ } else {
+ Common::ErrorCode result = loadGame(slot).getCode();
+ return (result == Common::kNoError);
+ }
+}
+
void SaveManager::saveGame(uint slot, const Common::String &saveName) {
// The games only support 20 slots
//assert(slot <= 1 && slot <= 20);
diff --git a/engines/zvision/core/save_manager.h b/engines/zvision/core/save_manager.h
index 5cd61c7aa9..75841331e7 100644
--- a/engines/zvision/core/save_manager.h
+++ b/engines/zvision/core/save_manager.h
@@ -96,6 +96,7 @@ public:
void prepareSaveBuffer();
void flushSaveBuffer();
+ bool scummVMSaveLoadDialog(bool isSave);
private:
void writeSaveGameHeader(Common::OutSaveFile *file, const Common::String &saveName);
};