aboutsummaryrefslogtreecommitdiff
path: root/engines/toltecs
diff options
context:
space:
mode:
authorFilippos Karapetis2013-01-02 16:48:52 +0200
committerFilippos Karapetis2013-01-02 16:48:52 +0200
commitef6003c29fde58f7fd96eab989ed54b5c5e0a2d0 (patch)
tree4f8140ccfd378f2317bda78cb943de2bc6681e66 /engines/toltecs
parent46b5f15a4ab2fd5e878d8486688a5c3402155e92 (diff)
downloadscummvm-rg350-ef6003c29fde58f7fd96eab989ed54b5c5e0a2d0.tar.gz
scummvm-rg350-ef6003c29fde58f7fd96eab989ed54b5c5e0a2d0.tar.bz2
scummvm-rg350-ef6003c29fde58f7fd96eab989ed54b5c5e0a2d0.zip
TOLTECS: Add an option to use the ScummVM save/load screens
Diffstat (limited to 'engines/toltecs')
-rw-r--r--engines/toltecs/detection.cpp16
-rw-r--r--engines/toltecs/menu.cpp72
-rw-r--r--engines/toltecs/toltecs.cpp3
3 files changed, 69 insertions, 22 deletions
diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp
index c1a57638c2..34f5ebdf24 100644
--- a/engines/toltecs/detection.cpp
+++ b/engines/toltecs/detection.cpp
@@ -24,6 +24,8 @@
#include "base/plugins.h"
#include "engines/advancedDetector.h"
+
+#include "common/translation.h"
#include "common/savefile.h"
#include "common/str-array.h"
#include "common/system.h"
@@ -154,6 +156,13 @@ static const ToltecsGameDescription gameDescriptions[] = {
} // End of namespace Toltecs
+static const ExtraGuiOption toltecsExtraGuiOption = {
+ _s("Use original save/load screens"),
+ _s("Use the original save/load screens, instead of the ScummVM ones"),
+ "originalsaveload",
+ false
+};
+
class ToltecsMetaEngine : public AdvancedMetaEngine {
public:
ToltecsMetaEngine() : AdvancedMetaEngine(Toltecs::gameDescriptions, sizeof(Toltecs::ToltecsGameDescription), toltecsGames) {
@@ -170,6 +179,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const;
void removeSaveState(const char *target, int slot) const;
@@ -202,6 +212,12 @@ bool ToltecsMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADG
return gd != 0;
}
+const ExtraGuiOptions ToltecsMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ ExtraGuiOptions options;
+ options.push_back(toltecsExtraGuiOption);
+ return options;
+}
+
SaveStateList ToltecsMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Toltecs::ToltecsEngine::SaveHeader header;
diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp
index f87a739344..8996ae6ae9 100644
--- a/engines/toltecs/menu.cpp
+++ b/engines/toltecs/menu.cpp
@@ -22,9 +22,12 @@
*/
#include "audio/mixer.h"
-#include "common/savefile.h"
+#include "common/savefile.h"
#include "common/config-manager.h"
+#include "common/translation.h"
+
+#include "gui/saveload.h"
#include "toltecs/toltecs.h"
#include "toltecs/menu.h"
@@ -118,7 +121,7 @@ void MenuSystem::handleEvents() {
case Common::EVENT_MOUSEMOVE:
handleMouseMove(event.mouse.x, event.mouse.y);
break;
- case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_LBUTTONUP:
handleMouseClick(event.mouse.x, event.mouse.y);
break;
default:
@@ -237,29 +240,55 @@ void MenuSystem::initMenu(MenuID menuID) {
addClickTextItem(kItemIdQuit, 0, 275, 320, 0, _vm->getSysString(kStrQuit), 253, 255);
break;
case kMenuIdLoad:
- drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrLoadGame));
- addClickTextItem(kItemIdSavegameUp, 0, 155, 545, 1, "^", 253, 255);
- addClickTextItem(kItemIdSavegameDown, 0, 195, 545, 1, "\\", 253, 255);
- addClickTextItem(kItemIdCancel, 0, 275, 320, 0, _vm->getSysString(kStrCancel), 253, 255);
- for (int i = 1; i <= 7; i++) {
- Common::String saveDesc = Common::String::format("SAVEGAME %d", i);
- addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 115 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234);
+ if (ConfMan.getBool("originalsaveload")) {
+ drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrLoadGame));
+ addClickTextItem(kItemIdSavegameUp, 0, 155, 545, 1, "^", 253, 255);
+ addClickTextItem(kItemIdSavegameDown, 0, 195, 545, 1, "\\", 253, 255);
+ addClickTextItem(kItemIdCancel, 0, 275, 320, 0, _vm->getSysString(kStrCancel), 253, 255);
+ for (int i = 1; i <= 7; i++) {
+ Common::String saveDesc = Common::String::format("SAVEGAME %d", i);
+ addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 115 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234);
+ }
+ loadSavegamesList();
+ setSavegameCaptions();
+ } else {
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
+ int slot = dialog->runModalWithCurrentTarget();
+ delete dialog;
+
+ if (slot >= 0)
+ _vm->requestLoadgame(slot);
+
+ _running = false;
}
- loadSavegamesList();
- setSavegameCaptions();
break;
case kMenuIdSave:
- drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrSaveGame));
- addClickTextItem(kItemIdSavegameUp, 0, 155, 545, 1, "^", 253, 255);
- addClickTextItem(kItemIdSavegameDown, 0, 195, 545, 1, "\\", 253, 255);
- addClickTextItem(kItemIdCancel, 0, 275, 320, 0, _vm->getSysString(kStrCancel), 253, 255);
- for (int i = 1; i <= 7; i++) {
- Common::String saveDesc = Common::String::format("SAVEGAME %d", i);
- addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 115 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234);
+ if (ConfMan.getBool("originalsaveload")) {
+ drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrSaveGame));
+ addClickTextItem(kItemIdSavegameUp, 0, 155, 545, 1, "^", 253, 255);
+ addClickTextItem(kItemIdSavegameDown, 0, 195, 545, 1, "\\", 253, 255);
+ addClickTextItem(kItemIdCancel, 0, 275, 320, 0, _vm->getSysString(kStrCancel), 253, 255);
+ for (int i = 1; i <= 7; i++) {
+ Common::String saveDesc = Common::String::format("SAVEGAME %d", i);
+ addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 115 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234);
+ }
+ newSlotNum = loadSavegamesList() + 1;
+ _savegames.push_back(SavegameItem(newSlotNum, Common::String::format("GAME %03d", _savegames.size() + 1)));
+ setSavegameCaptions();
+ } else {
+ GUI::SaveLoadChooser *dialog = new 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 didn't enter one
+ desc = dialog->createDefaultSaveDescription(slot);
+ }
+
+ if (slot >= 0)
+ _vm->requestSavegame(slot, desc);
+
+ _running = false;
}
- newSlotNum = loadSavegamesList() + 1;
- _savegames.push_back(SavegameItem(newSlotNum, Common::String::format("GAME %03d", _savegames.size() + 1)));
- setSavegameCaptions();
break;
case kMenuIdVolumes:
drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrAdjustVolume));
@@ -431,7 +460,6 @@ void MenuSystem::drawString(int16 x, int16 y, int w, uint fontNum, byte color, c
}
int MenuSystem::loadSavegamesList() {
-
int maxSlotNum = -1;
_savegameListTopIndex = 0;
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index 9f3a10a03b..b3ab09725a 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -62,6 +62,9 @@ struct GameSettings {
};
ToltecsEngine::ToltecsEngine(OSystem *syst, const ToltecsGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
+ // Assign default values to the config manager, in case settings are missing
+ ConfMan.registerDefault("originalsaveload", "false");
+
_rnd = new Common::RandomSource("toltecs");
}