aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBertrand Augereau2011-08-15 15:42:09 +0200
committerBertrand Augereau2011-08-15 22:30:16 +0200
commit03e222f37f917d8491e96bbbc17a73151ee11478 (patch)
tree4ef1e005056231fcfe1d0e518cf284acb30cfac4 /engines
parentb0f5e4dfb07062002a52ded364eb02d8fc7f1dc6 (diff)
downloadscummvm-rg350-03e222f37f917d8491e96bbbc17a73151ee11478.tar.gz
scummvm-rg350-03e222f37f917d8491e96bbbc17a73151ee11478.tar.bz2
scummvm-rg350-03e222f37f917d8491e96bbbc17a73151ee11478.zip
DREAMWEB: 'commandwithob' ported to C++
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreamgen.cpp55
-rw-r--r--engines/dreamweb/dreamgen.h3
-rw-r--r--engines/dreamweb/stubs.cpp27
-rw-r--r--engines/dreamweb/stubs.h2
4 files changed, 30 insertions, 57 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 42a6a64fa0..4dfdb7fbfd 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -16962,60 +16962,6 @@ void DreamGenContext::examineobtext() {
commandwithob();
}
-void DreamGenContext::commandwithob() {
- STACK_CHECK;
- push(ax);
- push(ax);
- push(bx);
- push(cx);
- push(dx);
- push(es);
- push(ds);
- push(si);
- push(di);
- deltextline();
- di = pop();
- si = pop();
- ds = pop();
- es = pop();
- dx = pop();
- cx = pop();
- bx = pop();
- ax = pop();
- push(bx);
- ah = 0;
- _add(ax, ax);
- bx = ax;
- es = data.word(kCommandtext);
- ax = es.word(bx);
- _add(ax, (66*2));
- si = ax;
- di = data.word(kTextaddressx);
- bx = data.word(kTextaddressy);
- dl = data.byte(kTextlen);
- al = 0;
- ah = 0;
- printdirect();
- ax = pop();
- di = 5847;
- copyname();
- ax = pop();
- di = data.word(kLastxpos);
- _cmp(al, 0);
- if (flags.z())
- goto noadd;
- _add(di, 5);
-noadd:
- bx = data.word(kTextaddressy);
- es = cs;
- si = 5847;
- dl = data.byte(kTextlen);
- al = 0;
- ah = 0;
- printdirect();
- data.byte(kNewtextline) = 1;
-}
-
void DreamGenContext::commandonly() {
STACK_CHECK;
push(ax);
@@ -19804,7 +19750,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_obname: obname(); break;
case addr_finishedwalking: finishedwalking(); break;
case addr_examineobtext: examineobtext(); break;
- case addr_commandwithob: commandwithob(); break;
case addr_commandonly: commandonly(); break;
case addr_printmessage: printmessage(); break;
case addr_printmessage2: printmessage2(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 9c08a335c9..85802243d2 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -125,7 +125,6 @@ public:
static const uint16 addr_printmessage2 = 0xca30;
static const uint16 addr_printmessage = 0xca2c;
static const uint16 addr_commandonly = 0xca28;
- static const uint16 addr_commandwithob = 0xca24;
static const uint16 addr_examineobtext = 0xca20;
static const uint16 addr_finishedwalking = 0xca1c;
static const uint16 addr_obname = 0xca18;
@@ -2028,7 +2027,7 @@ public:
void isitright();
void businessman();
void switchryanoff();
- void commandwithob();
+ //void commandwithob();
void panelicons1();
void adjustdown();
void withwhat();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index e15bc2aab9..a605bbda91 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1038,4 +1038,31 @@ void DreamGenContext::copyname(uint8 type, uint8 index, uint8 *dst) {
dst[i] = 0;
}
+void DreamGenContext::commandwithob() {
+ commandwithob(al, bh, bl);
+}
+
+void DreamGenContext::commandwithob(uint8 command, uint8 type, uint8 index) {
+ uint8 commandLine[64] = "OBJECT NAME ONE ";
+ deltextline();
+ uint16 commandText = kTextstart + segRef(data.word(kCommandtext)).word(command * 2);
+ uint8 textLen = data.byte(kTextlen);
+ {
+ uint16 y = data.word(kTextaddressy);
+ const uint8 *string = segRef(data.word(kCommandtext)).ptr(commandText, 0);
+ printdirect(&string, data.word(kTextaddressx), &y, textLen, (bool)(textLen & 1));
+ }
+ copyname(type, index, commandLine);
+ uint16 x = data.word(kLastxpos);
+ if (command != 0)
+ x += 5;
+ {
+ uint16 y = data.word(kTextaddressy);
+ const uint8 *string = commandLine;
+ printdirect(&string, x, &y, textLen, (bool)(textLen & 1));
+ }
+ data.byte(kNewtextline) = 1;
+}
+
} /*namespace dreamgen */
+
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 27250b7451..a6cf2c0563 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -124,4 +124,6 @@
const uint8 *findobname(uint8 type, uint8 index);
void copyname();
void copyname(uint8 type, uint8 index, uint8 *dst);
+ void commandwithob();
+ void commandwithob(uint8 command, uint8 type, uint8 index);