aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-29 17:48:23 +0600
committerAlexander Tkachev2016-07-29 17:48:23 +0600
commitf50d9feee1e04a8ca9271b21859bda48172b7ff5 (patch)
tree01cbbc0e04021698483aac5daa472d2d943843d7 /engines
parentb9198d37f7ea397c338d6c0afec05840bdf21403 (diff)
downloadscummvm-rg350-f50d9feee1e04a8ca9271b21859bda48172b7ff5.tar.gz
scummvm-rg350-f50d9feee1e04a8ca9271b21859bda48172b7ff5.tar.bz2
scummvm-rg350-f50d9feee1e04a8ca9271b21859bda48172b7ff5.zip
WAGE: Make menu items show Save/Load dialog
Default ScummVM Save/Load dialog shows up on click.
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/detection.cpp4
-rw-r--r--engines/wage/gui.cpp17
-rw-r--r--engines/wage/saveload.cpp38
-rw-r--r--engines/wage/wage.cpp2
-rw-r--r--engines/wage/wage.h4
5 files changed, 55 insertions, 10 deletions
diff --git a/engines/wage/detection.cpp b/engines/wage/detection.cpp
index 8b8a6399a8..e14a952588 100644
--- a/engines/wage/detection.cpp
+++ b/engines/wage/detection.cpp
@@ -142,11 +142,11 @@ void WageMetaEngine::removeSaveState(const char *target, int slot) const {
namespace Wage {
bool WageEngine::canLoadGameStateCurrently() {
- return false;
+ return true;
}
bool WageEngine::canSaveGameStateCurrently() {
- return false;
+ return true;
}
} // End of namespace Wage
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 099279158f..cdc646f649 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -65,9 +65,9 @@ static const MenuData menuSubItems[] = {
{ kMenuHighLevel, "File", 0, 0, false },
{ kMenuHighLevel, "Edit", 0, 0, false },
{ kMenuFile, "New", kMenuActionNew, 0, false },
- { kMenuFile, "Open...", kMenuActionOpen, 0, false },
+ { kMenuFile, "Open...", kMenuActionOpen, 0, true },
{ kMenuFile, "Close", kMenuActionClose, 0, true },
- { kMenuFile, "Save", kMenuActionSave, 0, false },
+ { kMenuFile, "Save", kMenuActionSave, 0, true },
{ kMenuFile, "Save as...", kMenuActionSaveAs, 0, true },
{ kMenuFile, "Revert", kMenuActionRevert, 0, false },
{ kMenuFile, "Quit", kMenuActionQuit, 0, true },
@@ -323,12 +323,19 @@ void Gui::executeMenuCommand(int action, Common::String &text) {
switch(action) {
case kMenuActionAbout:
case kMenuActionNew:
- case kMenuActionOpen:
case kMenuActionClose:
- case kMenuActionSave:
- case kMenuActionSaveAs:
case kMenuActionRevert:
case kMenuActionQuit:
+ break;
+
+ case kMenuActionOpen:
+ _engine->scummVMSaveLoadDialog(false);
+ break;
+
+ case kMenuActionSave:
+ case kMenuActionSaveAs:
+ _engine->scummVMSaveLoadDialog(true);
+ break;
case kMenuActionUndo:
actionUndo();
diff --git a/engines/wage/saveload.cpp b/engines/wage/saveload.cpp
index 4889add4f0..78e8d389d3 100644
--- a/engines/wage/saveload.cpp
+++ b/engines/wage/saveload.cpp
@@ -721,6 +721,13 @@ Common::String WageEngine::getSavegameFilename(int16 slotId) const {
return saveLoadSlot;
}
+Common::Error WageEngine::loadGameState(int slot) {
+ if (loadGame(slot) == 0)
+ return Common::kNoError;
+ else
+ return Common::kUnknownError;
+}
+
Common::Error WageEngine::saveGameState(int slot, const Common::String &description) {
Common::String saveLoadSlot = getSavegameFilename(slot);
if (saveGame(saveLoadSlot, description) == 0)
@@ -729,4 +736,35 @@ Common::Error WageEngine::saveGameState(int slot, const Common::String &descript
return Common::kUnknownError;
}
+bool WageEngine::scummVMSaveLoadDialog(bool isSave) {
+ if (!isSave) {
+ // do loading
+ GUI::SaveLoadChooser dialog = GUI::SaveLoadChooser(_("Load game:"), _("Load"), false);
+ int slot = dialog.runModalWithCurrentTarget();
+
+ if (slot < 0)
+ return true;
+
+ return loadGameState(slot).getCode() == Common::kNoError;
+ }
+
+ // do saving
+ GUI::SaveLoadChooser dialog = GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
+ int slot = dialog.runModalWithCurrentTarget();
+ Common::String 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);
+
+ if (slot < 0)
+ return true;
+
+ return saveGameState(slot, desc).getCode() == Common::kNoError;
+}
+
} // End of namespace Agi
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index fe10b1aa8b..6a33efa02a 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -253,8 +253,6 @@ bool WageEngine::saveDialog() {
void WageEngine::saveGame() {
warning("STUB: saveGame()");
- Common::String fileName = getSavegameFilename(1), desc = "test save #1";
- saveGame(fileName, desc);
}
void WageEngine::performInitialSetup() {
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 718f5e2d64..511a2d9e26 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -208,7 +208,9 @@ public:
void redrawScene();
void saveGame();
- Common::Error saveGameState(int slot, const Common::String &description);
+ virtual Common::Error loadGameState(int slot);
+ virtual Common::Error saveGameState(int slot, const Common::String &description);
+ bool scummVMSaveLoadDialog(bool isSave);
private:
int getSceneIndex(Scene *scene) const;