From af85b85a8448dde352aa54aa61192e76c4d8be1b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Dec 2011 13:15:04 +0100 Subject: DREAMWEB: Convert rollEndCredits/rollEndCredits2 to C++ --- devtools/tasmrecover/tasm-recover | 2 + engines/dreamweb/dreambase.h | 2 + engines/dreamweb/dreamgen.cpp | 98 --------------------------------------- engines/dreamweb/dreamgen.h | 4 +- engines/dreamweb/print.cpp | 3 +- engines/dreamweb/sprite.cpp | 44 ++++++++++++++++++ engines/dreamweb/stubs.cpp | 7 +-- engines/dreamweb/stubs.h | 2 +- engines/dreamweb/vgafades.cpp | 4 ++ 9 files changed, 59 insertions(+), 107 deletions(-) diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index edc4a60be2..5558a93f7a 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -625,6 +625,8 @@ generator = cpp(context, "DreamGen", blacklist = [ 'restoreems', 'restorereels', 'rockstar', + 'rollendcredits', + 'rollendcredits2', 'roomname', 'runintroseq', 'saveems', diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 2d5669fa8f..3d5c9ce88b 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -114,6 +114,7 @@ public: void showReelFrame(Reel *reel); const Frame *getReelFrameAX(uint16 frame); void soundOnReels(uint16 reelPointer); + void rollEndCredits(); // from stubs.cpp void crosshair(); @@ -148,6 +149,7 @@ public: void panelIcons1(); SetObject *getSetAd(uint8 index); void *getAnyAd(uint8 *value1, uint8 *value2); + const uint8 *getTextInFile1(uint16 index); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 5b96e7cb86..8d1eb4cec9 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -546,99 +546,6 @@ notendseq: rollEndCredits(); } -void DreamGenContext::rollEndCredits() { - STACK_CHECK; - al = 16; - ah = 255; - playChannel0(); - data.byte(kVolume) = 7; - data.byte(kVolumeto) = 0; - data.byte(kVolumedirection) = -1; - cl = 160; - ch = 160; - di = 75; - bx = 20; - ds = data.word(kMapstore); - si = 0; - multiGet(); - es = data.word(kTextfile1); - si = 3*2; - ax = es.word(si); - si = ax; - _add(si, (66*2)); - cx = 254; -endcredits1: - push(cx); - bx = 10; - cx = data.word(kLinespacing); -endcredits2: - push(cx); - push(si); - push(di); - push(es); - push(bx); - vSync(); - cl = 160; - ch = 160; - di = 75; - 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; -onelot: - push(cx); - di = 75; - dx = 161; - ax = 0; - printDirect(); - _add(bx, data.word(kLinespacing)); - cx = pop(); - if (--cx) - goto onelot; - vSync(); - cl = 160; - ch = 160; - di = 75; - bx = 20; - multiDump(); - bx = pop(); - es = pop(); - di = pop(); - si = pop(); - cx = pop(); - _dec(bx); - if (--cx) - goto endcredits2; - cx = pop(); -looknext: - al = es.byte(si); - _inc(si); - _cmp(al, ':'); - if (flags.z()) - goto gotnext; - _cmp(al, 0); - if (flags.z()) - goto gotnext; - goto looknext; -gotnext: - if (--cx) - goto endcredits1; - cx = 100; - hangOn(); - panelToMap(); - fadeScreenUpHalf(); -} - void DreamGenContext::checkForExit() { STACK_CHECK; cl = data.byte(kRyanx); @@ -928,11 +835,6 @@ halfend: data.byte(kNumtofade) = 32; } -void DreamGenContext::rollEndCredits2() { - STACK_CHECK; - rollEm(); -} - void DreamGenContext::rollEm() { STACK_CHECK; cl = 160; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 6642803b42..04c5116b83 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -546,14 +546,12 @@ public: void pickupConts(); void nextColon(); void findInvPos(); - void rollEndCredits(); void getKeyAndLogo(); void selectOb(); void receptionist(); void selectSlot(); void fadeUpMon(); void showDiaryPage(); - void transferToEx(); void reExFromInv(); void businessMan(); void outOfInv(); @@ -587,7 +585,6 @@ public: void drawItAll(); void useStereo(); void showDiaryKeys(); - void rollEndCredits2(); void useOpened(); void signOn(); void locationPic(); @@ -620,6 +617,7 @@ public: void swapWithInv(); void useControl(); void adjustRight(); + void transferToEx(); void updateSymbolTop(); void getPersonText(); void parser(); diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index dc7ca8a2f7..0fd596ceac 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -122,11 +122,10 @@ uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWid void DreamGenContext::printDirect() { uint16 y = bx; - uint16 initialSi = si; const uint8 *initialString = es.ptr(si, 0); const uint8 *string = initialString; al = DreamBase::printDirect(&string, di, &y, dl, (bool)(dl & 1)); - si = initialSi + (string - initialString); + si += (string - initialString); bx = y; } diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index f1f3ff5e48..f8f11d8df8 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -759,6 +759,50 @@ void DreamGenContext::intro3Text() { setupTimedTemp(46, 82, 36, 56, 100, 1); } +void DreamBase::rollEndCredits() { + playChannel0(16, 255); + data.byte(kVolume) = 7; + data.byte(kVolumeto) = 0; + data.byte(kVolumedirection) = -1; + + multiGet(mapStore(), 75, 20, 160, 160); + + const uint8 *string = getTextInFile1(3); + const int linespacing = data.word(kLinespacing); + + for (int i = 0; i < 254; ++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(), 75, 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; ++j) { + DreamBase::printDirect(&tmp_str, 75, &y, 160 + 1, true); + y += linespacing; + } + + vSync(); + multiDump(75, 20, 160, 160); + } + + // Skip to the next text line + byte c; + do { + c = *string++; + } while (c != ':' && c != 0); + } + hangOn(100); + panelToMap(); + fadeScreenUpHalf(); +} + + void DreamGenContext::monks2text() { bool isGermanCD = isCD() && engine->getLanguage() == Common::DE_DEU; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 7e871bd42a..0b3daa861e 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -2482,9 +2482,10 @@ void DreamGenContext::setLocation() { setLocation(al); } -const uint8 *DreamGenContext::getTextInFile1(uint16 index) { - uint16 offset = getSegment(data.word(kTextfile1)).word(index * 2) + kTextstart; - const uint8 *string = getSegment(data.word(kTextfile1)).ptr(offset, 0); +const uint8 *DreamBase::getTextInFile1(uint16 index) { + SegmentRef text = getSegment(data.word(kTextfile1)); + uint16 offset = text.word(index * 2) + kTextstart; + const uint8 *string = text.ptr(offset, 0); return string; } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index c73034ce5e..ed1aba957a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -369,7 +369,6 @@ void getLocation(); void setLocation(uint8 index); void setLocation(); - const uint8 *getTextInFile1(uint16 index); void loadTempText(); void loadTempText(const char *fileName); void loadTravelText(); @@ -568,5 +567,6 @@ void showPuzText(uint16 command, uint16 count); void showPuzText(); void monkSpeaking(); + void rollEndCredits2(); #endif diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index 6f5af573c4..ca63b7308c 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -248,4 +248,8 @@ void DreamGenContext::showGroup() { cx = 0; } +void DreamGenContext::rollEndCredits2() { + rollEm(); +} + } // End of namespace DreamGen -- cgit v1.2.3