aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/dreamweb.cpp
diff options
context:
space:
mode:
authoreriktorbjorn2011-06-13 06:10:25 +0200
committerAlyssa Milburn2011-06-15 17:34:39 +0200
commit92a11ea59d36e46a2a0cc0beaeac98310efed433 (patch)
tree4f3833c977a6c9989ba90e81eb12f5f1e4b75f3c /engines/dreamweb/dreamweb.cpp
parentc808844ad6ac37171db1fa56cc0eeb96142a59b1 (diff)
downloadscummvm-rg350-92a11ea59d36e46a2a0cc0beaeac98310efed433.tar.gz
scummvm-rg350-92a11ea59d36e46a2a0cc0beaeac98310efed433.tar.bz2
scummvm-rg350-92a11ea59d36e46a2a0cc0beaeac98310efed433.zip
DREAMWEB: Make new function for getting name of file to open.
Diffstat (limited to 'engines/dreamweb/dreamweb.cpp')
-rw-r--r--engines/dreamweb/dreamweb.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 02e93e1b39..ecab4337c1 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -350,6 +350,15 @@ void DreamWebEngine::cls() {
namespace dreamgen {
+Common::String getFilename(Context &context) {
+ uint16 name_ptr = context.dx;
+ Common::String name;
+ uint8 c;
+ while((c = context.cs.byte(name_ptr++)) != 0)
+ name += (char)c;
+ return name;
+}
+
void multiget(Context &context) {
unsigned w = (uint8)context.cl, h = (uint8)context.ch;
unsigned src = (uint16)context.di + (uint16)context.bx * kScreenwidth;
@@ -479,11 +488,7 @@ void openfilenocheck(Context &context) {
}
void openfile(Context &context) {
- uint16 name_ptr = context.dx;
- Common::String name;
- uint8 c;
- while((c = context.cs.byte(name_ptr++)) != 0)
- name += (char)c;
+ Common::String name = getFilename(context);
debug(1, "opening file: %s", name.c_str());
context.engine->openFile(name);
context.cs.word(kHandle) = 1; //only one handle
@@ -755,12 +760,7 @@ void readoneblock(Context &context) {
void readabyte(Context & context);
void showpcx(Context &context) {
- uint16 name_ptr = context.dx;
- Common::String name;
- uint8 c;
- while((c = context.cs.byte(name_ptr++)) != 0)
- name += (char)c;
-
+ Common::String name = getFilename(context);
Common::File pcxFile;
if (!pcxFile.open(name)) {