From 66618f4e0245bb1f90cd08a1261d57483e73aaae Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 00:15:04 +0200 Subject: [PATCH] DREAMWEB: Port 'endgameseq' to C++ --- devtools/tasmrecover/tasm-recover | 1 + engines/dreamweb/dreamgen.cpp | 63 ------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/people.cpp | 41 +++++++++++++++++++- engines/dreamweb/stubs.h | 1 + 5 files changed, 41 insertions(+), 66 deletions(-) diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 89a830b8263..83ebcadd69b 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -374,6 +374,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'edenscdplayer', 'enablesoundint', 'endgame', + 'endgameseq', 'endpaltostart', 'entercode', 'entersymbol', diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e4a5411ed77..804896de5f7 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -123,69 +123,6 @@ combatover2: data.byte(kMandead) = 2; } -void DreamGenContext::endGameSeq() { - STACK_CHECK; - checkSpeed(); - if (!flags.z()) - goto notendseq; - ax = es.word(bx+3); - _inc(ax); - _cmp(ax, 51); - if (!flags.z()) - goto gotendseq; - _cmp(data.byte(kIntrocount), 140); - if (flags.z()) - goto gotendseq; - _inc(data.byte(kIntrocount)); - push(es); - push(bx); - textForEnd(); - bx = pop(); - es = pop(); - ax = 50; -gotendseq: - es.word(bx+3) = ax; - _cmp(ax, 134); - if (!flags.z()) - goto notfadedown; - push(es); - push(bx); - push(ax); - fadeScreenDownHalf(); - ax = pop(); - bx = pop(); - es = pop(); - goto notendseq; -notfadedown: - _cmp(ax, 324); - if (!flags.z()) - goto notfadeend; - push(es); - push(bx); - push(ax); - fadeScreenDowns(); - data.byte(kVolumeto) = 7; - data.byte(kVolumedirection) = 1; - ax = pop(); - bx = pop(); - es = pop(); -notfadeend: - _cmp(ax, 340); - if (!flags.z()) - goto notendseq; - data.byte(kGetback) = 1; -notendseq: - showGameReel(); - al = data.byte(kMapy); - es.byte(bx+2) = al; - ax = es.word(bx+3); - _cmp(ax, 145); - if (!flags.z()) - return /* (notendcreds) */; - es.word(bx+3) = 146; - rollEndCredits(); -} - void DreamGenContext::checkForExit() { STACK_CHECK; cl = data.byte(kRyanx); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 87b769f79ef..c47be2f748a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -490,7 +490,6 @@ public: void fadeScreenDownHalf(); void outOfOpen(); void dirCom(); - void endGameSeq(); void findFirstPath(); void startTalk(); void getAnyAd(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 003921b1634..96c9ae89c92 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -48,7 +48,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = { NULL, NULL, NULL, NULL, NULL, NULL, - NULL, &DreamGenContext::endGameSeq, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -80,7 +80,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::gates, &DreamGenContext::introMagic3, &DreamGenContext::introMonks1, &DreamGenContext::candles, &DreamGenContext::introMonks2, &DreamGenContext::handClap, - &DreamGenContext::monkAndRyan, /*&DreamGenContext::endGameSeq*/NULL, + &DreamGenContext::monkAndRyan, &DreamGenContext::endGameSeq, &DreamGenContext::priest, &DreamGenContext::madman, &DreamGenContext::madmansTelly, &DreamGenContext::alleyBarkSound, &DreamGenContext::foghornSound, &DreamGenContext::carParkDrip, @@ -1012,4 +1012,41 @@ void DreamGenContext::businessMan(ReelRoutine &routine) { } } +void DreamGenContext::endGameSeq(ReelRoutine &routine) { + if (checkSpeed(routine)) { + uint16 nextReelPointer = routine.reelPointer() + 1; + if (nextReelPointer == 51 && data.byte(kIntrocount) != 140) { + data.byte(kIntrocount)++; + textForEnd(); + nextReelPointer = 50; + } + + routine.setReelPointer(nextReelPointer); + if (nextReelPointer == 134) { + push(es); + push(bx); + push(ax); + fadeScreenDownHalf(); + ax = pop(); + bx = pop(); + es = pop(); + } else if (nextReelPointer == 324) { + fadeScreenDowns(); + data.byte(kVolumeto) = 7; + data.byte(kVolumedirection) = 1; + } + + if (nextReelPointer == 340) + data.byte(kGetback) = 1; + } + + showGameReel(&routine); + routine.mapY = data.byte(kMapy); + + if (routine.reelPointer() == 145) { + routine.setReelPointer(146); + rollEndCredits(); + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5b012d580e4..0ee41714704 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -384,6 +384,7 @@ void helicopter(ReelRoutine &routine); void mugger(ReelRoutine &routine); void businessMan(ReelRoutine &routine); + void endGameSeq(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); uint8 nextSymbol(uint8 symbol);