aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/saveload.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-06-25 20:30:16 +0200
committerWillem Jan Palenstijn2011-08-18 00:29:17 +0200
commit8a5c8f33203932138266b172b928a662928d3a8a (patch)
tree3d988d41bca5f3e70e5e246aa5674c971481c4fa /engines/dreamweb/saveload.cpp
parent7280a569cb42703b82354f7da836b318dd73c4fb (diff)
downloadscummvm-rg350-8a5c8f33203932138266b172b928a662928d3a8a.tar.gz
scummvm-rg350-8a5c8f33203932138266b172b928a662928d3a8a.tar.bz2
scummvm-rg350-8a5c8f33203932138266b172b928a662928d3a8a.zip
DREAMWEB: Add/fix loading from launcher
This is very error-prone, and needs testing.
Diffstat (limited to 'engines/dreamweb/saveload.cpp')
-rw-r--r--engines/dreamweb/saveload.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 3dfc1b37af..959cc25ed0 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -37,15 +37,22 @@ void DreamGenContext::loadgame() {
}
if (data.word(kMousebutton) == data.word(kOldbutton))
return; // "noload"
- if (data.word(kMousebutton) == 1)
+ if (data.word(kMousebutton) == 1) {
+ ax = 0xFFFF;
doload();
+ }
}
+// input: ax = savegameId
+// if -1, open menu to ask for slot to load
+// if >= 0, directly load from that slot
void DreamGenContext::doload() {
STACK_CHECK;
+ int savegameId = (int16)ax;
+
data.byte(kLoadingorsave) = 1;
- if (ConfMan.getBool("dreamweb_originalsaveload")) {
+ if (ConfMan.getBool("dreamweb_originalsaveload") && savegameId == -1) {
showopbox();
showloadops();
data.byte(kCurrentslot) = 0;
@@ -73,13 +80,18 @@ void DreamGenContext::doload() {
return; // "quitloaded"
}
} else {
- const EnginePlugin *plugin = NULL;
- Common::String gameId = ConfMan.get("gameid");
- EngineMan.findGame(gameId, &plugin);
- GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"));
- dialog->setSaveMode(false);
- int savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
- delete dialog;
+
+ if (savegameId == -1) {
+ // Open dialog to get savegameId
+
+ const EnginePlugin *plugin = NULL;
+ Common::String gameId = ConfMan.get("gameid");
+ EngineMan.findGame(gameId, &plugin);
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"));
+ dialog->setSaveMode(false);
+ savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ delete dialog;
+ }
if (savegameId < 0) {
data.byte(kGetback) = 0;
@@ -114,8 +126,10 @@ void DreamGenContext::doload() {
} else {
// For potential support of more than 7 savegame slots,
// loading into the savenames buffer isn't always possible
+ // Emulate a loadseg call:
uint8 namebuf[17];
engine->readFromFile(namebuf, 17);
+ _add(di, 2);
}
ds = data;
dx = kStartvars;
@@ -136,7 +150,10 @@ void DreamGenContext::doload() {
data.byte(kGetback) = 1;
}
- getridoftemp();
+ // kTempgraphics might not have been allocated if we bypassed all menus
+ if (data.word(kTempgraphics) != 0xFFFF)
+ getridoftemp();
+
dx = data;
es = dx;
bx = kMadeuproomdat;