diff options
author | Bertrand Augereau | 2011-11-18 18:17:16 +0100 |
---|---|---|
committer | Bertrand Augereau | 2011-11-19 16:54:28 +0100 |
commit | 2701439250c4255981048a3bfe2bb003055e6d2e (patch) | |
tree | f151edf07626e90a3bbafdbc987bf3e0ea7c0110 /engines/dreamweb | |
parent | 105c90b9d50605bc925c2d6c0cb9ed6658c3acef (diff) | |
download | scummvm-rg350-2701439250c4255981048a3bfe2bb003055e6d2e.tar.gz scummvm-rg350-2701439250c4255981048a3bfe2bb003055e6d2e.tar.bz2 scummvm-rg350-2701439250c4255981048a3bfe2bb003055e6d2e.zip |
DREAMWEB: 'monprint' ported to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 87 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/print.cpp | 48 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 2 |
4 files changed, 51 insertions, 89 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 66df739b9d..6d5952c3f7 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3168,92 +3168,6 @@ realcreditsearly: data.byte(kLasthardkey) = 0; } -void DreamGenContext::monprint() { - STACK_CHECK; - data.byte(kKerning) = 1; - si = bx; - dl = 166; - di = data.word(kMonadx); - bx = data.word(kMonady); - ds = data.word(kTempcharset); -printloop8: - push(bx); - push(di); - push(dx); - getnumber(); - ch = 0; -printloop7: - al = es.byte(si); - _inc(si); - _cmp(al, ':'); - if (flags.z()) - goto finishmon2; - _cmp(al, 0); - if (flags.z()) - goto finishmon; - _cmp(al, 34); - if (flags.z()) - goto finishmon; - _cmp(al, '='); - if (flags.z()) - goto finishmon; - _cmp(al, '%'); - if (!flags.z()) - goto nottrigger; - ah = es.byte(si); - _inc(si); - _inc(si); - goto finishmon; -nottrigger: - push(cx); - push(es); - modifychar(); - printchar(); - data.word(kCurslocx) = di; - data.word(kCurslocy) = bx; - data.word(kMaintimer) = 1; - printcurs(); - vsync(); - push(si); - push(dx); - push(ds); - push(es); - push(bx); - push(di); - lockmon(); - di = pop(); - bx = pop(); - es = pop(); - ds = pop(); - dx = pop(); - si = pop(); - delcurs(); - es = pop(); - cx = pop(); - if (--cx) - goto printloop7; -finishmon2: - dx = pop(); - di = pop(); - bx = pop(); - scrollmonitor(); - data.word(kCurslocx) = di; - goto printloop8; -finishmon: - dx = pop(); - di = pop(); - bx = pop(); - _cmp(al, '%'); - if (!flags.z()) - goto nottrigger2; - data.byte(kLasttrigger) = ah; -nottrigger2: - data.word(kCurslocx) = di; - scrollmonitor(); - bx = si; - data.byte(kKerning) = 0; -} - void DreamGenContext::fillopen() { STACK_CHECK; deltextline(); @@ -15229,7 +15143,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_mode640x480: mode640x480(); break; case addr_set16colpalette: set16colpalette(); break; case addr_realcredits: realcredits(); break; - case addr_monprint: monprint(); break; case addr_fillopen: fillopen(); break; case addr_findallopen: findallopen(); break; case addr_makemainscreen: makemainscreen(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index e4ad5f827e..c74a556328 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -452,7 +452,6 @@ public: static const uint16 addr_makemainscreen = 0xc340; static const uint16 addr_findallopen = 0xc32c; static const uint16 addr_fillopen = 0xc324; - static const uint16 addr_monprint = 0xc314; static const uint16 addr_realcredits = 0xc2f8; static const uint16 addr_set16colpalette = 0xc2f4; static const uint16 addr_mode640x480 = 0xc2f0; @@ -1357,7 +1356,7 @@ public: void delchar(); void getanyad(); void endgame(); - void monprint(); + //void monprint(); void usepipe(); //void startloading(); void getunderzoom(); diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index 8ae9df5df2..f12d8ee311 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -234,5 +234,53 @@ uint16 DreamGenContext::waitframes() { return data.word(kMousebutton); } +void DreamGenContext::monprint() { + uint16 originalBx = bx; + const char *string = (const char *)es.ptr(bx, 0); + const char *nextString = monprint(string); + bx = originalBx + (nextString - string); +} + +const char *DreamGenContext::monprint(const char *string) { + data.byte(kKerning) = 1; + uint16 x = data.word(kMonadx); + Frame *tempCharset = (Frame *)segRef(data.word(kTempcharset)).ptr(0, 0); + const char *iterator = string; + while (true) { + uint16 count = getnumber(tempCharset, (const uint8 *)iterator, 166, false, &x); + do { + char c = *iterator++; + if (c == ':') + break; + if ((c == 0) || (c == 34) || (c == '=')) + goto finishmon; + if (c == '%') { + data.byte(kLasttrigger) = *iterator; + iterator += 2; + goto finishmon; + } + c = engine->modifyChar(c); + printchar(tempCharset, &x, data.word(kMonady), c, 0, NULL, NULL); + data.word(kCurslocx) = x; + data.word(kCurslocy) = data.word(kMonady); + data.word(kMaintimer) = 1; + printcurs(); + vsync(); + lockmon(); + delcurs(); + --count; + } + while(count); + x = data.word(kMonadx); + scrollmonitor(); + data.word(kCurslocx) = data.word(kMonadx); + } +finishmon: + data.word(kCurslocx) = data.word(kMonadx); + scrollmonitor(); + data.byte(kKerning) = 0; + return iterator; +} + } /*namespace dreamgen */ diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 2fdb7c044c..2741c6b51e 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -302,4 +302,6 @@ void scrollmonitor(); void showcurrentfile(); void input(); + void monprint(); + const char *monprint(const char *string); |