aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorVladimir Menshakov2011-06-12 17:39:15 +0400
committerAlyssa Milburn2011-06-15 17:34:19 +0200
commitc5ab591b791d96783d9fdb7796a162cbe246b08b (patch)
tree830b1167c3b32e5091f9791870ce13d9397d1560 /engines
parent8ddbbc0c504893dad7fbde6a48b6edb668b249f9 (diff)
downloadscummvm-rg350-c5ab591b791d96783d9fdb7796a162cbe246b08b.tar.gz
scummvm-rg350-c5ab591b791d96783d9fdb7796a162cbe246b08b.tar.bz2
scummvm-rg350-c5ab591b791d96783d9fdb7796a162cbe246b08b.zip
DREAMWEB: unstabbed save
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreamweb.cpp27
-rw-r--r--engines/dreamweb/dreamweb.h5
2 files changed, 28 insertions, 4 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 2c03e369e1..817496d73b 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -29,7 +29,6 @@
#include "common/EventRecorder.h"
#include "common/file.h"
#include "common/func.h"
-#include "common/savefile.h"
#include "common/system.h"
#include "common/timer.h"
#include "common/util.h"
@@ -196,7 +195,22 @@ uint32 DreamWebEngine::readFromFile(uint8 *dst, unsigned size) {
void DreamWebEngine::closeFile() {
processEvents();
- _file.close();
+ if (_file.isOpen())
+ _file.close();
+ delete _saveFile;
+ _saveFile = 0;
+}
+
+void DreamWebEngine::openSaveFile(const Common::String &name) {
+ processEvents();
+ _saveFile = _system->getSavefileManager()->openForSaving(name);
+}
+
+uint DreamWebEngine::writeToSaveFile(const uint8 *data, uint size) {
+ processEvents();
+ if (!_saveFile)
+ error("save file was not opened");
+ return _saveFile->write(data, size);
}
void DreamWebEngine::keyPressed(uint16 ascii) {
@@ -408,7 +422,9 @@ void closefile(Context &context) {
}
void openforsave(Context &context) {
- ::error("openforsave");
+ const char *name = (const char *)context.ds.ptr(context.dx, 13);
+ debug(1, "openforsave(%s)", name);
+ engine()->openSaveFile(name);
}
void openfilenocheck(Context &context) {
@@ -581,10 +597,13 @@ void scanfornames(Context &context) {
}
void saveseg(Context &context) {
- ::error("saveseg");
+ context.cx = context.es.word(context.di);
+ context._add(context.di, 2);
+ savefilewrite(context);
}
void savefilewrite(Context &context) {
+ engine()->writeToSaveFile(context.ds.ptr(context.dx, context.cx), context.cx);
}
void savefileread(Context &context) {
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 633d5075e0..7e99bf5e78 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -30,6 +30,7 @@
#include "common/file.h"
#include "common/random.h"
#include "common/rect.h"
+#include "common/savefile.h"
#include "common/scummsys.h"
#include "engines/engine.h"
@@ -89,6 +90,9 @@ public:
void getPalette(uint8 *data, uint start, uint count);
void setPalette(const uint8 *data, uint start, uint count);
+
+ void openSaveFile(const Common::String &name);
+ uint writeToSaveFile(const uint8 *data, uint size);
private:
@@ -100,6 +104,7 @@ private:
unsigned _mouseState;
Common::File _file;
+ Common::OutSaveFile *_saveFile;
dreamgen::Context _context;
};