aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cruise/cruise.h1
-rw-r--r--engines/cruise/detection.cpp4
-rw-r--r--engines/cruise/menu.cpp42
3 files changed, 44 insertions, 3 deletions
diff --git a/engines/cruise/cruise.h b/engines/cruise/cruise.h
index 574017dfc7..eff3e9b92f 100644
--- a/engines/cruise/cruise.h
+++ b/engines/cruise/cruise.h
@@ -83,6 +83,7 @@ public:
virtual bool hasFeature(EngineFeature f) const;
int getGameType() const;
+ const char *getGameId() const;
uint32 getFeatures() const;
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp
index 1045ed3b0b..054550e439 100644
--- a/engines/cruise/detection.cpp
+++ b/engines/cruise/detection.cpp
@@ -41,6 +41,10 @@ struct CRUISEGameDescription {
uint32 features;
};
+const char *CruiseEngine::getGameId() const {
+ return _gameDescription->desc.gameid;
+}
+
int CruiseEngine::getGameType() const {
return _gameDescription->gameType;
}
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index 7e454e78f8..c620a39b7d 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -27,8 +27,13 @@
#include "cruise/cruise_main.h"
#include "cruise/staticres.h"
+#include "engines/metaengine.h"
+#include "gui/saveload.h"
+
namespace Cruise {
+extern int currentMouseButton;
+
menuStruct *menuTable[8];
menuStruct *createMenu(int X, int Y, const char *menuName) {
@@ -202,6 +207,38 @@ int processMenu(menuStruct *pMenu) {
return -1;
}
+static void handleSaveLoad(bool saveFlag) {
+ const EnginePlugin *plugin = 0;
+ EngineMan.findGame(_vm->getGameId(), &plugin);
+ GUI::SaveLoadChooser *dialog;
+ if (saveFlag)
+ dialog = new GUI::SaveLoadChooser("Save game:", "Save");
+ else
+ dialog = new GUI::SaveLoadChooser("Load game:", "Load");
+
+ dialog->setSaveMode(saveFlag);
+ int slot = dialog->runModal(plugin, ConfMan.getActiveDomainName());
+
+ if (slot >= 0) {
+ if (!saveFlag)
+ _vm->loadGameState(slot);
+ else {
+ Common::String result(dialog->getResultString());
+ if (result.empty()) {
+ // If the user was lazy and entered no save name, come up with a default name.
+ char buf[20];
+ snprintf(buf, 20, "Save %d", slot + 1);
+
+ _vm->saveGameState(slot, buf);
+ } else {
+ _vm->saveGameState(slot, result.c_str());
+ }
+ }
+ }
+
+ delete dialog;
+}
+
int playerMenu(int menuX, int menuY) {
int retourMenu;
//int restartGame = 0;
@@ -251,15 +288,14 @@ int playerMenu(int menuX, int menuY) {
freeMenu(menuTable[0]);
menuTable[0] = NULL;
+ currentMouseButton = 0;
switch (retourMenu) {
case 3: // select save drive
break;
case 4: // save
- saveSavegameData(0, "Default Save");
- break;
case 5: // load
- loadSavegameData(0);
+ handleSaveLoad(retourMenu == 4);
break;
case 6: // restart
_vm->sound().fadeOutMusic();