aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorMax Horn2011-12-20 11:23:51 +0100
committerMax Horn2011-12-23 10:18:01 +0100
commitb6e139d112b08d9280c145ae40f6324be6707efe (patch)
treeb025b21b0f7eaf9f980569699e41fda580a734c0 /engines/dreamweb
parentf41412186ba7bf3748428b572a3e5147d4313064 (diff)
downloadscummvm-rg350-b6e139d112b08d9280c145ae40f6324be6707efe.tar.gz
scummvm-rg350-b6e139d112b08d9280c145ae40f6324be6707efe.tar.bz2
scummvm-rg350-b6e139d112b08d9280c145ae40f6324be6707efe.zip
DREAMWEB: Convert resetLocation and purgeALocation to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreambase.h2
-rw-r--r--engines/dreamweb/dreamgen.cpp82
-rw-r--r--engines/dreamweb/dreamgen.h2
-rw-r--r--engines/dreamweb/object.cpp35
-rw-r--r--engines/dreamweb/stubs.cpp9
-rw-r--r--engines/dreamweb/use.cpp3
6 files changed, 41 insertions, 92 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 01772bb2ff..5acdca0ac9 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -143,6 +143,7 @@ public:
void showArrows();
uint8 getLocation(uint8 index);
void setLocation(uint8 index);
+ void resetLocation(uint8 index);
// from object.cpp
void obIcons();
@@ -154,6 +155,7 @@ public:
void deleteExObject(uint8 index);
void deleteExFrame(uint8 frameNum);
void deleteExText(uint8 textNum);
+ void purgeALocation(uint8 index);
// from pathfind.cpp
void turnPathOn(uint8 param);
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index c2d8530b25..e23a0a7983 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -1130,37 +1130,6 @@ void DreamGenContext::transferConToEx() {
ds.byte(si+2) = 255;
}
-void DreamGenContext::purgeALocation() {
- STACK_CHECK;
- push(ax);
- es = data.word(kExtras);
- di = (0+2080+30000);
- bx = pop();
- cx = 0;
-purgeloc:
- _cmp(bl, es.byte(di+0));
- if (!flags.z())
- goto dontpurge;
- _cmp(es.byte(di+2), 0);
- if (!flags.z())
- goto dontpurge;
- push(di);
- push(es);
- push(bx);
- push(cx);
- deleteExObject();
- cx = pop();
- bx = pop();
- es = pop();
- di = pop();
-dontpurge:
- _add(di, 16);
- _inc(cx);
- _cmp(cx, (114));
- if (!flags.z())
- goto purgeloc;
-}
-
void DreamGenContext::emergencyPurge() {
STACK_CHECK;
checkpurgeagain:
@@ -1491,57 +1460,6 @@ void DreamGenContext::getDestInfo() {
ax = pop();
}
-void DreamGenContext::resetLocation() {
- STACK_CHECK;
- push(ax);
- _cmp(al, 5);
- if (!flags.z())
- goto notdelhotel;
- purgeALocation();
- al = 21;
- purgeALocation();
- al = 22;
- purgeALocation();
- al = 27;
- purgeALocation();
- goto clearedlocations;
-notdelhotel:
- _cmp(al, 8);
- if (!flags.z())
- goto notdeltvstud;
- purgeALocation();
- al = 28;
- purgeALocation();
- goto clearedlocations;
-notdeltvstud:
- _cmp(al, 6);
- if (!flags.z())
- goto notdelsarters;
- purgeALocation();
- al = 20;
- purgeALocation();
- al = 25;
- purgeALocation();
- goto clearedlocations;
-notdelsarters:
- _cmp(al, 13);
- if (!flags.z())
- goto notdelboathouse;
- purgeALocation();
- al = 29;
- purgeALocation();
- goto clearedlocations;
-notdelboathouse:
-clearedlocations:
- ax = pop();
- ah = 0;
- bx = ax;
- dx = data;
- es = dx;
- _add(bx, 555);
- es.byte(bx) = 0;
-}
-
void DreamGenContext::dirCom() {
STACK_CHECK;
cx = 30;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 92b75a287a..de710a20d1 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -469,7 +469,6 @@ public:
void getObTextStart();
void checkObjectSize();
void doSomeTalk();
- void resetLocation();
void outOfOpen();
void dirCom();
void findFirstPath();
@@ -481,7 +480,6 @@ public:
void reExFromInv();
void transferMap();
void purgeAnItem();
- void purgeALocation();
void getSetAd();
void findOpenPos();
void searchForSame();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 8553f41ee8..6aa1364002 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -631,4 +631,39 @@ void DreamGenContext::outOfInv() {
delPointer();
}
+void DreamBase::resetLocation(uint8 index) {
+ if (index == 5) {
+ // delete hotel
+ purgeALocation(5);
+ purgeALocation(21);
+ purgeALocation(22);
+ purgeALocation(27);
+ } else if (index == 8) {
+ // delete TV studio
+ purgeALocation(8);
+ purgeALocation(28);
+ } else if (index == 6) {
+ // delete sarters
+ purgeALocation(6);
+ purgeALocation(20);
+ purgeALocation(25);
+ } else if (index == 13) {
+ // delete boathouse
+ purgeALocation(13);
+ purgeALocation(29);
+ }
+
+ data.byte(kRoomscango + index) = 0;
+}
+
+void DreamBase::purgeALocation(uint8 index) {
+ // index == al
+ for (uint8 i = 0; i < kNumexobjects; ++i) {
+ DynObject *t = getExAd(i);
+ if (t->currentLocation == index && t->mapad[0] == 0) {
+ deleteExObject(i);
+ }
+ }
+}
+
} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 137fad4526..894c247e5b 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -3901,8 +3901,7 @@ void DreamGenContext::useButtonA() {
void DreamGenContext::autoAppear() {
if (data.byte(kLocation) == 32) {
// In alley
- al = 5;
- resetLocation();
+ resetLocation(5);
setLocation(10);
data.byte(kDestpos) = 10;
return;
@@ -3932,8 +3931,7 @@ void DreamGenContext::autoAppear() {
if (data.byte(kReallocation) == 25) {
// Sart roof
data.byte(kNewsitem) = 3;
- al = 6;
- resetLocation();
+ resetLocation(6);
setLocation(11);
data.byte(kDestpos) = 11;
} else {
@@ -4013,8 +4011,7 @@ void DreamGenContext::entryAnims() {
data.byte(kSpeedcount) = 1;
break;
case 44: // Sparky's
- al = 8;
- resetLocation();
+ resetLocation(8);
data.word(kWatchingtime) = 50*2;
data.word(kReeltowatch) = 247;
data.word(kEndwatchreel) = 297;
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index f6406dc773..d3dda0e0a0 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -823,8 +823,7 @@ void DreamGenContext::useGun() {
} else if (data.byte(kReallocation) == 29) {
// aide
data.byte(kGetback) = 1;
- al = 13;
- resetLocation();
+ resetLocation(13);
setLocation(12);
data.byte(kDestpos) = 12;
data.byte(kDestination) = 2;