aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-12-26 20:35:20 +0100
committerWillem Jan Palenstijn2011-12-26 20:46:37 +0100
commitb08804f360d7561ca1014445aa7eeb257297f8ed (patch)
treeb227e3def8c69c744d6bf1a7f3aaebf2adba3fee /engines/dreamweb
parentbd70cd9dff5666d7bcca69960ef4271c519d04f3 (diff)
downloadscummvm-rg350-b08804f360d7561ca1014445aa7eeb257297f8ed.tar.gz
scummvm-rg350-b08804f360d7561ca1014445aa7eeb257297f8ed.tar.bz2
scummvm-rg350-b08804f360d7561ca1014445aa7eeb257297f8ed.zip
DREAMWEB: Convert 'parser'
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreambase.h2
-rw-r--r--engines/dreamweb/dreamgen.cpp39
-rw-r--r--engines/dreamweb/dreamgen.h1
-rw-r--r--engines/dreamweb/monitor.cpp55
-rw-r--r--engines/dreamweb/stubs.cpp6
-rw-r--r--engines/dreamweb/stubs.h1
6 files changed, 54 insertions, 50 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 3fe00ad847..0ee14bbd42 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -177,6 +177,7 @@ public:
void loadNews();
void loadCart();
void showKeys();
+ const char *parser();
// from newplace.cpp
void getUnderCentre();
@@ -590,6 +591,7 @@ public:
void errorMessage1();
void errorMessage2();
void errorMessage3();
+ void decide();
// from talk.cpp
void talk();
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index b44efe9d0e..13067db073 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -148,45 +148,6 @@ notfound:
al = 1;
}
-void DreamGenContext::parser() {
- STACK_CHECK;
- es = cs;
- di = offset_operand1;
- cx = 13;
- al = 0;
- _stosb(cx, true);
- di = offset_operand1;
- al = '=';
- _stosb();
- ds = cs;
- si = 483;
-notspace1:
- _lodsw();
- _cmp(al, 32);
- if (flags.z())
- goto stillspace1;
- _cmp(al, 0);
- if (!flags.z())
- goto notspace1;
- goto finishpars;
-stillspace1:
- _lodsw();
- _cmp(al, 32);
- if (flags.z())
- goto stillspace1;
-copyin1:
- _stosb();
- _lodsw();
- _cmp(al, 0);
- if (flags.z())
- goto finishpars;
- _cmp(al, 32);
- if (!flags.z())
- goto copyin1;
-finishpars:
- di = offset_operand1;
-}
-
void DreamGenContext::__start() {
static const uint8 src[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 6ec194618a..6d2e2eb5af 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -419,7 +419,6 @@ public:
void dirFile();
void dreamweb();
void searchForString();
- void parser();
};
} // End of namespace DreamGen
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index 953d1cb6a1..3b9b96e2b9 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -458,8 +458,11 @@ void DreamGenContext::getKeyAndLogo() {
void DreamGenContext::dirCom() {
randomAccess(30);
- parser();
- if (es.byte(di + 1)) {
+
+ const char *dirname = parser();
+ if (dirname[1]) {
+ es = cs;
+ di = offset_operand1; // cs:operand1 == dirname
dirFile();
return;
}
@@ -479,8 +482,8 @@ void DreamGenContext::read() {
bool foundFile = false;
randomAccess(40);
- parser();
- if (es.byte(di+1) == 0) {
+ const char *name = parser();
+ if (name[1] == 0) {
netError();
return;
}
@@ -552,10 +555,10 @@ void DreamGenContext::read() {
}
void DreamGenContext::signOn() {
- parser();
+ const char *name = parser();
int8 foundIndex = -1;
- Common::String inputLine = (const char *)data.ptr(offset_operand1 + 1, 0);
+ Common::String inputLine = name + 1;
inputLine.trim();
for (byte i = 0; i < 4; i++) {
@@ -623,4 +626,44 @@ void DreamGenContext::searchForFiles(uint16 segment) {
}
}
+const char *DreamBase::parser() {
+ char *output = (char *)data.ptr(offset_operand1, 13);
+
+ memset(output, 0, 13);
+
+ char *p = output;
+ *p++ = '=';
+
+ const char *in = (const char *)data.ptr(kInputline, 0);
+
+ uint8 c;
+
+ // skip command
+ do {
+ c = *in++;
+ in++;
+
+ if (!c)
+ return output;
+ } while (c != 32);
+
+ // skip spaces between command and operand
+ do {
+ c = *in++;
+ in++;
+ } while (c == 32);
+
+ // copy first operand
+ do {
+ *p++ = c;
+ c = *in++;
+ in++;
+ if (!c)
+ return output;
+ } while (c != 32);
+
+ return output;
+}
+
+
} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 55e61101e1..ca98337261 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -3101,7 +3101,7 @@ void DreamGenContext::madmanRun() {
}
-void DreamGenContext::decide() {
+void DreamBase::decide() {
setMode();
loadPalFromIFF();
clearPalette();
@@ -3118,10 +3118,10 @@ void DreamGenContext::decide() {
fadeScreenUp();
data.byte(kGetback) = 0;
- RectWithCallback<DreamGenContext> decideList[] = {
+ RectWithCallback<DreamBase> decideList[] = {
{ kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamBase::newGame },
{ kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn },
- { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld },
+ { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamBase::loadOld },
{ 0,320,0,200,&DreamBase::blank },
{ 0xFFFF,0,0,0,0 }
};
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index bda2be634e..7fa403bbb7 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -107,7 +107,6 @@
void allPointer();
void afterNewRoom();
void madmanRun();
- void decide();
void showGun();
void triggerMessage(uint16 index);
void processTrigger();