aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/stubs.cpp
diff options
context:
space:
mode:
authorBertrand Augereau2011-07-25 10:50:00 +0200
committerBertrand Augereau2011-07-28 17:26:45 +0200
commita101204422db7928aafcea1ff1e110979aa82c1b (patch)
treea2c15da7970a5df8c176287ec5d1ef3f1e8a7620 /engines/dreamweb/stubs.cpp
parentfcd698c289a801e6e6b1e9fb76d22c3753c3ca41 (diff)
downloadscummvm-rg350-a101204422db7928aafcea1ff1e110979aa82c1b.tar.gz
scummvm-rg350-a101204422db7928aafcea1ff1e110979aa82c1b.tar.bz2
scummvm-rg350-a101204422db7928aafcea1ff1e110979aa82c1b.zip
DREAMWEB: Ported 'lockeddoorway'
Diffstat (limited to 'engines/dreamweb/stubs.cpp')
-rw-r--r--engines/dreamweb/stubs.cpp82
1 files changed, 81 insertions, 1 deletions
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);