aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-15 12:15:22 +0200
committerFilippos Karapetis2011-12-15 12:15:22 +0200
commit93bf275f4c9ef168ceab23a07a1219d2c78b65ec (patch)
tree62bded48435bd7955d706b06d5bcf326f3ca8d44 /engines/dreamweb
parentfaab2d761d103de3c019dc1c979d3940191abc96 (diff)
downloadscummvm-rg350-93bf275f4c9ef168ceab23a07a1219d2c78b65ec.tar.gz
scummvm-rg350-93bf275f4c9ef168ceab23a07a1219d2c78b65ec.tar.bz2
scummvm-rg350-93bf275f4c9ef168ceab23a07a1219d2c78b65ec.zip
DREAMWEB: Port 'helicopter' to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp65
-rw-r--r--engines/dreamweb/dreamgen.h1
-rw-r--r--engines/dreamweb/people.cpp52
-rw-r--r--engines/dreamweb/stubs.h1
4 files changed, 51 insertions, 68 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index dfeda18d6c..2ee3d512cd 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -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);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index e530a3b968..582caa712f 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -530,7 +530,6 @@ public:
void findAllOpen();
void showSlots();
void deleteExObject();
- void helicopter();
void getEitherAd();
void setPickup();
void dropObject();
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
index 99a83f44d3..e060df9fcc 100644
--- a/engines/dreamweb/people.cpp
+++ b/engines/dreamweb/people.cpp
@@ -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,
@@ -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,
@@ -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
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 3413c5eef0..8218a1ac0f 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -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();