From dbe5b50cd34362bc3a6743be6eac0e4840353a47 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 26 Dec 2011 01:36:29 +0100 Subject: DREAMWEB: Port rollEm() to C++ --- engines/dreamweb/dreambase.h | 5 +++ engines/dreamweb/dreamgen.cpp | 94 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/sprite.cpp | 2 + engines/dreamweb/stubs.h | 3 -- engines/dreamweb/titles.cpp | 6 +-- engines/dreamweb/vgafades.cpp | 47 +++++++++++++++++++++- 7 files changed, 54 insertions(+), 104 deletions(-) (limited to 'engines/dreamweb') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 0438defc05..3bc2757ac8 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -563,6 +563,9 @@ public: bool hangOnPQ(); void redes(); + // from titles.cpp + void hangOne(uint16 delay); + // from use.cpp void placeFreeObject(uint8 index); void removeFreeObject(uint8 index); @@ -710,6 +713,8 @@ public: void createPanel(); void createPanel2(); void showPanel(); + void rollEndCredits2(); + void rollEm(); }; diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e92291178c..fcf8dc6727 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -73,100 +73,6 @@ void DreamGenContext::transferMap() { _add(data.word(kExframepos), cx); } -void DreamGenContext::rollEm() { - STACK_CHECK; - cl = 160; - ch = 160; - di = 25; - bx = 20; - ds = data.word(kMapstore); - si = 0; - multiGet(); - es = data.word(kTextfile1); - si = 49*2; - ax = es.word(si); - si = ax; - _add(si, (66*2)); - cx = 80; -endcredits21: - push(cx); - bx = 10; - cx = data.word(kLinespacing); -endcredits22: - push(cx); - push(si); - push(di); - push(es); - push(bx); - vSync(); - cl = 160; - ch = 160; - di = 25; - bx = 20; - ds = data.word(kMapstore); - si = 0; - multiPut(); - vSync(); - bx = pop(); - es = pop(); - di = pop(); - si = pop(); - push(si); - push(di); - push(es); - push(bx); - cx = 18; -onelot2: - push(cx); - di = 25; - dx = 161; - ax = 0; - printDirect(); - _add(bx, data.word(kLinespacing)); - cx = pop(); - if (--cx) - goto onelot2; - vSync(); - cl = 160; - ch = 160; - di = 25; - bx = 20; - multiDump(); - bx = pop(); - es = pop(); - di = pop(); - si = pop(); - cx = pop(); - _cmp(data.byte(kLasthardkey), 1); - if (flags.z()) - goto endearly2; - _dec(bx); - if (--cx) - goto endcredits22; - cx = pop(); -looknext2: - al = es.byte(si); - _inc(si); - _cmp(al, ':'); - if (flags.z()) - goto gotnext2; - _cmp(al, 0); - if (flags.z()) - goto gotnext2; - goto looknext2; -gotnext2: - _cmp(data.byte(kLasthardkey), 1); - if (flags.z()) - return /* (endearly) */; - if (--cx) - goto endcredits21; - cx = 120; - hangOne(); - return; -endearly2: - cx = pop(); -} - void DreamGenContext::fillOpen() { STACK_CHECK; delTextLine(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 4d6946e8ab..40046c4379 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -460,7 +460,6 @@ public: void pickupConts(); void transferMap(); void getSetAd(); - void rollEm(); void findAllOpen(); void fillOpen(); void dreamweb(); diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index c9ea699988..72be878e14 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -706,6 +706,8 @@ void DreamBase::intro3Text(uint16 nextReelPointer) { } void DreamBase::rollEndCredits() { + // Note: This function is very similar to rollEm() in vgafades.cpp + playChannel0(16, 255); data.byte(kVolume) = 7; data.byte(kVolumeto) = 0; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 9e547837c7..9e1649dcaa 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -107,8 +107,6 @@ void inventory(); void mainScreen(); void zoomOnOff(); - void hangOne(uint16 delay); - void hangOne(); void bibleQuote(); void realCredits(); void runIntroSeq(); @@ -131,7 +129,6 @@ void showGun(); void endGame(); void monkSpeaking(); - void rollEndCredits2(); void triggerMessage(uint16 index); void processTrigger(); void updateSymbolTop(); diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index dd8b3550cf..f3dafa38d9 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -110,7 +110,7 @@ void DreamGenContext::bibleQuote() { data.byte(kLasthardkey) = 0; } -void DreamGenContext::hangOne(uint16 delay) { +void DreamBase::hangOne(uint16 delay) { do { vSync(); if (data.byte(kLasthardkey) == 1) @@ -118,10 +118,6 @@ void DreamGenContext::hangOne(uint16 delay) { } while (--delay); } -void DreamGenContext::hangOne() { - hangOne(cx); -} - void DreamGenContext::intro() { loadTempText("DREAMWEB.T82"); loadPalFromIFF(); diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index 80f5ce608a..23a8655fa1 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -281,8 +281,53 @@ void DreamBase::dumpCurrent() { engine->setPalette(pal, 128, 128); } -void DreamGenContext::rollEndCredits2() { +void DreamBase::rollEndCredits2() { rollEm(); } +void DreamBase::rollEm() { + // Note: This function is very similar to rollEndCredits() in sprite.cpp + + multiGet(mapStore(), 25, 20, 160, 160); + + const uint8 *string = getTextInFile1(49); + const int linespacing = data.word(kLinespacing); + + for (int i = 0; i < 80; ++i) { + // Output the text, initially with an offset of 10 pixels, + // then move it up one pixel until we shifted it by a complete + // line of text. + for (int j = 0; j < linespacing; ++j) { + vSync(); + multiPut(mapStore(), 25, 20, 160, 160); + vSync(); + + // Output up to 18 lines of text + uint16 y = 10 - j; + const uint8 *tmp_str = string; + for (int k = 0; k < 18; ++k) { + DreamBase::printDirect(&tmp_str, 25, &y, 160 + 1, true); + y += linespacing; + } + + vSync(); + multiDump(25, 20, 160, 160); + + if (data.byte(kLasthardkey) == 1) + return; + } + + // Skip to the next text line + byte c; + do { + c = *string++; + } while (c != ':' && c != 0); + + if (data.byte(kLasthardkey) == 1) + return; + } + + hangOne(120); +} + } // End of namespace DreamGen -- cgit v1.2.3