aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreamgen.cpp123
-rw-r--r--engines/dreamweb/dreamgen.h3
-rw-r--r--engines/dreamweb/stubs.cpp82
-rw-r--r--engines/dreamweb/stubs.h2
4 files changed, 84 insertions, 126 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 1aac7311d5..7ec64263da 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2984,128 +2984,6 @@ void DreamGenContext::widedoor() {
dodoor();
}
-void DreamGenContext::lockeddoorway() {
- STACK_CHECK;
- al = data.byte(kRyanx);
- ah = data.byte(kRyany);
- cl = es.byte(bx+10);
- ch = es.byte(bx+11);
- _cmp(al, cl);
- if (!flags.c())
- goto rtofdoor2;
- _sub(al, cl);
- _cmp(al, -24);
- if (!flags.c())
- goto upordown2;
- goto shutdoor2;
-rtofdoor2:
- _sub(al, cl);
- _cmp(al, 10);
- if (!flags.c())
- goto shutdoor2;
-upordown2:
- _cmp(ah, ch);
- if (!flags.c())
- goto botofdoor2;
- _sub(ah, ch);
- _cmp(ah, -30);
- if (flags.c())
- goto shutdoor2;
- goto opendoor2;
-botofdoor2:
- _sub(ah, ch);
- _cmp(ah, 12);
- if (!flags.c())
- goto shutdoor2;
-opendoor2:
- _cmp(data.byte(kThroughdoor), 1);
- if (flags.z())
- goto mustbeopen;
- _cmp(data.byte(kLockstatus), 1);
- if (flags.z())
- goto shutdoor2;
-mustbeopen:
- cl = es.byte(bx+19);
- _cmp(cl, 1);
- if (!flags.z())
- goto notdoorsound4;
- al = 0;
- playchannel1();
-notdoorsound4:
- _cmp(cl, 6);
- if (!flags.z())
- goto noturnonyet;
- al = data.byte(kDoorpath);
- push(es);
- push(bx);
- turnpathon();
- bx = pop();
- es = pop();
-noturnonyet:
- cl = es.byte(bx+19);
- _cmp(data.byte(kThroughdoor), 1);
- if (!flags.z())
- goto notthrough2;
- _cmp(cl, 0);
- if (!flags.z())
- goto notthrough2;
- cl = 6;
-notthrough2:
- _inc(cl);
- ch = 0;
- push(di);
- _add(di, cx);
- al = ds.byte(di+18);
- _cmp(al, 255);
- if (!flags.z())
- goto atlast3;
- _dec(di);
- _dec(cl);
-atlast3:
- es.byte(bx+19) = cl;
- al = ds.byte(di+18);
- di = pop();
- es.byte(bx+15) = al;
- ds.byte(di+17) = al;
- _cmp(cl, 5);
- if (!flags.z())
- return /* (justshutting) */;
- data.byte(kThroughdoor) = 1;
- return;
-shutdoor2:
- cl = es.byte(bx+19);
- _cmp(cl, 5);
- if (!flags.z())
- goto notdoorsound3;
- al = 1;
- playchannel1();
-notdoorsound3:
- _cmp(cl, 0);
- if (flags.z())
- goto atlast4;
- _dec(cl);
- es.byte(bx+19) = cl;
-atlast4:
- ch = 0;
- data.byte(kThroughdoor) = 0;
- push(di);
- _add(di, cx);
- al = ds.byte(di+18);
- di = pop();
- es.byte(bx+15) = al;
- ds.byte(di+17) = al;
- _cmp(cl, 0);
- if (!flags.z())
- return /* (notlocky) */;
- al = data.byte(kDoorpath);
- push(es);
- push(bx);
- turnpathoff();
- bx = pop();
- es = pop();
- data.byte(kLockstatus) = 1;
-}
-
void DreamGenContext::updatepeople() {
STACK_CHECK;
es = data.word(kBuffers);
@@ -21048,7 +20926,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_constant: constant(); break;
case addr_doorway: doorway(); break;
case addr_widedoor: widedoor(); break;
- case addr_lockeddoorway: lockeddoorway(); break;
case addr_updatepeople: updatepeople(); break;
case addr_getreelframeax: getreelframeax(); break;
case addr_reelsonscreen: reelsonscreen(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index c2aa204942..037fd2ad2a 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -657,7 +657,6 @@ public:
static const uint16 addr_reelsonscreen = 0xc1a0;
static const uint16 addr_getreelframeax = 0xc19c;
static const uint16 addr_updatepeople = 0xc198;
- static const uint16 addr_lockeddoorway = 0xc194;
static const uint16 addr_widedoor = 0xc18c;
static const uint16 addr_doorway = 0xc188;
static const uint16 addr_constant = 0xc184;
@@ -1338,7 +1337,7 @@ public:
void clearbuffers();
void neterror();
void storeit();
- void lockeddoorway();
+ //void lockeddoorway();
void isitworn();
//void putundertimed();
void dumpmap();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 28c52e17d5..dff3756745 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1273,7 +1273,7 @@ void DreamGenContext::backobject(Sprite *sprite) {
else if (objData->type == 5)
random(sprite, objData);
else if (objData->type == 4)
- lockeddoorway();
+ lockeddoorway(sprite, objData);
else if (objData->type == 3)
liftsprite(sprite, objData);
else if (objData->type == 2)
@@ -1402,6 +1402,86 @@ void DreamGenContext::turnpathoffCPP(uint8 param) {
es = pop();
}
+void DreamGenContext::lockeddoorway() {
+ Sprite *sprite = (Sprite *)es.ptr(bx, sizeof(Sprite));
+ ObjData *objData = (ObjData *)ds.ptr(di, 0);
+ lockeddoorway(sprite, objData);
+}
+
+void DreamGenContext::lockeddoorway(Sprite *sprite, ObjData *objData) {
+ if (data.byte(kRyanx) < sprite->x) {
+ if (sprite->x - data.byte(kRyanx) > 24)
+ goto shutdoor2;
+ } else {
+ if (data.byte(kRyanx) - sprite->x >= 10)
+ goto shutdoor2;
+ }
+
+ if (data.byte(kRyany) < sprite->y) {
+ if (sprite->y - data.byte(kRyany) > 30)
+ goto shutdoor2;
+ } else {
+ if (data.byte(kRyany) - sprite->y >= 12)
+ goto shutdoor2;
+ }
+
+ if (data.byte(kThroughdoor) != 1) {
+ if (data.byte(kLockstatus) == 1)
+ goto shutdoor2;
+ }
+
+ if (sprite->frame == 1) {
+ al = 0;
+ playchannel1();
+ }
+
+ if (sprite->frame == 6) {
+ al = data.byte(kDoorpath);
+ push(es);
+ push(bx);
+ turnpathon();
+ bx = pop();
+ es = pop();
+ }
+
+ if ((data.byte(kThroughdoor) == 1) && (sprite->frame == 0)) {
+ sprite->frame = 6;
+ }
+
+ ++sprite->frame;
+ if (objData->b18[sprite->frame] == 255) {
+ --sprite->frame;
+ }
+
+ sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ if (sprite->frame == 5)
+ data.byte(kThroughdoor) = 1;
+ return;
+
+shutdoor2:
+ if (sprite->frame == 5) {
+ al = 1;
+ playchannel1();
+ }
+
+ if (sprite->frame != 0) {
+ --sprite->frame;
+ }
+
+ data.byte(kThroughdoor) = 0;
+ sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+
+ if (sprite->frame == 0) {
+ al = data.byte(kDoorpath);
+ push(es);
+ push(bx);
+ turnpathoff();
+ bx = pop();
+ es = pop();
+ data.byte(kLockstatus) = 1;
+ }
+}
+
void DreamGenContext::liftsprite() {
Sprite *sprite = (Sprite *)es.ptr(bx, sizeof(Sprite));
ObjData *objData = (ObjData *)ds.ptr(di, 0);
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 20d987d374..f173a84b83 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -80,6 +80,8 @@
void dodoor(Sprite *sprite, ObjData *objData);
void doorway(Sprite *sprite, ObjData *objData);
void widedoor(Sprite *sprite, ObjData *objData);
+ void lockeddoorway();
+ void lockeddoorway(Sprite *sprite, ObjData *objData);
void liftsprite();
void liftsprite(Sprite *sprite, ObjData *objData);
void turnpathonCPP(uint8 param);