aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2011-12-09 15:38:49 +0100
committerWillem Jan Palenstijn2011-12-11 10:01:28 +0100
commitdfeb31e187118978a665482fb1b147a62f65c35f (patch)
treeeeb7b44aca029ed919780eeec8e75295519311dc
parent51b724fa43678d33cdbbe8336ae4b0960519c160 (diff)
downloadscummvm-rg350-dfeb31e187118978a665482fb1b147a62f65c35f.tar.gz
scummvm-rg350-dfeb31e187118978a665482fb1b147a62f65c35f.tar.bz2
scummvm-rg350-dfeb31e187118978a665482fb1b147a62f65c35f.zip
DREAMWEB: Add DreamWebEngine::getSavegameFilename
-rw-r--r--engines/dreamweb/dreamweb.cpp9
-rw-r--r--engines/dreamweb/dreamweb.h2
-rw-r--r--engines/dreamweb/saveload.cpp12
-rw-r--r--engines/dreamweb/stubs.cpp14
4 files changed, 23 insertions, 14 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index f455643eb0..2e2d993d0a 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -264,6 +264,15 @@ void DreamWebEngine::closeFile() {
_outSaveFile = 0;
}
+Common::String DreamWebEngine::getSavegameFilename(int slot) const {
+ // TODO: Are saves from all versions of Dreamweb compatible with each other?
+ // Then we can can consider keeping the filenames as DREAMWEB.Dnn.
+ // Otherwise, this must be changed to be target dependent.
+ //Common::String filename = _targetName + Common::String::format(".d%02d", savegameId);
+ Common::String filename = Common::String::format("DREAMWEB.D%02d", slot);
+ return filename;
+}
+
void DreamWebEngine::openSaveFileForWriting(const Common::String &name) {
processEvents();
delete _outSaveFile;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 1d16a188d2..28ca021896 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -104,6 +104,8 @@ public:
void getPalette(uint8 *data, uint start, uint count);
void setPalette(const uint8 *data, uint start, uint count);
+ Common::String getSavegameFilename(int slot) const;
+
void openSaveFileForWriting(const Common::String &name);
uint writeToSaveFile(const uint8 *data, uint size);
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 1ddf54ef44..ad95f318c1 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -31,6 +31,18 @@ namespace DreamGen {
// Temporary storage for loading the room from a savegame
Room g_madeUpRoomDat;
+void DreamGenContext::openForSave(unsigned int slot) {
+ Common::String filename = engine->getSavegameFilename(slot);
+ debug(1, "openForSave(%s)", filename.c_str());
+ engine->openSaveFileForWriting(filename);
+}
+
+bool DreamGenContext::openForLoad(unsigned int slot) {
+ Common::String filename = engine->getSavegameFilename(slot);
+ debug(1, "openForLoad(%s)", filename.c_str());
+ return engine->openSaveFileForReading(filename);
+}
+
void DreamGenContext::loadGame() {
if (data.byte(kCommandtype) != 246) {
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 1d4a5a0ec5..388118a2ff 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -819,20 +819,6 @@ void DreamGenContext::quickQuit2() {
engine->quit();
}
-void DreamGenContext::openForSave(unsigned int slot) {
- //Common::String filename = ConfMan.getActiveDomainName() + Common::String::format(".d%02d", savegameId);
- Common::String filename = Common::String::format("DREAMWEB.D%02d", slot);
- debug(1, "openForSave(%s)", filename.c_str());
- engine->openSaveFileForWriting(filename);
-}
-
-bool DreamGenContext::openForLoad(unsigned int slot) {
- //Common::String filename = ConfMan.getActiveDomainName() + Common::String::format(".d%02d", savegameId);
- Common::String filename = Common::String::format("DREAMWEB.D%02d", slot);
- debug(1, "openForLoad(%s)", filename.c_str());
- return engine->openSaveFileForReading(filename);
-}
-
void DreamBase::readMouse() {
data.word(kOldbutton) = data.word(kMousebutton);
uint16 state = readMouseState();