From 707c6ed01c6f19ec192efe915636f256e12898b0 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Thu, 11 Aug 2011 03:19:51 +0200 Subject: DREAMWEB: 'printslow' API improved --- engines/dreamweb/print.cpp | 29 +++++++---------------------- engines/dreamweb/stubs.h | 3 +-- 2 files changed, 8 insertions(+), 24 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index 9e4c416015..3d571f939e 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -26,12 +26,6 @@ namespace DreamGen { -void DreamGenContext::printboth() { - uint16 x = di; - printboth((const Frame *)ds.ptr(0, 0), &x, bx, al, ah); - di = x; -} - void DreamGenContext::printboth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) { uint16 newX = *x; uint8 width, height; @@ -100,28 +94,23 @@ void DreamGenContext::printchar(const Frame *charSet, uint16* x, uint16 y, uint8 } void DreamGenContext::printslow() { - al = printslow(di, bx, dl, (bool)(dl & 1)); + al = printslow(es.ptr(si, 0), di, bx, dl, (bool)(dl & 1)); } -uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool centered) { +uint8 DreamGenContext::printslow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { data.byte(kPointerframe) = 1; data.byte(kPointermode) = 3; const Frame* charSet = (const Frame *)segRef(data.word(kCharset1)).ptr(0, 0); do { uint16 offset = x; - uint16 charCount = getnumber(charSet, es.ptr(si, 0), maxWidth, centered, &offset); + uint16 charCount = getnumber(charSet, string, maxWidth, centered, &offset); do { - push(si); - push(es); - uint8 c0 = es.byte(si); - uint8 c1 = es.byte(si+1); - uint8 c2 = es.byte(si+2); + uint8 c0 = string[0]; + uint8 c1 = string[1]; + uint8 c2 = string[2]; c0 = engine->modifyChar(c0); printboth(charSet, &offset, y, c0, c1); - ++si; if ((c1 == 0) || (c1 == ':')) { - es = pop(); - si = pop(); return 0; } if (charCount != 1) { @@ -135,16 +124,12 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center if (ax == 0) continue; if (ax != data.word(kOldbutton)) { - es = pop(); - si = pop(); return 1; } } } - es = pop(); - si = pop(); - ++si; + ++string; --charCount; } while (charCount); y += 10; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5ac340feea..3140bbd8bc 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -43,7 +43,6 @@ void quickquit2(); void getnextword(); uint8 getnextword(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount); - void printboth(); void printboth(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar); void printchar(); void printchar(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height); @@ -52,7 +51,7 @@ void usetimedtext(); void getundertimed(); void putundertimed(); - uint8 printslow(uint16 x, uint16 y, uint8 maxWidth, bool centered); + uint8 printslow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered); void printslow(); void dumptextline(); void getnumber(); -- cgit v1.2.3