DREAMWEB: Port 'endgameseq' to C++

This commit is contained in:
Filippos Karapetis 2011-12-16 00:15:04 +02:00
parent 6792fa2fb6
commit 66618f4e02
5 changed files with 41 additions and 66 deletions

View File

@ -374,6 +374,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'edenscdplayer',
'enablesoundint',
'endgame',
'endgameseq',
'endpaltostart',
'entercode',
'entersymbol',

View File

@ -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);

View File

@ -490,7 +490,6 @@ public:
void fadeScreenDownHalf();
void outOfOpen();
void dirCom();
void endGameSeq();
void findFirstPath();
void startTalk();
void getAnyAd();

View File

@ -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

View File

@ -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);