aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorBertrand Augereau2011-07-18 22:27:06 +0200
committerBertrand Augereau2011-07-23 18:23:38 +0200
commitf15661f698f5b6fc359febdda0089cc5a70f9e81 (patch)
treed9ab8ef0d75bad9e7f0e64fd460eb4ac5074f214 /engines/dreamweb
parent599fbf4fe6e8fd92105ae2bcdd21e0c2f82005f9 (diff)
downloadscummvm-rg350-f15661f698f5b6fc359febdda0089cc5a70f9e81.tar.gz
scummvm-rg350-f15661f698f5b6fc359febdda0089cc5a70f9e81.tar.bz2
scummvm-rg350-f15661f698f5b6fc359febdda0089cc5a70f9e81.zip
DREAMWEB: 'printchar' ported to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp34
-rw-r--r--engines/dreamweb/dreamgen.h3
-rw-r--r--engines/dreamweb/stubs.cpp40
-rw-r--r--engines/dreamweb/stubs.h4
4 files changed, 39 insertions, 42 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 41dbf9dc3a..5a3bd3b4e3 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -4937,39 +4937,6 @@ realcreditsearly:
data.byte(kLasthardkey) = 0;
}
-void DreamGenContext::printchar() {
- STACK_CHECK;
- _cmp(al, 255);
- if (flags.z())
- return /* (ignoreit) */;
- push(si);
- push(bx);
- push(di);
- _cmp(data.byte(kForeignrelease), 0);
- if (flags.z())
- goto _tmp1;
- _sub(bx, 3);
-_tmp1:
- push(ax);
- _sub(al, 32);
- ah = 0;
- _add(ax, data.word(kCharshift));
- showframe();
- ax = pop();
- di = pop();
- bx = pop();
- si = pop();
- _cmp(data.byte(kKerning), 0);
- if (!flags.z())
- goto nokern;
- kernchars();
-nokern:
- push(cx);
- ch = 0;
- _add(di, cx);
- cx = pop();
-}
-
void DreamGenContext::printslow() {
STACK_CHECK;
data.byte(kPointerframe) = 1;
@@ -21401,7 +21368,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_mode640x480: mode640x480(); break;
case addr_set16colpalette: set16colpalette(); break;
case addr_realcredits: realcredits(); break;
- case addr_printchar: printchar(); break;
case addr_printslow: printslow(); break;
case addr_waitframes: waitframes(); break;
case addr_printboth: printboth(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index c50ee96348..f5513e4297 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -588,7 +588,6 @@ public:
static const uint16 addr_printboth = 0xc30c;
static const uint16 addr_waitframes = 0xc308;
static const uint16 addr_printslow = 0xc304;
- static const uint16 addr_printchar = 0xc2fc;
static const uint16 addr_realcredits = 0xc2f8;
static const uint16 addr_set16colpalette = 0xc2f4;
static const uint16 addr_mode640x480 = 0xc2f0;
@@ -1548,7 +1547,7 @@ public:
void showpcx();
void showdecisions();
void checkspeed();
- void printchar();
+ //void printchar();
void showkeypad();
void obtoinv();
void removeobfrominv();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index fa7ec63a40..43930f48fb 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -271,6 +271,28 @@ void DreamGenContext::getnextword() {
bh = charCount;
}
+void DreamGenContext::printchar() {
+ uint16 x = di;
+ printchar(es, ds, &x, bx, al);
+ di = x;
+}
+
+void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c) {
+ if (c == 255)
+ return;
+ push(si);
+ push(di);
+ if (data.byte(kForeignrelease) != 0)
+ y -= 3;
+ cx = showframeCPP(dst, src, *x, y, c - 32 + data.word(kCharshift), 0);
+ di = pop();
+ si = pop();
+ _cmp(data.byte(kKerning), 0);
+ if (flags.z())
+ kernchars();
+ (*x) += cl;
+}
+
void DreamGenContext::printdirect() {
data.word(kLastxpos) = di;
ds = data.word(kCurrentset);
@@ -278,7 +300,10 @@ void DreamGenContext::printdirect() {
push(bx);
push(di);
push(dx);
- uint8 charCount = getnumber(dl, (bool)(dl & 1));
+ uint16 offset;
+ uint8 charCount = getnumber(dl, (bool)(dl & 1), &offset);
+ di = offset;
+ uint16 x = di;
do {
ax = es.word(si);
++si;
@@ -290,8 +315,8 @@ void DreamGenContext::printdirect() {
}
push(es);
al = engine->modifyChar(al);
- printchar();
- data.word(kLastxpos) = di;
+ printchar(es, ds, &x, bx, al);
+ data.word(kLastxpos) = x;
es = pop();
--charCount;
} while(charCount);
@@ -303,10 +328,12 @@ void DreamGenContext::printdirect() {
}
void DreamGenContext::getnumber() {
- cl = getnumber(dl, (bool)(dl & 1));
+ uint16 offset = di;
+ cl = getnumber(dl, (bool)(dl & 1), &offset);
+ di = offset;
}
-uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered) {
+uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered, uint16* offset) {
uint8 totalWidth = 0;
uint8 charCount = 0;
push(si);
@@ -315,6 +342,7 @@ uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered) {
push(ds);
push(es);
di = si;
+ *offset = di;
while (true) {
uint8 wordTotalWidth, wordCharCount;
uint8 done = getnextword(&wordTotalWidth, &wordCharCount);
@@ -338,6 +366,7 @@ uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered) {
bx = pop();
si = pop();
_add(di, ax);
+ *offset = di;
return charCount;
}
ax = totalWidth + wordTotalWidth - 10;
@@ -354,6 +383,7 @@ uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered) {
bx = pop();
si = pop();
_add(di, ax);
+ *offset = di;
return charCount;
}
totalWidth += wordTotalWidth;
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index ef957344b4..89ef9e92d0 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -38,9 +38,11 @@
void quickquit2();
void getnextword();
uint8 getnextword(uint8 *totalWidth, uint8 *charCount);
+ void printchar();
+ void printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c);
void printdirect();
void getnumber();
- uint8 getnumber(uint16 maxWidth, bool centered);
+ uint8 getnumber(uint16 maxWidth, bool centered, uint16* offset);
void kernchars();
uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width);
Sprite *spritetable();