diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 105 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 60 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 2 |
4 files changed, 63 insertions, 107 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 23027ef6d2..478a7380e7 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3118,110 +3118,6 @@ void DreamGenContext::widedoor() { dodoor(); } -void DreamGenContext::dodoor() { - 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 rtofdoor; - _sub(al, cl); - _cmp(al, data.byte(kDoorcheck1)); - if (!flags.c()) - goto upordown; - goto shutdoor; -rtofdoor: - _sub(al, cl); - _cmp(al, data.byte(kDoorcheck2)); - if (!flags.c()) - goto shutdoor; -upordown: - _cmp(ah, ch); - if (!flags.c()) - goto botofdoor; - _sub(ah, ch); - _cmp(ah, data.byte(kDoorcheck3)); - if (flags.c()) - goto shutdoor; - goto opendoor; -botofdoor: - _sub(ah, ch); - _cmp(ah, data.byte(kDoorcheck4)); - if (!flags.c()) - goto shutdoor; -opendoor: - cl = es.byte(bx+19); - _cmp(data.byte(kThroughdoor), 1); - if (!flags.z()) - goto notthrough; - _cmp(cl, 0); - if (!flags.z()) - goto notthrough; - cl = 6; -notthrough: - _inc(cl); - _cmp(cl, 1); - if (!flags.z()) - goto notdoorsound2; - al = 0; - _cmp(data.byte(kReallocation), 5); - if (!flags.z()) - goto nothoteldoor2; - al = 13; -nothoteldoor2: - playchannel1(); -notdoorsound2: - ch = 0; - push(di); - _add(di, cx); - al = ds.byte(di+18); - _cmp(al, 255); - if (!flags.z()) - goto atlast1; - _dec(di); - _dec(cl); -atlast1: - es.byte(bx+19) = cl; - al = ds.byte(di+18); - di = pop(); - es.byte(bx+15) = al; - ds.byte(di+17) = al; - data.byte(kThroughdoor) = 1; - return; -shutdoor: - cl = es.byte(bx+19); - _cmp(cl, 5); - if (!flags.z()) - goto notdoorsound1; - al = 1; - _cmp(data.byte(kReallocation), 5); - if (!flags.z()) - goto nothoteldoor1; - al = 13; -nothoteldoor1: - playchannel1(); -notdoorsound1: - _cmp(cl, 0); - if (flags.z()) - goto atlast2; - _dec(cl); - es.byte(bx+19) = cl; -atlast2: - ch = 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, 5); - if (!flags.z()) - return /* (notnearly) */; - data.byte(kThroughdoor) = 0; -} - void DreamGenContext::lockeddoorway() { STACK_CHECK; al = data.byte(kRyanx); @@ -21798,7 +21694,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_constant: constant(); break; case addr_doorway: doorway(); break; case addr_widedoor: widedoor(); break; - case addr_dodoor: dodoor(); break; case addr_lockeddoorway: lockeddoorway(); break; case addr_updatepeople: updatepeople(); break; case addr_getreelframeax: getreelframeax(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 354a3464e8..f7e19f2eec 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -647,7 +647,6 @@ public: static const uint16 addr_getreelframeax = 0xc19c; static const uint16 addr_updatepeople = 0xc198; static const uint16 addr_lockeddoorway = 0xc194; - static const uint16 addr_dodoor = 0xc190; static const uint16 addr_widedoor = 0xc18c; static const uint16 addr_doorway = 0xc188; static const uint16 addr_constant = 0xc184; @@ -1939,7 +1938,7 @@ public: void addalong(); //void width160(); void incryanpage(); - void dodoor(); + //void dodoor(); void greyscalesum(); void buttoneight(); void opensarters(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 5ead9e3ab9..d0fdf6fd42 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -847,6 +847,66 @@ void DreamGenContext::constant(Sprite* sprite, ObjData* objData) { sprite->b15 = b18; } + +void DreamGenContext::dodoor() { + Sprite *sprite = (Sprite*)es.ptr(bx, sizeof(Sprite)); + ObjData *objData = (ObjData*)ds.ptr(di, 0); + dodoor(sprite, objData); +} + +void DreamGenContext::dodoor(Sprite* sprite, ObjData* objData) { + uint8 ryanx = data.byte(kRyanx); + uint8 ryany = data.byte(kRyany); + int8 deltax = ryanx - sprite->x; + int8 deltay = ryany - sprite->y; + if (ryanx < sprite->x) { + if (deltax < (int8)data.byte(kDoorcheck1)) + goto shutdoor; + } else { + if (deltax >= data.byte(kDoorcheck2)) + goto shutdoor; + } + if (ryany < sprite->y) { + if (deltay < (int8)data.byte(kDoorcheck3)) + goto shutdoor; + } else { + if (deltay >= data.byte(kDoorcheck4)) + goto shutdoor; + } +//opendoor: + if ((data.byte(kThroughdoor) == 1) && (sprite->frame == 0)) + sprite->frame = 6; + + ++sprite->frame; + if (sprite->frame == 1) { //doorsound2 + if (data.byte(kReallocation) == 5) //hoteldoor2 + al = 13; + else + al = 0; + playchannel1(); + } + if (objData->b18[sprite->frame] == 255) { + --sprite->frame; + } + sprite->b15 = objData->b17 = objData->b18[sprite->frame]; + data.byte(kThroughdoor) = 1; + return; +shutdoor: + if (sprite->frame == 5) { //doorsound1; + if (data.byte(kReallocation) == 5) //hoteldoor1 + al = 13; + else + al = 1; + playchannel1(); + } + if (sprite->frame != 0) { + --sprite->frame; + } + sprite->b15 = objData->b17 = objData->b18[sprite->frame]; + if (sprite->frame == 5) //nearly + data.byte(kThroughdoor) = 0; +} + void DreamGenContext::steady(Sprite* sprite, ObjData* objData) { uint8 b18 = objData->b18[0]; objData->b17 = b18; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5a4377b119..d840a8c8fa 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -29,6 +29,8 @@ void backobject(Sprite* sprite); void constant(Sprite* sprite, ObjData* objData); void steady(Sprite* sprite, ObjData* objData); + void dodoor(); + void dodoor(Sprite* sprite, ObjData* objData); void modifychar(); void lockmon(); |