aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir2011-06-08 01:25:26 +0400
committerAlyssa Milburn2011-06-15 17:32:11 +0200
commit9a1575b9d560ff7ffa5056081072e3b049c0c2c5 (patch)
tree3e0562de1f93a5f7280e00c73a4d243cc645e72d
parent1494cdb29597369dcaee6dbbd146f63f916af9c0 (diff)
downloadscummvm-rg350-9a1575b9d560ff7ffa5056081072e3b049c0c2c5.tar.gz
scummvm-rg350-9a1575b9d560ff7ffa5056081072e3b049c0c2c5.tar.bz2
scummvm-rg350-9a1575b9d560ff7ffa5056081072e3b049c0c2c5.zip
DREAMWEB: implemented openfile
-rw-r--r--engines/dreamweb/dreamweb.cpp13
-rw-r--r--engines/dreamweb/dreamweb.h9
2 files changed, 19 insertions, 3 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 2e4be71bcf..fab9955dcd 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -133,6 +133,15 @@ Common::Error DreamWebEngine::run() {
return Common::kNoError;
}
+void DreamWebEngine::openFile(const Common::String &name) {
+ if (_file.isOpen()) {
+ _file.close();
+ }
+ if (!_file.open(name))
+ error("cannot open file %s", name.c_str());
+}
+
+
} // End of namespace DreamWeb
@@ -194,9 +203,11 @@ void openfile(Context &context) {
uint16 name_ptr = context.dx;
Common::String name;
uint8 c;
- while((c = context.data.byte(name_ptr++)) != 0)
+ while((c = context.cs.byte(name_ptr++)) != 0)
name += (char)c;
debug(1, "opening file: %s", name.c_str());
+ context.cs.word(kHandle) = 1; //only one handle
+ context.flags._c = false;
}
void createfile(Context &context) {
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 96aa61ab50..8669aad5fe 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -26,10 +26,11 @@
#ifndef DREAMWEB_H
#define DREAMWEB_H
-#include "common/scummsys.h"
+#include "common/error.h"
+#include "common/file.h"
#include "common/random.h"
#include "common/rect.h"
-#include "common/error.h"
+#include "common/scummsys.h"
#include "engines/engine.h"
#include "dreamweb/console.h"
@@ -76,10 +77,14 @@ public:
//dreamgen public api:
uint8 randomNumber() { return _rnd.getRandomNumber(255); }
+ void openFile(const Common::String &name);
+
private:
const DreamWebGameDescription *_gameDescription;
Common::RandomSource _rnd;
Common::Point _mouse;
+
+ Common::File _file;
};
} // End of namespace DreamWeb