diff options
-rw-r--r-- | engines/dreamweb/dreamweb.cpp | 13 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.h | 9 |
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 |