aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/lure.cpp
diff options
context:
space:
mode:
authorChristopher Page2008-07-25 19:41:17 +0000
committerChristopher Page2008-07-25 19:41:17 +0000
commitdac805c281d9dd37140644315bc968d7f312a265 (patch)
tree2b7961b7b2c08ef09de644f297188d903285d85c /engines/lure/lure.cpp
parent50a54103169487e2173727e2c5b8b25445a376f3 (diff)
downloadscummvm-rg350-dac805c281d9dd37140644315bc968d7f312a265.tar.gz
scummvm-rg350-dac805c281d9dd37140644315bc968d7f312a265.tar.bz2
scummvm-rg350-dac805c281d9dd37140644315bc968d7f312a265.zip
Added -x and --list-saves support for LURE
svn-id: r33291
Diffstat (limited to 'engines/lure/lure.cpp')
-rw-r--r--engines/lure/lure.cpp65
1 files changed, 46 insertions, 19 deletions
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 3cab41da71..335f3384a1 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -92,6 +92,7 @@ int LureEngine::init() {
_room = new Room();
_fights = new FightsManager();
+ _gameToLoad = -1;
_initialised = true;
return 0;
}
@@ -121,27 +122,34 @@ LureEngine &LureEngine::getReference() {
}
int LureEngine::go() {
-
- if (ConfMan.getBool("copy_protection")) {
- CopyProtectionDialog *dialog = new CopyProtectionDialog();
- bool result = dialog->show();
- delete dialog;
- if (quit())
- return _eventMan->shouldRTL();
-
- if (!result)
- error("Sorry - copy protection failed");
- }
-
Game *gameInstance = new Game();
+
+ // If requested, load a savegame instead of showing the intro
+ if (ConfMan.hasKey("save_slot")) {
+ _gameToLoad = ConfMan.getInt("save_slot");
+ if (_gameToLoad < 0 || _gameToLoad > 999)
+ _gameToLoad = -1;
+ }
+
+ if (_gameToLoad == -1) {
+ if (ConfMan.getBool("copy_protection")) {
+ CopyProtectionDialog *dialog = new CopyProtectionDialog();
+ bool result = dialog->show();
+ delete dialog;
+ if (quit())
+ return _eventMan->shouldRTL();
+
+ if (!result)
+ error("Sorry - copy protection failed");
+ }
- if (ConfMan.getInt("boot_param") == 0) {
- // Show the introduction
- Sound.loadSection(Sound.isRoland() ? ROLAND_INTRO_SOUND_RESOURCE_ID : ADLIB_INTRO_SOUND_RESOURCE_ID);
-
- Introduction *intro = new Introduction();
- intro->show();
- delete intro;
+ if (ConfMan.getInt("boot_param") == 0) {
+ // Show the introduction
+ Sound.loadSection(Sound.isRoland() ? ROLAND_INTRO_SOUND_RESOURCE_ID : ADLIB_INTRO_SOUND_RESOURCE_ID);
+ Introduction *intro = new Introduction();
+ intro->show();
+ delete intro;
+ }
}
// Play the game
@@ -278,4 +286,23 @@ Common::String *LureEngine::detectSave(int slotNumber) {
return result;
}
+Common::String getSaveName(Common::InSaveFile *in) {
+ // Check for header
+ char saveName[MAX_DESC_SIZE];
+ char buffer[5];
+ in->read(&buffer[0], 5);
+ if (memcmp(&buffer[0], "lure", 5) == 0) {
+ // Check language version
+ in->readByte();
+ in->readByte();
+ char *p = saveName;
+ int decCtr = MAX_DESC_SIZE - 1;
+ while ((decCtr > 0) && ((*p++ = in->readByte()) != 0)) --decCtr;
+ *p = '\0';
+
+ }
+
+ return Common::String(saveName);
+}
+
} // End of namespace Lure