aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-16 00:02:57 +0200
committerFilippos Karapetis2011-12-16 00:02:57 +0200
commit6792fa2fb650d4ac225b4b4352b41fd17323c4c4 (patch)
treebbd63e1081a1414d9e4d181b01ec5df03258fd0d /engines/dreamweb
parent60f9b91ced244fd7bdb822cc4471a937d38d6179 (diff)
downloadscummvm-rg350-6792fa2fb650d4ac225b4b4352b41fd17323c4c4.tar.gz
scummvm-rg350-6792fa2fb650d4ac225b4b4352b41fd17323c4c4.tar.bz2
scummvm-rg350-6792fa2fb650d4ac225b4b4352b41fd17323c4c4.zip
DREAMWEB: Port 'businessman' to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp97
-rw-r--r--engines/dreamweb/dreamgen.h1
-rw-r--r--engines/dreamweb/people.cpp68
-rw-r--r--engines/dreamweb/stubs.h1
4 files changed, 67 insertions, 100 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 8892c84b2d..e4a5411ed7 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -26,103 +26,6 @@
namespace DreamGen {
-void DreamGenContext::businessMan() {
- STACK_CHECK;
- data.byte(kPointermode) = 0;
- data.word(kWatchingtime) = 2;
- ax = es.word(bx+3);
- _cmp(ax, 2);
- if (!flags.z())
- goto notfirstbiz;
- push(ax);
- push(bx);
- push(es);
- al = 49;
- cx = 30;
- dx = 1;
- bl = 68;
- bh = 174;
- setupTimedUse();
- es = pop();
- bx = pop();
- ax = pop();
-notfirstbiz:
- _cmp(ax, 95);
- if (flags.z())
- goto buscombatwonend;
- _cmp(ax, 49);
- if (flags.z())
- return /* (buscombatend) */;
- checkSpeed();
- if (!flags.z())
- goto busspeed;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 48);
- if (!flags.z())
- goto notbeforedeadb;
- data.byte(kMandead) = 2;
- goto gotbusframe;
-notbeforedeadb:
- _cmp(ax, 15);
- if (!flags.z())
- goto buscombatwon;
- _dec(ax);
- _cmp(data.byte(kLastweapon), 3);
- if (!flags.z())
- goto notshieldonbus;
- data.byte(kLastweapon) = -1;
- data.byte(kCombatcount) = 0;
- ax = 51;
- goto gotbusframe;
-notshieldonbus:
- _inc(data.byte(kCombatcount));
- _cmp(data.byte(kCombatcount), 20);
- if (!flags.z())
- goto gotbusframe;
- data.byte(kCombatcount) = 0;
- ax = 15;
- goto gotbusframe;
-buscombatwon:
- _cmp(ax, 91);
- if (!flags.z())
- goto gotbusframe;
- push(bx);
- push(es);
- al = 0;
- turnPathOn();
- al = 1;
- turnPathOn();
- al = 2;
- turnPathOn();
- al = 3;
- turnPathOff();
- data.byte(kManspath) = 5;
- data.byte(kFinaldest) = 5;
- findXYFromPath();
- data.byte(kResetmanxy) = 1;
- es = pop();
- bx = pop();
- ax = 92;
- goto gotbusframe;
-gotbusframe:
- es.word(bx+3) = ax;
-busspeed:
- showGameReel();
- al = data.byte(kMapy);
- es.byte(bx+2) = al;
- ax = es.word(bx+3);
- _cmp(ax, 14);
- if (!flags.z())
- return /* (buscombatend) */;
- data.word(kWatchingtime) = 0;
- data.byte(kPointermode) = 2;
- return;
-buscombatwonend:
- data.byte(kPointermode) = 0;
- data.word(kWatchingtime) = 0;
-}
-
void DreamGenContext::poolGuard() {
STACK_CHECK;
ax = es.word(bx+3);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 5a61fcb33e..87b769f79e 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -509,7 +509,6 @@ public:
void selectOb();
void fadeUpMon();
void reExFromInv();
- void businessMan();
void outOfInv();
void transferMap();
void purgeAnItem();
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
index e4e368211e..003921b163 100644
--- a/engines/dreamweb/people.cpp
+++ b/engines/dreamweb/people.cpp
@@ -40,7 +40,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = {
NULL, NULL,
NULL, NULL,
NULL, &DreamGenContext::poolGuard,
- NULL, &DreamGenContext::businessMan,
+ NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
@@ -72,7 +72,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = {
&DreamGenContext::keeper, &DreamGenContext::candles1,
&DreamGenContext::smallCandle, &DreamGenContext::security,
&DreamGenContext::copper, /*&DreamGenContext::poolGuard*/NULL,
- &DreamGenContext::rockstar, /*&DreamGenContext::businessMan*/NULL,
+ &DreamGenContext::rockstar, &DreamGenContext::businessMan,
&DreamGenContext::train, &DreamGenContext::genericPerson /*aide*/,
&DreamGenContext::mugger, &DreamGenContext::helicopter,
&DreamGenContext::introMagic1, &DreamGenContext::introMusic,
@@ -948,4 +948,68 @@ void DreamGenContext::mugger(ReelRoutine &routine) {
}
}
+void DreamGenContext::businessMan(ReelRoutine &routine) {
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 2;
+ if (routine.reelPointer() == 2) {
+ // First
+ DreamBase::setupTimedUse(49, 30, 1, 68, 174);
+ return;
+ }
+
+ if (routine.reelPointer() == 95) {
+ // Bus combat won - end
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 0;
+ return;
+ }
+
+ if (routine.reelPointer() == 49)
+ return; // buscombatend
+
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 48) {
+ data.byte(kMandead) = 2; // before dead body
+ } else if (nextReelPointer == 15) {
+ nextReelPointer--;
+ if (data.byte(kLastweapon) == 3) {
+ // Shield bonus
+ data.byte(kLastweapon) = (byte)-1;
+ data.byte(kCombatcount) = 0;
+ nextReelPointer = 51;
+ } else {
+ // No shield bonus
+ data.byte(kCombatcount)++;
+ if (data.byte(kCombatcount) == 20) {
+ data.byte(kCombatcount) = 0;
+ nextReelPointer = 15;
+ }
+ }
+ } else {
+ // Bus combat won
+ if (nextReelPointer == 91) {
+ turnPathOn(0);
+ turnPathOn(1);
+ turnPathOn(2);
+ turnPathOff(3);
+ data.byte(kManspath) = 5;
+ data.byte(kFinaldest) = 5;
+ findXYFromPath();
+ data.byte(kResetmanxy) = 1;
+ nextReelPointer = 92;
+ }
+ }
+
+ routine.setReelPointer(nextReelPointer);
+ }
+
+ showGameReel(&routine);
+ routine.mapY = data.byte(kMapy);
+ if (routine.reelPointer() == 14) {
+ data.word(kWatchingtime) = 0;
+ data.byte(kPointermode) = 2;
+ }
+}
+
} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 33e43eba32..5b012d580e 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -383,6 +383,7 @@
void heavy(ReelRoutine &routine);
void helicopter(ReelRoutine &routine);
void mugger(ReelRoutine &routine);
+ void businessMan(ReelRoutine &routine);
void singleKey(uint8 key, uint16 x, uint16 y);
void loadSaveBox();
uint8 nextSymbol(uint8 symbol);