Skip to content

Commit

Permalink
DREAMWEB: Port 'helicopter' to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Dec 15, 2011
1 parent faab2d7 commit 93bf275
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 68 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -470,6 +470,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'hangonpq',
'hangonw',
'heavy',
'helicopter',
'hotelbell',
'hotelcontrol',
'initialinv',
Expand Down
65 changes: 0 additions & 65 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -26,71 +26,6 @@

namespace DreamGen {

void DreamGenContext::helicopter() {
STACK_CHECK;
ax = es.word(bx+3);
_cmp(ax, 203);
if (flags.z())
goto heliwon;
checkSpeed();
if (!flags.z())
goto helispeed;
ax = es.word(bx+3);
_inc(ax);
_cmp(ax, 53);
if (!flags.z())
goto notbeforehdead;
_inc(data.byte(kCombatcount));
_cmp(data.byte(kCombatcount), 8);
if (flags.c())
goto waitabit;
data.byte(kMandead) = 2;
waitabit:
ax = 49;
goto gotheliframe;
notbeforehdead:
_cmp(ax, 9);
if (!flags.z())
goto gotheliframe;
_dec(ax);
_cmp(data.byte(kLastweapon), 1);
if (!flags.z())
goto notgunonheli;
data.byte(kLastweapon) = -1;
ax = 55;
goto gotheliframe;
notgunonheli:
ax = 5;
_inc(data.byte(kCombatcount));
_cmp(data.byte(kCombatcount), 20);
if (!flags.z())
goto gotheliframe;
data.byte(kCombatcount) = 0;
ax = 9;
gotheliframe:
es.word(bx+3) = ax;
helispeed:
showGameReel();
al = data.byte(kMapx);
es.byte(bx+1) = al;
ax = es.word(bx+3);
_cmp(ax, 9);
if (!flags.c())
goto notwaitingheli;
_cmp(data.byte(kCombatcount), 7);
if (flags.c())
goto notwaitingheli;
data.byte(kPointermode) = 2;
data.word(kWatchingtime) = 0;
return;
notwaitingheli:
data.byte(kPointermode) = 0;
data.word(kWatchingtime) = 2;
return;
heliwon:
data.byte(kPointermode) = 0;
}

void DreamGenContext::mugger() {
STACK_CHECK;
ax = es.word(bx+3);
Expand Down
1 change: 0 additions & 1 deletion engines/dreamweb/dreamgen.h
Expand Up @@ -530,7 +530,6 @@ class DreamGenContext : public DreamBase, public Context {
void findAllOpen();
void showSlots();
void deleteExObject();
void helicopter();
void getEitherAd();
void setPickup();
void dropObject();
Expand Down
52 changes: 50 additions & 2 deletions engines/dreamweb/people.cpp
Expand Up @@ -42,7 +42,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = {
NULL, &DreamGenContext::poolGuard,
NULL, &DreamGenContext::businessMan,
NULL, NULL,
&DreamGenContext::mugger, &DreamGenContext::helicopter,
&DreamGenContext::mugger, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
Expand Down Expand Up @@ -74,7 +74,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = {
&DreamGenContext::copper, /*&DreamGenContext::poolGuard*/NULL,
&DreamGenContext::rockstar, /*&DreamGenContext::businessMan*/NULL,
&DreamGenContext::train, &DreamGenContext::genericPerson /*aide*/,
/*&DreamGenContext::mugger*/NULL, /*&DreamGenContext::helicopter*/NULL,
/*&DreamGenContext::mugger*/NULL, &DreamGenContext::helicopter,
&DreamGenContext::introMagic1, &DreamGenContext::introMusic,
&DreamGenContext::introMagic2, &DreamGenContext::candles2,
&DreamGenContext::gates, &DreamGenContext::introMagic3,
Expand Down Expand Up @@ -859,4 +859,52 @@ void DreamGenContext::heavy(ReelRoutine &routine) {
addToPeopleList(&routine);
}

void DreamGenContext::helicopter(ReelRoutine &routine) {
if (routine.reelPointer() == 203) {
// Won helicopter
data.byte(kPointermode) = 0;
return;
}

if (checkSpeed(routine)) {
uint16 nextReelPointer = routine.reelPointer() + 1;
if (nextReelPointer == 53) {
// Before killing helicopter
data.byte(kCombatcount)++;
if (data.byte(kCombatcount) != 8)
data.byte(kMandead) = 2;
nextReelPointer = 49;
} else if (nextReelPointer == 9) {
nextReelPointer--;
if (data.byte(kLastweapon) == 1) {
data.byte(kLastweapon) = (byte)-1;
nextReelPointer = 55;
} else {
nextReelPointer = 5;
data.byte(kCombatcount)++;
if (data.byte(kCombatcount) == 20) {
data.byte(kCombatcount) = 0;
nextReelPointer = 9;
}
}
} else {
// Not waiting helicopter
data.byte(kPointermode) = 0;
data.word(kWatchingtime) = 2;
}

routine.setReelPointer(nextReelPointer);
}

showGameReel(&routine);
routine.mapX = data.byte(kMapx);
if (routine.reelPointer() == 9 && data.byte(kCombatcount) != 7) {
data.byte(kPointermode) = 2;
data.word(kWatchingtime) = 0;
} else {
data.byte(kPointermode) = 0;
data.word(kWatchingtime) = 2;
}
}

} // End of namespace DreamGen
1 change: 1 addition & 0 deletions engines/dreamweb/stubs.h
Expand Up @@ -418,6 +418,7 @@
void receptionist(ReelRoutine &routine);
void bartender(ReelRoutine &routine);
void heavy(ReelRoutine &routine);
void helicopter(ReelRoutine &routine);
void singleKey(uint8 key, uint16 x, uint16 y);
void loadSaveBox();
void loadKeypad();
Expand Down

0 comments on commit 93bf275

Please sign in to comment.