From b728323df751a0aec5aee890cdce52f50796b12a Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Sun, 17 Jul 2011 16:06:19 +0200 Subject: DREAMWEB: 'getnumber' ported to C++ --- engines/dreamweb/dreamgen.cpp | 109 ------------------------------------------ engines/dreamweb/dreamgen.h | 3 +- engines/dreamweb/stubs.cpp | 59 +++++++++++++++++++++++ engines/dreamweb/stubs.h | 2 + 4 files changed, 62 insertions(+), 111 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 3c10ea69d1..1a3b6a2497 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -5233,114 +5233,6 @@ nottrigger2: data.byte(kKerning) = 0; } -void DreamGenContext::getnumber() { - STACK_CHECK; - cx = 0; - push(si); - push(bx); - push(di); - push(ds); - push(es); - di = si; -wordloop: - push(cx); - push(dx); - getnextword(); - dx = pop(); - cx = pop(); - _cmp(al, 1); - if (flags.z()) - goto endoftext; - al = cl; - ah = 0; - push(bx); - bh = 0; - _add(ax, bx); - bx = pop(); - _sub(ax, 10); - dh = 0; - _cmp(ax, dx); - if (!flags.c()) - goto gotoverend; - _add(cl, bl); - _add(ch, bh); - goto wordloop; -gotoverend: - al = dl; - _and(al, 1); - if (flags.z()) - goto notcentre; - push(cx); - al = dl; - _and(al, 0xfe); - ah = 0; - ch = 0; - _sub(ax, cx); - _add(ax, 20); - _shr(ax, 1); - cx = pop(); - es = pop(); - ds = pop(); - di = pop(); - bx = pop(); - si = pop(); - _add(di, ax); - cl = ch; - return; -notcentre: - es = pop(); - ds = pop(); - di = pop(); - bx = pop(); - si = pop(); - cl = ch; - return; -endoftext: - al = cl; - ah = 0; - push(bx); - bh = 0; - _add(ax, bx); - bx = pop(); - _sub(ax, 10); - dh = 0; - _cmp(ax, dx); - if (!flags.c()) - goto gotoverend2; - _add(cl, bl); - _add(ch, bh); -gotoverend2: - al = dl; - _and(al, 1); - if (flags.z()) - goto notcent2; - push(cx); - al = dl; - _and(al, 0xfe); - _add(al, 2); - ah = 0; - ch = 0; - _add(ax, 20); - _sub(ax, cx); - _shr(ax, 1); - cx = pop(); - es = pop(); - ds = pop(); - di = pop(); - bx = pop(); - si = pop(); - _add(di, ax); - cl = ch; - return; -notcent2: - es = pop(); - ds = pop(); - di = pop(); - bx = pop(); - si = pop(); - cl = ch; -} - void DreamGenContext::fillryan() { STACK_CHECK; es = data.word(kBuffers); @@ -21554,7 +21446,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_printboth: printboth(); break; case addr_printdirect: printdirect(); break; case addr_monprint: monprint(); break; - case addr_getnumber: getnumber(); break; case addr_fillryan: fillryan(); break; case addr_fillopen: fillopen(); break; case addr_findallryan: findallryan(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 88ecfd53d4..782f4845fc 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -584,7 +584,6 @@ public: static const uint16 addr_findallryan = 0xc328; static const uint16 addr_fillopen = 0xc324; static const uint16 addr_fillryan = 0xc320; - static const uint16 addr_getnumber = 0xc318; static const uint16 addr_monprint = 0xc314; static const uint16 addr_printdirect = 0xc310; static const uint16 addr_printboth = 0xc30c; @@ -1535,7 +1534,7 @@ public: //void printsprites(); void checkifperson(); void showallobs(); - void getnumber(); + //void getnumber(); void adjustleft(); void calledenslift(); void useclearbox(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index cd5350823a..b68f7e67df 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -271,6 +271,65 @@ void DreamGenContext::getnextword() { bh = charCount; } +void DreamGenContext::getnumber() { + cl = getnumber(dl, (bool)(dl & 1)); +} + +uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered) { + uint8 totalWidth = 0; + uint8 charCount = 0; + push(si); + push(bx); + push(di); + push(ds); + push(es); + di = si; + while (true) { + uint8 wordTotalWidth, wordCharCount; + uint8 done = getnextword(&wordTotalWidth, &wordCharCount); + + if (done == 1) { //endoftext + ax = totalWidth + wordTotalWidth - 10; + if (ax < maxWidth) { + totalWidth += wordTotalWidth; + charCount += wordCharCount; + } + + if (centered) { + ax = (maxWidth & 0xfe) + 2 + 20 - totalWidth; + ax /= 2; + } else { + ax = 0; + } + es = pop(); + ds = pop(); + di = pop(); + bx = pop(); + si = pop(); + _add(di, ax); + return charCount; + } + ax = totalWidth + wordTotalWidth - 10; + if (ax >= maxWidth) { //gotoverend + if (centered) { + ax = (maxWidth & 0xfe) - totalWidth + 20; + ax /= 2; + } else { + ax = 0; + } + es = pop(); + ds = pop(); + di = pop(); + bx = pop(); + si = pop(); + _add(di, ax); + return charCount; + } + totalWidth += wordTotalWidth; + charCount += wordCharCount; + } +} + uint8 DreamGenContext::kernchars(uint8 firstChar, uint8 secondChar, uint8 width) { if ((firstChar == 'a') || (al == 'u')) { if ((secondChar == 'n') || (secondChar == 't') || (secondChar == 'r') || (secondChar == 'i') || (secondChar == 'l')) diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 6d9c08dd2d..b882172b4c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -38,6 +38,8 @@ void quickquit2(); void getnextword(); uint8 getnextword(uint8 *totalWidth, uint8 *charCount); + void getnumber(); + uint8 getnumber(uint16 maxWidth, bool centered); void kernchars(); uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width); Sprite *spritetable(); -- cgit v1.2.3 From 599fbf4fe6e8fd92105ae2bcdd21e0c2f82005f9 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Mon, 18 Jul 2011 14:30:07 +0200 Subject: DREAMWEB: 'printdirect' ported to C++ --- engines/dreamweb/dreamgen.cpp | 40 ---------------------------------------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/stubs.cpp | 31 +++++++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 33 insertions(+), 42 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 1a3b6a2497..41dbf9dc3a 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -5108,45 +5108,6 @@ void DreamGenContext::printboth() { ax = pop(); } -void DreamGenContext::printdirect() { - STACK_CHECK; - data.word(kLastxpos) = di; - ds = data.word(kCurrentset); -printloop6: - push(bx); - push(di); - push(dx); - getnumber(); - ch = 0; -printloop5: - ax = es.word(si); - _inc(si); - _cmp(al, 0); - if (flags.z()) - goto finishdirct; - _cmp(al, ':'); - if (flags.z()) - goto finishdirct; - push(cx); - push(es); - modifychar(); - printchar(); - data.word(kLastxpos) = di; - es = pop(); - cx = pop(); - if (--cx) - goto printloop5; - dx = pop(); - di = pop(); - bx = pop(); - _add(bx, data.word(kLinespacing)); - goto printloop6; -finishdirct: - dx = pop(); - di = pop(); - bx = pop(); -} - void DreamGenContext::monprint() { STACK_CHECK; data.byte(kKerning) = 1; @@ -21444,7 +21405,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_printslow: printslow(); break; case addr_waitframes: waitframes(); break; case addr_printboth: printboth(); break; - case addr_printdirect: printdirect(); break; case addr_monprint: monprint(); break; case addr_fillryan: fillryan(); break; case addr_fillopen: fillopen(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 782f4845fc..c50ee96348 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -585,7 +585,6 @@ public: static const uint16 addr_fillopen = 0xc324; static const uint16 addr_fillryan = 0xc320; static const uint16 addr_monprint = 0xc314; - static const uint16 addr_printdirect = 0xc310; static const uint16 addr_printboth = 0xc30c; static const uint16 addr_waitframes = 0xc308; static const uint16 addr_printslow = 0xc304; @@ -1566,7 +1565,7 @@ public: //void spriteupdate(); void usetempcharset(); void discops(); - void printdirect(); + //void printdirect(); void delthisone(); void makebackob(); void middlepanel(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index b68f7e67df..fa7ec63a40 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -271,6 +271,37 @@ void DreamGenContext::getnextword() { bh = charCount; } +void DreamGenContext::printdirect() { + data.word(kLastxpos) = di; + ds = data.word(kCurrentset); + while (true) { + push(bx); + push(di); + push(dx); + uint8 charCount = getnumber(dl, (bool)(dl & 1)); + do { + ax = es.word(si); + ++si; + if ((al == 0) || (al == ':')) { + dx = pop(); + di = pop(); + bx = pop(); + return; + } + push(es); + al = engine->modifyChar(al); + printchar(); + data.word(kLastxpos) = di; + es = pop(); + --charCount; + } while(charCount); + dx = pop(); + di = pop(); + bx = pop(); + bx += data.word(kLinespacing); + } +} + void DreamGenContext::getnumber() { cl = getnumber(dl, (bool)(dl & 1)); } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b882172b4c..ef957344b4 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -38,6 +38,7 @@ void quickquit2(); void getnextword(); uint8 getnextword(uint8 *totalWidth, uint8 *charCount); + void printdirect(); void getnumber(); uint8 getnumber(uint16 maxWidth, bool centered); void kernchars(); -- cgit v1.2.3 From f15661f698f5b6fc359febdda0089cc5a70f9e81 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Mon, 18 Jul 2011 22:27:06 +0200 Subject: DREAMWEB: 'printchar' ported to C++ --- engines/dreamweb/dreamgen.cpp | 34 ---------------------------------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/stubs.cpp | 40 +++++++++++++++++++++++++++++++++++----- engines/dreamweb/stubs.h | 4 +++- 4 files changed, 39 insertions(+), 42 deletions(-) (limited to 'engines') 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(); -- cgit v1.2.3 From 96221b574243fcf6eedf856e1ee3f117ee196a8e Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Tue, 19 Jul 2011 08:57:10 +0200 Subject: DREAMWEB: Less registers, more params, in the text printing subsystem --- engines/dreamweb/stubs.cpp | 16 +++++++++------- engines/dreamweb/stubs.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 43930f48fb..c1b5fe11e9 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -239,12 +239,12 @@ void DreamGenContext::setmouse() { data.word(kOldpointerx) = 0xffff; } -uint8 DreamGenContext::getnextword(uint8 *totalWidth, uint8 *charCount) { +uint8 DreamGenContext::getnextword(const uint8 *string, uint8 *totalWidth, uint8 *charCount) { *totalWidth = 0; *charCount = 0; while(true) { - uint8 firstChar = es.byte(di); - ++di; + uint8 firstChar = *string; + ++string; ++*charCount; if ((firstChar == ':') || (firstChar == 0)) { //endall *totalWidth += 6; @@ -256,7 +256,7 @@ uint8 DreamGenContext::getnextword(uint8 *totalWidth, uint8 *charCount) { } firstChar = engine->modifyChar(firstChar); if (firstChar != 255) { - uint8 secondChar = es.byte(di); + uint8 secondChar = *string; uint8 width = ds.byte(6*(firstChar - 32 + data.word(kCharshift))); width = kernchars(firstChar, secondChar, width); *totalWidth += width; @@ -266,9 +266,10 @@ uint8 DreamGenContext::getnextword(uint8 *totalWidth, uint8 *charCount) { void DreamGenContext::getnextword() { uint8 totalWidth, charCount; - al = getnextword(&totalWidth, &charCount); + al = getnextword(es.ptr(di, 0), &totalWidth, &charCount); bl = totalWidth; - bh = charCount; + bh = charCount; + di += charCount; } void DreamGenContext::printchar() { @@ -345,7 +346,8 @@ uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered, uint16* offset) *offset = di; while (true) { uint8 wordTotalWidth, wordCharCount; - uint8 done = getnextword(&wordTotalWidth, &wordCharCount); + uint8 done = getnextword(es.ptr(di, 0), &wordTotalWidth, &wordCharCount); + di += wordCharCount; if (done == 1) { //endoftext ax = totalWidth + wordTotalWidth - 10; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 89ef9e92d0..ca213b39e4 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -37,7 +37,7 @@ void randomnumber(); void quickquit2(); void getnextword(); - uint8 getnextword(uint8 *totalWidth, uint8 *charCount); + uint8 getnextword(const uint8 *string, uint8 *totalWidth, uint8 *charCount); void printchar(); void printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c); void printdirect(); -- cgit v1.2.3 From d0f917d8571c3945b33dbd7a84bf3e0b33ce9715 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Tue, 19 Jul 2011 12:37:32 +0200 Subject: DREAMWEB: 'printslow' ported to C++ --- engines/dreamweb/dreamgen.cpp | 102 ------------------------------------------ engines/dreamweb/dreamgen.h | 3 +- engines/dreamweb/stubs.cpp | 88 ++++++++++++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 90 insertions(+), 104 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 5a3bd3b4e3..755344f230 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -4937,107 +4937,6 @@ realcreditsearly: data.byte(kLasthardkey) = 0; } -void DreamGenContext::printslow() { - STACK_CHECK; - data.byte(kPointerframe) = 1; - data.byte(kPointermode) = 3; - ds = data.word(kCharset1); -printloopslow6: - push(bx); - push(di); - push(dx); - getnumber(); - ch = 0; -printloopslow5: - push(cx); - push(si); - push(es); - ax = es.word(si); - push(bx); - push(cx); - push(es); - push(si); - push(ds); - modifychar(); - printboth(); - ds = pop(); - si = pop(); - es = pop(); - cx = pop(); - bx = pop(); - ax = es.word(si+1); - _inc(si); - _cmp(al, 0); - if (flags.z()) - goto finishslow; - _cmp(al, ':'); - if (flags.z()) - goto finishslow; - _cmp(cl, 1); - if (flags.z()) - goto afterslow; - push(di); - push(ds); - push(bx); - push(cx); - push(es); - push(si); - modifychar(); - data.word(kCharshift) = 91; - printboth(); - data.word(kCharshift) = 0; - si = pop(); - es = pop(); - cx = pop(); - bx = pop(); - ds = pop(); - di = pop(); - waitframes(); - _cmp(ax, 0); - if (flags.z()) - goto keepgoing; - _cmp(ax, data.word(kOldbutton)); - if (!flags.z()) - goto finishslow2; -keepgoing: - waitframes(); - _cmp(ax, 0); - if (flags.z()) - goto afterslow; - _cmp(ax, data.word(kOldbutton)); - if (!flags.z()) - goto finishslow2; -afterslow: - es = pop(); - si = pop(); - cx = pop(); - _inc(si); - if (--cx) - goto printloopslow5; - dx = pop(); - di = pop(); - bx = pop(); - _add(bx, 10); - goto printloopslow6; -finishslow: - es = pop(); - si = pop(); - cx = pop(); - dx = pop(); - di = pop(); - bx = pop(); - al = 0; - return; -finishslow2: - es = pop(); - si = pop(); - cx = pop(); - dx = pop(); - di = pop(); - bx = pop(); - al = 1; -} - void DreamGenContext::waitframes() { STACK_CHECK; push(di); @@ -21368,7 +21267,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_mode640x480: mode640x480(); break; case addr_set16colpalette: set16colpalette(); break; case addr_realcredits: realcredits(); break; - case addr_printslow: printslow(); break; case addr_waitframes: waitframes(); break; case addr_printboth: printboth(); break; case addr_monprint: monprint(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f5513e4297..b52afaeab7 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -587,7 +587,6 @@ public: static const uint16 addr_monprint = 0xc314; static const uint16 addr_printboth = 0xc30c; static const uint16 addr_waitframes = 0xc308; - static const uint16 addr_printslow = 0xc304; static const uint16 addr_realcredits = 0xc2f8; static const uint16 addr_set16colpalette = 0xc2f4; static const uint16 addr_mode640x480 = 0xc2f0; @@ -1485,7 +1484,7 @@ public: void turnonpower(); void manasleep2(); void moretalk(); - void printslow(); + //void printslow(); void loadroom(); void starttalk(); void delchar(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c1b5fe11e9..9780f1eddf 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -294,6 +294,94 @@ void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uin (*x) += cl; } +void DreamGenContext::printslow() { + data.byte(kPointerframe) = 1; + data.byte(kPointermode) = 3; + ds = data.word(kCharset1); + do { + push(bx); + push(di); + push(dx); + uint16 offset = di; + cx = getnumber(dl, (bool)(dl & 1), &offset); + di = offset; + do { + push(cx); + push(si); + push(es); + ax = es.word(si); + push(bx); + push(cx); + push(es); + push(si); + push(ds); + al = engine->modifyChar(al); + printboth(); + ds = pop(); + si = pop(); + es = pop(); + cx = pop(); + bx = pop(); + ax = es.word(si+1); + _inc(si); + if ((al == 0) || (al == ':')) { + es = pop(); + si = pop(); + cx = pop(); + dx = pop(); + di = pop(); + bx = pop(); + al = 0; + return; + } + _cmp(cl, 1); + if (flags.z()) + goto afterslow; + push(di); + push(ds); + push(bx); + push(cx); + push(es); + push(si); + al = engine->modifyChar(al); + data.word(kCharshift) = 91; + printboth(); + data.word(kCharshift) = 0; + si = pop(); + es = pop(); + cx = pop(); + bx = pop(); + ds = pop(); + di = pop(); + for (int i=0; i<2; ++i) { + waitframes(); + if (ax == 0) + continue; + if (ax != data.word(kOldbutton)) { + es = pop(); + si = pop(); + cx = pop(); + dx = pop(); + di = pop(); + bx = pop(); + al = 1; + return; + } + } + afterslow: + es = pop(); + si = pop(); + cx = pop(); + _inc(si); + --cx; + } while (cx); + dx = pop(); + di = pop(); + bx = pop(); + _add(bx, 10); + } while (true); +} + void DreamGenContext::printdirect() { data.word(kLastxpos) = di; ds = data.word(kCurrentset); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ca213b39e4..e580598a37 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -41,6 +41,7 @@ void printchar(); void printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c); void printdirect(); + void printslow(); void getnumber(); uint8 getnumber(uint16 maxWidth, bool centered, uint16* offset); void kernchars(); -- cgit v1.2.3 From 7f45c6fec9e33ce1df33c7266f4e3caa7985ef11 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Tue, 19 Jul 2011 16:45:48 +0200 Subject: DREAMWEB: 'multidump' has a nicer signature --- engines/dreamweb/stubs.cpp | 13 ++++++++----- engines/dreamweb/stubs.h | 9 +++++---- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 9780f1eddf..c3622fe11d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -78,14 +78,17 @@ void DreamGenContext::multiput() { cx = 0; } -void DreamGenContext::multidump() { +void DreamGenContext::multidump(uint16 x, uint16 y, uint8 width, uint8 height) { ds = data.word(kWorkspace); - int w = (uint8)cl, h = (uint8)ch; - int x = (int16)di, y = (int16)bx; unsigned offset = x + y * kScreenwidth; //debug(1, "multidump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)ds, x, y, offset); - engine->blit(ds.ptr(offset, w * h), kScreenwidth, x, y, w, h); - si = di = offset + h * kScreenwidth; + engine->blit(ds.ptr(offset, width * height), kScreenwidth, x, y, width, height); +} + +void DreamGenContext::multidump() { + multidump(di, bx, cl, ch); + unsigned offset = di + bx * kScreenwidth; + si = di = offset + ch * kScreenwidth; cx = 0; } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index e580598a37..0d364e1437 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -21,10 +21,11 @@ */ void multidump(); - void frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void multidump(uint16 x, uint16 y, uint8 width, uint8 height); + void frameoutv(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameoutnm(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameoutbh(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameoutfx(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); void worktoscreen(); void multiget(); void convertkey(); -- cgit v1.2.3 From ac29c2a64db12be6c38d76b763a4503bd1296eb3 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Wed, 20 Jul 2011 20:58:03 +0200 Subject: DREAMWEB: 'printboth' ported to C++ --- engines/dreamweb/dreamgen.cpp | 18 ------------------ engines/dreamweb/dreamgen.h | 9 ++++----- engines/dreamweb/stubs.cpp | 31 ++++++++++++++++++++++++++++--- engines/dreamweb/stubs.h | 4 +++- 4 files changed, 35 insertions(+), 27 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 755344f230..216679efc3 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -4957,23 +4957,6 @@ void DreamGenContext::waitframes() { di = pop(); } -void DreamGenContext::printboth() { - STACK_CHECK; - push(ax); - push(cx); - push(bx); - push(di); - printchar(); - ax = pop(); - push(di); - di = ax; - multidump(); - di = pop(); - bx = pop(); - cx = pop(); - ax = pop(); -} - void DreamGenContext::monprint() { STACK_CHECK; data.byte(kKerning) = 1; @@ -21268,7 +21251,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_set16colpalette: set16colpalette(); break; case addr_realcredits: realcredits(); break; case addr_waitframes: waitframes(); break; - case addr_printboth: printboth(); break; case addr_monprint: monprint(); break; case addr_fillryan: fillryan(); break; case addr_fillopen: fillopen(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b52afaeab7..c6b9bedb92 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -585,7 +585,6 @@ public: static const uint16 addr_fillopen = 0xc324; static const uint16 addr_fillryan = 0xc320; static const uint16 addr_monprint = 0xc314; - static const uint16 addr_printboth = 0xc30c; static const uint16 addr_waitframes = 0xc308; static const uint16 addr_realcredits = 0xc2f8; static const uint16 addr_set16colpalette = 0xc2f4; @@ -1343,6 +1342,7 @@ public: void clearbuffers(); void neterror(); void storeit(); + void lockeddoorway(); void isitworn(); void putundertimed(); void dumpmap(); @@ -1698,8 +1698,9 @@ public: void showmonk(); void diarykeyn(); void set16colpalette(); - void sparky(); + void convicons(); void interviewer(); + void sparky(); void purgeanitem(); void madman(); void createpanel(); @@ -1886,7 +1887,7 @@ public: void turnanypathon(); void restorereels(); void setwalk(); - void printboth(); + //void printboth(); void useroutine(); void zoomicon(); void hotelcontrol(); @@ -1995,14 +1996,12 @@ public: void usechurchgate(); void monkandryan(); void allocatebuffers(); - void convicons(); void swapwithinv(); void usecontrol(); void buttonseven(); void redrawmainscrn(); void finishedwalking(); void findallryan(); - void lockeddoorway(); void channel0tran(); void buttonpress(); void parseblaster(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c3622fe11d..fe2d0bce93 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -242,6 +242,25 @@ void DreamGenContext::setmouse() { data.word(kOldpointerx) = 0xffff; } +void DreamGenContext::printboth() { + printboth(es, ds, di, bx, al); +} + +void DreamGenContext::printboth(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 c) { + push(ax); + push(cx); + push(bx); + uint16 newX = x; + uint8 width, height; + printchar(dst, src, &newX, y, c, &width, &height); + multidump(x, y, width, height); + si = x + (y + height) * kScreenwidth; + di = newX; + bx = pop(); + cx = pop(); + ax = pop(); +} + uint8 DreamGenContext::getnextword(const uint8 *string, uint8 *totalWidth, uint8 *charCount) { *totalWidth = 0; *charCount = 0; @@ -277,11 +296,14 @@ void DreamGenContext::getnextword() { void DreamGenContext::printchar() { uint16 x = di; - printchar(es, ds, &x, bx, al); + uint8 width, height; + printchar(es, ds, &x, bx, al, &width, &height); di = x; + cl = width; + ch = height; } -void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c) { +void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c, uint8 *width, uint8 *height) { if (c == 255) return; push(si); @@ -295,6 +317,8 @@ void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uin if (flags.z()) kernchars(); (*x) += cl; + *width = cl; + *height = ch; } void DreamGenContext::printslow() { @@ -407,7 +431,8 @@ void DreamGenContext::printdirect() { } push(es); al = engine->modifyChar(al); - printchar(es, ds, &x, bx, al); + uint8 width, height; + printchar(es, ds, &x, bx, al, &width, &height); data.word(kLastxpos) = x; es = pop(); --charCount; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0d364e1437..9ba4fdf692 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -39,8 +39,10 @@ void quickquit2(); void getnextword(); uint8 getnextword(const uint8 *string, uint8 *totalWidth, uint8 *charCount); + void printboth(); + void printboth(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 c); void printchar(); - void printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c); + void printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c, uint8 *width, uint8 *height); void printdirect(); void printslow(); void getnumber(); -- cgit v1.2.3 From 183515787d6968c618c6209478c3b009a8ea9f87 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Wed, 20 Jul 2011 21:41:52 +0200 Subject: DREAMWEB: Fix code formatting --- engines/dreamweb/stubs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 9ba4fdf692..3f1a2a6210 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -22,10 +22,10 @@ void multidump(); void multidump(uint16 x, uint16 y, uint8 width, uint8 height); - void frameoutv(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void frameoutnm(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void frameoutbh(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void frameoutfx(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); void worktoscreen(); void multiget(); void convertkey(); -- cgit v1.2.3 From 8a5c2f9dc307e3338ac1e8e379517bcf85139db8 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Wed, 20 Jul 2011 21:50:19 +0200 Subject: DREAMWEB: Cleaning of 'showframe' --- engines/dreamweb/stubs.cpp | 46 ++++++++++++++++++++++++---------------------- engines/dreamweb/stubs.h | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index fe2d0bce93..36fda90fb6 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -310,15 +310,13 @@ void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uin push(di); if (data.byte(kForeignrelease) != 0) y -= 3; - cx = showframeCPP(dst, src, *x, y, c - 32 + data.word(kCharshift), 0); + showframe(dst, src, *x, y, c - 32 + data.word(kCharshift), 0, width, height); di = pop(); si = pop(); _cmp(data.byte(kKerning), 0); if (flags.z()) kernchars(); - (*x) += cl; - *width = cl; - *height = ch; + (*x) += *width; } void DreamGenContext::printslow() { @@ -915,7 +913,7 @@ Sprite *DreamGenContext::spritetable() { return sprite; } -uint16 DreamGenContext::showframeCPP(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 frameNumber, uint8 effectsFlag) { +void DreamGenContext::showframe(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { es = dst; ds = src; di = x; @@ -925,7 +923,9 @@ uint16 DreamGenContext::showframeCPP(uint16 dst, uint16 src, uint16 x, uint16 y, si = (ax & 0x1ff) * 6; if (ds.word(si) == 0) { - return 0; + *width = 0; + *height = 0; + return; } //notblankshow: @@ -935,19 +935,18 @@ uint16 DreamGenContext::showframeCPP(uint16 dst, uint16 src, uint16 x, uint16 y, } //skipoffsets: cx = ds.word(si + 0); - uint8 width = cl; - uint8 height = ch; - uint16 written = cx; + *width = cl; + *height = ch; si = ds.word(si+2) + 2080; if (effectsFlag) { if (effectsFlag & 128) { //centred - di -= width / 2; - bx -= height / 2; + di -= *width / 2; + bx -= *height / 2; } if (effectsFlag & 64) { //diffdest - frameoutfx(es.ptr(0, dx * height), ds.ptr(si, width * height), dx, width, height, di, bx); - return written; + frameoutfx(es.ptr(0, dx * *height), ds.ptr(si, *width * *height), dx, *width, *height, di, bx); + return; } if (effectsFlag & 8) { //printlist push(ax); @@ -961,28 +960,31 @@ uint16 DreamGenContext::showframeCPP(uint16 dst, uint16 src, uint16 x, uint16 y, } if (effectsFlag & 4) { //flippedx es = data.word(kWorkspace); - frameoutfx(es.ptr(0, 320 * height), ds.ptr(si, width * height), 320, width, height, di, bx); - return written; + frameoutfx(es.ptr(0, 320 * *height), ds.ptr(si, *width * *height), 320, *width, *height, di, bx); + return; } if (effectsFlag & 2) { //nomask es = data.word(kWorkspace); - frameoutnm(es.ptr(0, 320 * height), ds.ptr(si, width * height), 320, width, height, di, bx); - return written; + frameoutnm(es.ptr(0, 320 * *height), ds.ptr(si, *width * *height), 320, *width, *height, di, bx); + return; } if (effectsFlag & 32) { es = data.word(kWorkspace); - frameoutbh(es.ptr(0, 320 * height), ds.ptr(si, width * height), 320, width, height, di, bx); - return written; + frameoutbh(es.ptr(0, 320 * *height), ds.ptr(si, *width * *height), 320, *width, *height, di, bx); + return; } } //noeffects: es = data.word(kWorkspace); - frameoutv(es.ptr(0, 65536), ds.ptr(si, width * height), 320, width, height, di, bx); - return written; + frameoutv(es.ptr(0, 65536), ds.ptr(si, *width * *height), 320, *width, *height, di, bx); + return; } void DreamGenContext::showframe() { - cx = showframeCPP(es, ds, di, bx, al, ah); + uint8 width, height; + showframe(es, ds, di, bx, al, ah, &width, &height); + cl = width; + ch = height; } void DreamGenContext::printsprites() { diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 3f1a2a6210..557aff7dfc 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -51,7 +51,7 @@ uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width); Sprite *spritetable(); void showframe(); - uint16 showframeCPP(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 frameNumber, uint8 effectsFlag); + void showframe(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); void printasprite(const Sprite *sprite); void width160(); void multiput(); -- cgit v1.2.3 From 3d518d3d2c16e8b5b2a15978f967572b11aac861 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Wed, 20 Jul 2011 21:58:14 +0200 Subject: DREAMWEB: Cleaning of 'printasprite' --- engines/dreamweb/stubs.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 36fda90fb6..8eeece4edd 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1021,10 +1021,15 @@ void DreamGenContext::printasprite(const Sprite *sprite) { di = ax + data.word(kMapadx); } - ax = sprite->b15; + uint8 c; if (sprite->b29 != 0) - ah = 8; - showframe(); + c = 8; + else + c = 0; + uint8 width, height; + showframe(es, ds, di, bx, sprite->b15, c, &width, &height); + cl = width; + ch = height; bx = pop(); es = pop(); -- cgit v1.2.3 From 6d926d830e832f61c63a51665089b83ec7bd6277 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Wed, 20 Jul 2011 22:30:39 +0200 Subject: DREAMWEB: Cleaning in 'printslow' --- engines/dreamweb/stubs.cpp | 94 +++++++++++++++++++++++----------------------- engines/dreamweb/stubs.h | 5 ++- 2 files changed, 50 insertions(+), 49 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 8eeece4edd..77f25903d1 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -243,19 +243,22 @@ void DreamGenContext::setmouse() { } void DreamGenContext::printboth() { - printboth(es, ds, di, bx, al); + uint16 x = di; + printboth(es, ds, &x, bx, al); + di = x; } -void DreamGenContext::printboth(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 c) { +void DreamGenContext::printboth(uint16 dst, uint16 src, uint16 *x, uint16 y, uint8 c) { push(ax); push(cx); push(bx); - uint16 newX = x; + uint16 newX = *x; uint8 width, height; printchar(dst, src, &newX, y, c, &width, &height); - multidump(x, y, width, height); - si = x + (y + height) * kScreenwidth; + multidump(*x, y, width, height); + si = *x + (y + height) * kScreenwidth; di = newX; + *x = newX; bx = pop(); cx = pop(); ax = pop(); @@ -320,16 +323,18 @@ void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uin } void DreamGenContext::printslow() { + al = printslow(di, bx); +} + +uint8 DreamGenContext::printslow(uint16 x, uint16 y) { data.byte(kPointerframe) = 1; data.byte(kPointermode) = 3; ds = data.word(kCharset1); do { - push(bx); push(di); push(dx); - uint16 offset = di; + uint16 offset = x; cx = getnumber(dl, (bool)(dl & 1), &offset); - di = offset; do { push(cx); push(si); @@ -341,7 +346,7 @@ void DreamGenContext::printslow() { push(si); push(ds); al = engine->modifyChar(al); - printboth(); + printboth(es, ds, &offset, y, al); ds = pop(); si = pop(); es = pop(); @@ -355,45 +360,41 @@ void DreamGenContext::printslow() { cx = pop(); dx = pop(); di = pop(); - bx = pop(); - al = 0; - return; + return 0; } - _cmp(cl, 1); - if (flags.z()) - goto afterslow; - push(di); - push(ds); - push(bx); - push(cx); - push(es); - push(si); - al = engine->modifyChar(al); - data.word(kCharshift) = 91; - printboth(); - data.word(kCharshift) = 0; - si = pop(); - es = pop(); - cx = pop(); - bx = pop(); - ds = pop(); - di = pop(); - for (int i=0; i<2; ++i) { - waitframes(); - if (ax == 0) - continue; - if (ax != data.word(kOldbutton)) { - es = pop(); - si = pop(); - cx = pop(); - dx = pop(); - di = pop(); - bx = pop(); - al = 1; - return; + if (cl != 1) { + push(di); + push(ds); + push(bx); + push(cx); + push(es); + push(si); + al = engine->modifyChar(al); + data.word(kCharshift) = 91; + uint16 offset2 = offset; + printboth(es, ds, &offset2, y, al); + data.word(kCharshift) = 0; + si = pop(); + es = pop(); + cx = pop(); + bx = pop(); + ds = pop(); + di = pop(); + for (int i=0; i<2; ++i) { + waitframes(); + if (ax == 0) + continue; + if (ax != data.word(kOldbutton)) { + es = pop(); + si = pop(); + cx = pop(); + dx = pop(); + di = pop(); + return 1; + } } } - afterslow: + es = pop(); si = pop(); cx = pop(); @@ -402,8 +403,7 @@ void DreamGenContext::printslow() { } while (cx); dx = pop(); di = pop(); - bx = pop(); - _add(bx, 10); + y += 10; } while (true); } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 557aff7dfc..64391f5979 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -40,10 +40,11 @@ void getnextword(); uint8 getnextword(const uint8 *string, uint8 *totalWidth, uint8 *charCount); void printboth(); - void printboth(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 c); + void printboth(uint16 dst, uint16 src, uint16 *x, uint16 y, uint8 c); void printchar(); - void printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c, uint8 *width, uint8 *height); + void printchar(uint16 dst, uint16 src, uint16 *x, uint16 y, uint8 c, uint8 *width, uint8 *height); void printdirect(); + uint8 printslow(uint16 x, uint16 y); void printslow(); void getnumber(); uint8 getnumber(uint16 maxWidth, bool centered, uint16* offset); -- cgit v1.2.3 From 2e0e2b2687c10635c0b0237e85ac72a6b69fe795 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Thu, 21 Jul 2011 09:01:33 +0200 Subject: DREAMWEB: Useless register shuffling in printboth --- engines/dreamweb/stubs.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 77f25903d1..99f10c8ed1 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -249,19 +249,11 @@ void DreamGenContext::printboth() { } void DreamGenContext::printboth(uint16 dst, uint16 src, uint16 *x, uint16 y, uint8 c) { - push(ax); - push(cx); - push(bx); uint16 newX = *x; uint8 width, height; printchar(dst, src, &newX, y, c, &width, &height); multidump(*x, y, width, height); - si = *x + (y + height) * kScreenwidth; - di = newX; *x = newX; - bx = pop(); - cx = pop(); - ax = pop(); } uint8 DreamGenContext::getnextword(const uint8 *string, uint8 *totalWidth, uint8 *charCount) { -- cgit v1.2.3 From c4f9afaa023889f2f8cab2a79874aca3b6f6bba3 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Thu, 21 Jul 2011 09:08:52 +0200 Subject: DREAMWEB: Less register usage in 'printslow' --- engines/dreamweb/stubs.cpp | 48 +++++++++++++++------------------------------- engines/dreamweb/stubs.h | 2 +- 2 files changed, 16 insertions(+), 34 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 99f10c8ed1..9cc6098f79 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -315,61 +315,47 @@ void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uin } void DreamGenContext::printslow() { - al = printslow(di, bx); + al = printslow(di, bx, dl, (bool)(dl & 1)); } -uint8 DreamGenContext::printslow(uint16 x, uint16 y) { +uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool centered) { data.byte(kPointerframe) = 1; data.byte(kPointermode) = 3; ds = data.word(kCharset1); do { push(di); - push(dx); uint16 offset = x; - cx = getnumber(dl, (bool)(dl & 1), &offset); + uint16 charCount = getnumber(maxWidth, centered, &offset); do { - push(cx); push(si); push(es); - ax = es.word(si); - push(bx); - push(cx); + uint8 c0 = es.byte(si); push(es); - push(si); push(ds); - al = engine->modifyChar(al); - printboth(es, ds, &offset, y, al); + c0 = engine->modifyChar(c0); + printboth(es, ds, &offset, y, c0); ds = pop(); - si = pop(); es = pop(); - cx = pop(); - bx = pop(); - ax = es.word(si+1); - _inc(si); - if ((al == 0) || (al == ':')) { + uint8 c1 = es.byte(si+1); + ++si; + if ((c1 == 0) || (c1 == ':')) { es = pop(); si = pop(); - cx = pop(); - dx = pop(); di = pop(); return 0; } - if (cl != 1) { + if (charCount != 1) { push(di); push(ds); - push(bx); push(cx); push(es); - push(si); - al = engine->modifyChar(al); + c1 = engine->modifyChar(c1); data.word(kCharshift) = 91; uint16 offset2 = offset; - printboth(es, ds, &offset2, y, al); + printboth(es, ds, &offset2, y, c1); data.word(kCharshift) = 0; - si = pop(); es = pop(); cx = pop(); - bx = pop(); ds = pop(); di = pop(); for (int i=0; i<2; ++i) { @@ -379,8 +365,6 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y) { if (ax != data.word(kOldbutton)) { es = pop(); si = pop(); - cx = pop(); - dx = pop(); di = pop(); return 1; } @@ -389,11 +373,9 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y) { es = pop(); si = pop(); - cx = pop(); - _inc(si); - --cx; - } while (cx); - dx = pop(); + ++si; + --charCount; + } while (charCount); di = pop(); y += 10; } while (true); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 64391f5979..3f9c5d0c5e 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -44,7 +44,7 @@ void printchar(); void printchar(uint16 dst, uint16 src, uint16 *x, uint16 y, uint8 c, uint8 *width, uint8 *height); void printdirect(); - uint8 printslow(uint16 x, uint16 y); + uint8 printslow(uint16 x, uint16 y, uint8 maxWidth, bool centered); void printslow(); void getnumber(); uint8 getnumber(uint16 maxWidth, bool centered, uint16* offset); -- cgit v1.2.3 From 60d4970fd091c618194684bc0030d70fc3808138 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Thu, 21 Jul 2011 22:46:16 +0200 Subject: DREAMWEB: 'dumptextline' ported to C++ --- engines/dreamweb/dreamgen.cpp | 19 ------------------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/stubs.cpp | 11 +++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 13 insertions(+), 21 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 216679efc3..2c9f4a45a3 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -19538,24 +19538,6 @@ _tmp1: multiput(); } -void DreamGenContext::dumptextline() { - STACK_CHECK; - _cmp(data.byte(kNewtextline), 1); - if (!flags.z()) - return /* (nodumptextline) */; - data.byte(kNewtextline) = 0; - di = data.word(kTextaddressx); - bx = data.word(kTextaddressy); - _cmp(data.byte(kForeignrelease), 0); - if (flags.z()) - goto _tmp1; - _sub(bx, 3); -_tmp1: - cl = (228); - ch = (13); - multidump(); -} - void DreamGenContext::animpointer() { STACK_CHECK; _cmp(data.byte(kPointermode), 2); @@ -21741,7 +21723,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_dumppointer: dumppointer(); break; case addr_undertextline: undertextline(); break; case addr_deltextline: deltextline(); break; - case addr_dumptextline: dumptextline(); break; case addr_animpointer: animpointer(); break; case addr_setmouse: setmouse(); break; case addr_readmouse: readmouse(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index c6b9bedb92..8dd6417523 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -92,7 +92,6 @@ public: static const uint16 addr_readmouse = 0xcae4; static const uint16 addr_setmouse = 0xcae0; static const uint16 addr_animpointer = 0xcadc; - static const uint16 addr_dumptextline = 0xcad8; static const uint16 addr_deltextline = 0xcad4; static const uint16 addr_undertextline = 0xcad0; static const uint16 addr_dumppointer = 0xcacc; @@ -1518,7 +1517,7 @@ public: void fillopen(); void delsprite(); void getroomspaths(); - void dumptextline(); + //void dumptextline(); void fadescreendownhalf(); void useplate(); void candles1(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 9cc6098f79..3bf26c28fd 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -318,6 +318,17 @@ void DreamGenContext::printslow() { al = printslow(di, bx, dl, (bool)(dl & 1)); } +void DreamGenContext::dumptextline() { + if (data.byte(kNewtextline) != 1) + return; + data.byte(kNewtextline) = 0; + uint16 x = data.word(kTextaddressx); + uint16 y = data.word(kTextaddressy); + if (data.byte(kForeignrelease) != 0) + y -= 3; + multidump(x, y, 228, 13); +} + uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool centered) { data.byte(kPointerframe) = 1; data.byte(kPointermode) = 3; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 3f9c5d0c5e..690ae5003a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -46,6 +46,7 @@ void printdirect(); uint8 printslow(uint16 x, uint16 y, uint8 maxWidth, bool centered); void printslow(); + void dumptextline(); void getnumber(); uint8 getnumber(uint16 maxWidth, bool centered, uint16* offset); void kernchars(); -- cgit v1.2.3 From 402e41dd676dc33e147afa03a95e6aecb1c82bbe Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Thu, 21 Jul 2011 23:21:35 +0200 Subject: DREAMWEB: Less register usage in 'getnumber' --- engines/dreamweb/stubs.cpp | 28 ++++++++-------------------- engines/dreamweb/stubs.h | 2 +- 2 files changed, 9 insertions(+), 21 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 3bf26c28fd..1a14319e7a 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -336,7 +336,7 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center do { push(di); uint16 offset = x; - uint16 charCount = getnumber(maxWidth, centered, &offset); + uint16 charCount = getnumber(si, maxWidth, centered, &offset); do { push(si); push(es); @@ -400,7 +400,7 @@ void DreamGenContext::printdirect() { push(di); push(dx); uint16 offset; - uint8 charCount = getnumber(dl, (bool)(dl & 1), &offset); + uint8 charCount = getnumber(si, dl, (bool)(dl & 1), &offset); di = offset; uint16 x = di; do { @@ -429,20 +429,16 @@ void DreamGenContext::printdirect() { void DreamGenContext::getnumber() { uint16 offset = di; - cl = getnumber(dl, (bool)(dl & 1), &offset); + cl = getnumber(si, dl, (bool)(dl & 1), &offset); di = offset; } -uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered, uint16* offset) { +uint8 DreamGenContext::getnumber(uint16 index, uint16 maxWidth, bool centered, uint16* offset) { uint8 totalWidth = 0; uint8 charCount = 0; - push(si); - push(bx); push(di); - push(ds); - push(es); - di = si; - *offset = di; + di = index; + *offset = index; while (true) { uint8 wordTotalWidth, wordCharCount; uint8 done = getnextword(es.ptr(di, 0), &wordTotalWidth, &wordCharCount); @@ -461,12 +457,8 @@ uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered, uint16* offset) } else { ax = 0; } - es = pop(); - ds = pop(); di = pop(); - bx = pop(); - si = pop(); - _add(di, ax); + di += ax; *offset = di; return charCount; } @@ -478,12 +470,8 @@ uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered, uint16* offset) } else { ax = 0; } - es = pop(); - ds = pop(); di = pop(); - bx = pop(); - si = pop(); - _add(di, ax); + di += ax; *offset = di; return charCount; } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 690ae5003a..9cbd3f33a6 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -48,7 +48,7 @@ void printslow(); void dumptextline(); void getnumber(); - uint8 getnumber(uint16 maxWidth, bool centered, uint16* offset); + uint8 getnumber(uint16 index, uint16 maxWidth, bool centered, uint16* offset); void kernchars(); uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width); Sprite *spritetable(); -- cgit v1.2.3 From 08e407bbe5823110d6d821520bb883a7bb5f9e31 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Sat, 23 Jul 2011 18:22:37 +0200 Subject: DREAMWEB: 'printdirect' has a C++ signature --- engines/dreamweb/stubs.cpp | 53 ++++++++++++++++++---------------------------- engines/dreamweb/stubs.h | 1 + 2 files changed, 22 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1a14319e7a..45bc7b2bfa 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -393,37 +393,33 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center } void DreamGenContext::printdirect() { - data.word(kLastxpos) = di; + uint16 y = bx; + printdirect(di, &y, dl, (bool)(dl & 1)); + bx = y; +} + +void DreamGenContext::printdirect(uint16 x, uint16 *y, uint8 maxWidth, bool centered) { + data.word(kLastxpos) = x; ds = data.word(kCurrentset); while (true) { - push(bx); - push(di); - push(dx); - uint16 offset; - uint8 charCount = getnumber(si, dl, (bool)(dl & 1), &offset); - di = offset; - uint16 x = di; + uint16 offset = x; + uint8 charCount = getnumber(si, maxWidth, centered, &offset); + uint16 i = offset; do { - ax = es.word(si); + uint8 c = es.byte(si); ++si; - if ((al == 0) || (al == ':')) { - dx = pop(); - di = pop(); - bx = pop(); + if ((c == 0) || (c == ':')) { return; } - push(es); - al = engine->modifyChar(al); + c = engine->modifyChar(c); uint8 width, height; - printchar(es, ds, &x, bx, al, &width, &height); - data.word(kLastxpos) = x; + push(es); + printchar(es, ds, &i, *y, c, &width, &height); es = pop(); + data.word(kLastxpos) = i; --charCount; } while(charCount); - dx = pop(); - di = pop(); - bx = pop(); - bx += data.word(kLinespacing); + *y += data.word(kLinespacing); } } @@ -436,13 +432,10 @@ void DreamGenContext::getnumber() { uint8 DreamGenContext::getnumber(uint16 index, uint16 maxWidth, bool centered, uint16* offset) { uint8 totalWidth = 0; uint8 charCount = 0; - push(di); - di = index; - *offset = index; while (true) { uint8 wordTotalWidth, wordCharCount; - uint8 done = getnextword(es.ptr(di, 0), &wordTotalWidth, &wordCharCount); - di += wordCharCount; + uint8 done = getnextword(es.ptr(index, 0), &wordTotalWidth, &wordCharCount); + index += wordCharCount; if (done == 1) { //endoftext ax = totalWidth + wordTotalWidth - 10; @@ -457,9 +450,7 @@ uint8 DreamGenContext::getnumber(uint16 index, uint16 maxWidth, bool centered, u } else { ax = 0; } - di = pop(); - di += ax; - *offset = di; + *offset += ax; return charCount; } ax = totalWidth + wordTotalWidth - 10; @@ -470,9 +461,7 @@ uint8 DreamGenContext::getnumber(uint16 index, uint16 maxWidth, bool centered, u } else { ax = 0; } - di = pop(); - di += ax; - *offset = di; + *offset += ax; return charCount; } totalWidth += wordTotalWidth; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 9cbd3f33a6..64bcd2259c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -44,6 +44,7 @@ void printchar(); void printchar(uint16 dst, uint16 src, uint16 *x, uint16 y, uint8 c, uint8 *width, uint8 *height); void printdirect(); + void printdirect(uint16 x, uint16 *y, uint8 maxWidth, bool centered); uint8 printslow(uint16 x, uint16 y, uint8 maxWidth, bool centered); void printslow(); void dumptextline(); -- cgit v1.2.3 From 0066e4007a910a2f581018cc0b3a9fda94e41112 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Sat, 23 Jul 2011 18:32:48 +0200 Subject: DREAMWEB: Less register usage in 'printslow' --- engines/dreamweb/stubs.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 45bc7b2bfa..72d0994657 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -334,7 +334,6 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center data.byte(kPointermode) = 3; ds = data.word(kCharset1); do { - push(di); uint16 offset = x; uint16 charCount = getnumber(si, maxWidth, centered, &offset); do { @@ -352,13 +351,10 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center if ((c1 == 0) || (c1 == ':')) { es = pop(); si = pop(); - di = pop(); return 0; } if (charCount != 1) { - push(di); push(ds); - push(cx); push(es); c1 = engine->modifyChar(c1); data.word(kCharshift) = 91; @@ -366,9 +362,7 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center printboth(es, ds, &offset2, y, c1); data.word(kCharshift) = 0; es = pop(); - cx = pop(); ds = pop(); - di = pop(); for (int i=0; i<2; ++i) { waitframes(); if (ax == 0) @@ -376,7 +370,6 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center if (ax != data.word(kOldbutton)) { es = pop(); si = pop(); - di = pop(); return 1; } } @@ -387,7 +380,6 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center ++si; --charCount; } while (charCount); - di = pop(); y += 10; } while (true); } -- cgit v1.2.3 From a58e2bea08e1409f918a8462ea8e56ffb7b8903a Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Sat, 23 Jul 2011 19:24:35 +0200 Subject: DREAMWEB: 'multiput' and 'multiget' get signatures --- engines/dreamweb/stubs.cpp | 12 ++++++++---- engines/dreamweb/stubs.h | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 72d0994657..c7ee257dbb 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -36,8 +36,10 @@ Common::String getFilename(Context &context) { } void DreamGenContext::multiget() { - unsigned w = (uint8)cl, h = (uint8)ch; - unsigned x = (uint16)di, y = (uint16)bx; + multiget(di, bx, cl, ch); +} + +void DreamGenContext::multiget(uint16 x, uint16 y, uint8 w, uint8 h) { unsigned src = x + y * kScreenwidth; unsigned dst = (uint16)si; es = ds; @@ -58,8 +60,10 @@ void DreamGenContext::multiget() { } void DreamGenContext::multiput() { - unsigned w = (uint8)cl, h = (uint8)ch; - unsigned x = (uint16)di, y = (uint16)bx; + multiput(di, bx, cl, ch); +} + +void DreamGenContext::multiput(uint16 x, uint16 y, uint8 w, uint8 h) { unsigned src = (uint16)si; unsigned dst = x + y * kScreenwidth; es = data.word(kWorkspace); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 64bcd2259c..0c0ff113c9 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -28,6 +28,7 @@ void frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); void worktoscreen(); void multiget(); + void multiget(uint16 x, uint16 y, uint8 width, uint8 height); void convertkey(); void cls(); void printsprites(); @@ -57,6 +58,7 @@ void showframe(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); void printasprite(const Sprite *sprite); void width160(); + void multiput(uint16 x, uint16 y, uint8 width, uint8 height); void multiput(); void eraseoldobs(); void clearsprites(); -- cgit v1.2.3 From cbcdb61b288904658198d086a25153eddd60e5c3 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Sat, 23 Jul 2011 19:18:10 +0200 Subject: DREAMWEB: Blacklisted 'usetimedtext', 'getundertimed' and 'putundertimed' --- engines/dreamweb/dreamgen.cpp | 79 ------------------------------------------- engines/dreamweb/dreamgen.h | 11 +++--- engines/dreamweb/stubs.cpp | 40 ++++++++++++++++++++++ engines/dreamweb/stubs.h | 3 ++ 4 files changed, 47 insertions(+), 86 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 2c9f4a45a3..c05cab5238 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -12853,46 +12853,6 @@ notonsartroof: placesetobject(); } -void DreamGenContext::getundertimed() { - STACK_CHECK; - al = data.byte(kTimedy); - _cmp(data.byte(kForeignrelease), 0); - if (flags.z()) - goto _tmp1; - _sub(al, 3); -_tmp1: - ah = 0; - bx = ax; - al = data.byte(kTimedx); - ah = 0; - di = ax; - ch = (30); - cl = 240; - ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); - multiget(); -} - -void DreamGenContext::putundertimed() { - STACK_CHECK; - al = data.byte(kTimedy); - _cmp(data.byte(kForeignrelease), 0); - if (flags.z()) - goto _tmp1; - _sub(al, 3); -_tmp1: - ah = 0; - bx = ax; - al = data.byte(kTimedx); - ah = 0; - di = ax; - ch = (30); - cl = 240; - ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); - multiput(); -} - void DreamGenContext::dumptimedtext() { STACK_CHECK; _cmp(data.byte(kNeedtodumptimed), 1); @@ -12989,42 +12949,6 @@ notloadspeech3: data.word(kTimedoffset) = bx; } -void DreamGenContext::usetimedtext() { - STACK_CHECK; - _cmp(data.word(kTimecount), 0); - if (flags.z()) - return /* (notext) */; - _dec(data.word(kTimecount)); - _cmp(data.word(kTimecount), 0); - if (flags.z()) - goto deltimedtext; - ax = data.word(kTimecount); - _cmp(ax, data.word(kCounttotimed)); - if (flags.z()) - goto firsttimed; - if (!flags.c()) - return /* (notext) */; - goto notfirsttimed; -firsttimed: - getundertimed(); -notfirsttimed: - bl = data.byte(kTimedy); - bh = 0; - al = data.byte(kTimedx); - ah = 0; - di = ax; - es = data.word(kTimedseg); - si = data.word(kTimedoffset); - dl = 237; - ah = 0; - printdirect(); - data.byte(kNeedtodumptimed) = 1; - return; -deltimedtext: - putundertimed(); - data.byte(kNeedtodumptimed) = 1; -} - void DreamGenContext::edenscdplayer() { STACK_CHECK; showfirstuse(); @@ -21484,12 +21408,9 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_setallchanges: setallchanges(); break; case addr_dochange: dochange(); break; case addr_autoappear: autoappear(); break; - case addr_getundertimed: getundertimed(); break; - case addr_putundertimed: putundertimed(); break; case addr_dumptimedtext: dumptimedtext(); break; case addr_setuptimeduse: setuptimeduse(); break; case addr_setuptimedtemp: setuptimedtemp(); break; - case addr_usetimedtext: usetimedtext(); break; case addr_edenscdplayer: edenscdplayer(); break; case addr_usewall: usewall(); break; case addr_usechurchgate: usechurchgate(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 8dd6417523..c2aa204942 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -327,12 +327,9 @@ public: static const uint16 addr_usechurchgate = 0xc730; static const uint16 addr_usewall = 0xc72c; static const uint16 addr_edenscdplayer = 0xc728; - static const uint16 addr_usetimedtext = 0xc724; static const uint16 addr_setuptimedtemp = 0xc720; static const uint16 addr_setuptimeduse = 0xc71c; static const uint16 addr_dumptimedtext = 0xc718; - static const uint16 addr_putundertimed = 0xc714; - static const uint16 addr_getundertimed = 0xc710; static const uint16 addr_autoappear = 0xc70c; static const uint16 addr_dochange = 0xc708; static const uint16 addr_setallchanges = 0xc704; @@ -1343,7 +1340,7 @@ public: void storeit(); void lockeddoorway(); void isitworn(); - void putundertimed(); + //void putundertimed(); void dumpmap(); //void multidump(); void channel0only(); @@ -1369,7 +1366,7 @@ public: void restoreall(); void screenupdate(); void addlength(); - void usetimedtext(); + void wornerror(); void putundercentre(); void checkobjectsize(); void commandonly(); @@ -1515,6 +1512,7 @@ public: void openpoolboss(); void buttontwo(); void fillopen(); + //void usetimedtext(); void delsprite(); void getroomspaths(); //void dumptextline(); @@ -1570,7 +1568,6 @@ public: void saveload(); void monitorlogo(); void loadposition(); - void wornerror(); void entersymbol(); void showword(); void dirfile(); @@ -1791,7 +1788,7 @@ public: void findsetobject(); void singlekey(); //void seecommandtail(); - void getundertimed(); + //void getundertimed(); void hangone(); void carparkdrip(); void usediary(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c7ee257dbb..ec94ffc40c 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -419,6 +419,46 @@ void DreamGenContext::printdirect(uint16 x, uint16 *y, uint8 maxWidth, bool cent } } +void DreamGenContext::getundertimed() { + uint16 y = data.byte(kTimedy); + if (data.byte(kForeignrelease)) + y -= 3; + ds = data.word(kBuffers); + si = kUndertimedtext; + multiget(data.byte(kTimedx), y, 240, kUndertimedysize); +} + +void DreamGenContext::putundertimed() { + uint16 y = data.byte(kTimedy); + if (data.byte(kForeignrelease)) + y -= 3; + ds = data.word(kBuffers); + si = kUndertimedtext; + multiput(data.byte(kTimedx), y, 240, kUndertimedysize); +} + +void DreamGenContext::usetimedtext() { + if (data.word(kTimecount) == 0) + return; + --data.word(kTimecount); + if (data.word(kTimecount) == 0) { + putundertimed(); + data.byte(kNeedtodumptimed) = 1; + return; + } + + if (data.word(kTimecount) == data.word(kCounttotimed)) + getundertimed(); + else if (data.word(kTimecount) > data.word(kCounttotimed)) + return; + + es = data.word(kTimedseg); + si = data.word(kTimedoffset); + uint16 y = data.byte(kTimedy); + printdirect(data.byte(kTimedx), &y, 237, true); + data.byte(kNeedtodumptimed) = 1; +} + void DreamGenContext::getnumber() { uint16 offset = di; cl = getnumber(si, dl, (bool)(dl & 1), &offset); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0c0ff113c9..20d987d374 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -46,6 +46,9 @@ void printchar(uint16 dst, uint16 src, uint16 *x, uint16 y, uint8 c, uint8 *width, uint8 *height); void printdirect(); void printdirect(uint16 x, uint16 *y, uint8 maxWidth, bool centered); + void usetimedtext(); + void getundertimed(); + void putundertimed(); uint8 printslow(uint16 x, uint16 y, uint8 maxWidth, bool centered); void printslow(); void dumptextline(); -- cgit v1.2.3