aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--devtools/tasmrecover/dreamweb/saveload.asm1
-rw-r--r--engines/dreamweb/detection.cpp9
-rw-r--r--engines/dreamweb/dreamgen.cpp1
-rw-r--r--engines/dreamweb/dreamweb.cpp10
-rw-r--r--engines/dreamweb/dreamweb.h1
-rw-r--r--engines/dreamweb/saveload.cpp37
-rw-r--r--engines/dreamweb/stubs.cpp22
7 files changed, 53 insertions, 28 deletions
diff --git a/devtools/tasmrecover/dreamweb/saveload.asm b/devtools/tasmrecover/dreamweb/saveload.asm
index f3c92d36f6..6c98774a0f 100644
--- a/devtools/tasmrecover/dreamweb/saveload.asm
+++ b/devtools/tasmrecover/dreamweb/saveload.asm
@@ -1502,6 +1502,7 @@ Loadold proc near
alreadyloadold: mov ax,mousebutton
and ax,1
jz noloadold
+ mov ax,0ffffh
call doload
cmp getback,4
jz noloadold
diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp
index 81a209de25..4f1c52cbc3 100644
--- a/engines/dreamweb/detection.cpp
+++ b/engines/dreamweb/detection.cpp
@@ -40,7 +40,7 @@ public:
AdvancedMetaEngine(DreamWeb::gameDescriptions,
sizeof(DreamWeb::DreamWebGameDescription), dreamWebGames) {
_singleid = "dreamweb";
- _guioptions = Common::GUIO_NOMIDI | Common::GUIO_NOLAUNCHLOAD;
+ _guioptions = Common::GUIO_NOMIDI;
}
virtual const char *getName() const {
@@ -61,8 +61,8 @@ public:
bool DreamWebMetaEngine::hasFeature(MetaEngineFeature f) const {
switch(f) {
case kSupportsListSaves:
- //case kSupportsLoadingDuringStartup:
- //case kSupportsDeleteSave:
+ case kSupportsLoadingDuringStartup:
+ case kSupportsDeleteSave:
return true;
default:
return false;
@@ -105,7 +105,8 @@ SaveStateList DreamWebMetaEngine::listSaves(const char *target) const {
stream->read(name, sizeof(name) - 1);
delete stream;
- SaveStateDescriptor sd(i, name);
+ int slotNum = atoi(file.c_str() + file.size() - 2);
+ SaveStateDescriptor sd(slotNum, name);
saveList.push_back(sd);
}
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 071841ea26..4c69c21278 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -14510,6 +14510,7 @@ alreadyloadold:
_and(ax, 1);
if (flags.z())
return /* (noloadold) */;
+ ax = 0x0ffff;
doload();
_cmp(data.byte(kGetback), 4);
if (flags.z())
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 9099b5483c..19d1d84a51 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -110,14 +110,6 @@ void DreamWebEngine::processEvents() {
return;
}
- if (_enableSavingOrLoading && _loadSavefile >= 0 && _loadSavefile <= 6) {
- debug(1, "loading save state %d", _loadSavefile);
- _context.data.byte(_context.kCurrentslot) = _loadSavefile;
- _loadSavefile = -1;
- _context.loadposition();
- _context.data.byte(_context.kGetback) = 1;
- }
-
soundHandler();
Common::Event event;
int softKey, hardKey;
@@ -218,8 +210,6 @@ Common::Error DreamWebEngine::run() {
ConfMan.registerDefault("dreamweb_originalsaveload", "true");
- _loadSavefile = Common::ConfigManager::instance().getInt("save_slot");
-
getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
_context.__start();
_context.data.byte(DreamGen::DreamGenContext::kQuitrequested) = 0;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 6ada207496..a7de64a350 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -129,7 +129,6 @@ private:
uint _speed;
bool _turbo;
uint _oldMouseState;
- int _loadSavefile;
bool _enableSavingOrLoading;
Common::Language _language;
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;
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 85918625ec..6bcd80c8d3 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -23,6 +23,7 @@
#include "dreamweb/dreamweb.h"
#include "engines/util.h"
#include "graphics/surface.h"
+#include "common/config-manager.h"
namespace DreamGen {
@@ -49,13 +50,30 @@ void DreamGenContext::dreamweb() {
bool firstLoop = true;
+ int savegameId = Common::ConfigManager::instance().getInt("save_slot");
+
while (true) {
scanfornames();
bool startNewGame = true;
- if (al == 0 && firstLoop) {
+ if (firstLoop && savegameId >= 0) {
+
+ // loading a savegame requested from launcher/command line
+
+ cls();
+ setmode();
+ loadpalfromiff();
+ clearpalette();
+
+ ax = savegameId;
+ doload();
+ worktoscreen();
+ fadescreenup();
+ startNewGame = false;
+
+ } else if (al == 0 && firstLoop) {
// no savegames found, and we're not restarting.
@@ -576,8 +594,6 @@ void DreamGenContext::dosreturn() {
}
void DreamGenContext::set16colpalette() {
- //fixme: this is a bit hackish, set16colpalette called after initialization and nearly before main loop.
- engine->enableSavingOrLoading();
}
void DreamGenContext::mode640x480() {