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/dreamweb') 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