From 65e2494265f1252bcd1fa4a7f80402ab6bf8ae7b Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Sat, 3 Sep 2011 11:02:03 +0200 Subject: DREAMWEB: 'turnpathon' et 'turnpathoff' ported to C++ --- engines/dreamweb/dreamgen.cpp | 48 ------------------------------------------- engines/dreamweb/dreamgen.h | 8 +++----- engines/dreamweb/pathfind.cpp | 34 +++++++++++++++++------------- engines/dreamweb/sprite.cpp | 8 ++++---- engines/dreamweb/stubs.h | 6 ++++-- 5 files changed, 31 insertions(+), 73 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 9c584bea90..9bd4f0ee63 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -14946,52 +14946,6 @@ gotfirst: al = es.byte(bx+6); } -void DreamGenContext::turnpathon() { - STACK_CHECK; - push(ax); - push(ax); - cl = 255; - ch = data.byte(kRoomnum); - _add(ch, 100); - findormake(); - ax = pop(); - getroomspaths(); - ax = pop(); - _cmp(al, 255); - if (flags.z()) - return /* (nopathon) */; - ah = 0; - _add(ax, ax); - _add(ax, ax); - _add(ax, ax); - _add(bx, ax); - al = 255; - es.byte(bx+6) = al; -} - -void DreamGenContext::turnpathoff() { - STACK_CHECK; - push(ax); - push(ax); - cl = 0; - ch = data.byte(kRoomnum); - _add(ch, 100); - findormake(); - ax = pop(); - getroomspaths(); - ax = pop(); - _cmp(al, 255); - if (flags.z()) - return /* (nopathoff) */; - ah = 0; - _add(ax, ax); - _add(ax, ax); - _add(ax, ax); - _add(bx, ax); - al = 0; - es.byte(bx+6) = al; -} - void DreamGenContext::turnanypathon() { STACK_CHECK; push(ax); @@ -18016,8 +17970,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_isitdescribed: isitdescribed(); break; case addr_findpathofpoint: findpathofpoint(); break; case addr_findfirstpath: findfirstpath(); break; - case addr_turnpathon: turnpathon(); break; - case addr_turnpathoff: turnpathoff(); break; case addr_turnanypathon: turnanypathon(); break; case addr_turnanypathoff: turnanypathoff(); break; case addr_checkifpathison: checkifpathison(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 2b8174cc79..6291994bb2 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -113,8 +113,6 @@ public: static const uint16 addr_checkifpathison = 0xca04; static const uint16 addr_turnanypathoff = 0xca00; static const uint16 addr_turnanypathon = 0xc9fc; - static const uint16 addr_turnpathoff = 0xc9f8; - static const uint16 addr_turnpathon = 0xc9f4; static const uint16 addr_findfirstpath = 0xc9f0; static const uint16 addr_findpathofpoint = 0xc9ec; static const uint16 addr_isitdescribed = 0xc9e8; @@ -1275,7 +1273,6 @@ public: void uselighter(); void showmenu(); void usepoolreader(); - void showgroup(); void startdmablock(); void useopenbox(); void clearbuffers(); @@ -1648,7 +1645,7 @@ public: void purgeanitem(); void madman(); void createpanel(); - void turnpathon(); + //void turnpathon(); void enablesoundint(); void madmanstelly(); void constant(); @@ -1766,6 +1763,7 @@ public: void drawitall(); void usestereo(); void showcurrentfile(); + //void turnpathoff(); //void copyname(); void look(); void setmouse(); @@ -1942,7 +1940,7 @@ public: void usecontrol(); void buttonseven(); void redrawmainscrn(); - void turnpathoff(); + void showgroup(); void findallryan(); //void channel0tran(); void buttonpress(); diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp index 2579105c6f..4b1d590bec 100644 --- a/engines/dreamweb/pathfind.cpp +++ b/engines/dreamweb/pathfind.cpp @@ -27,22 +27,28 @@ namespace DreamGen { -void DreamGenContext::turnpathonCPP(uint8 param) { - al = param; - push(es); - push(bx); - turnpathon(); - bx = pop(); - es = pop(); +void DreamGenContext::turnpathon() { + turnpathon(al); } -void DreamGenContext::turnpathoffCPP(uint8 param) { - al = param; - push(es); - push(bx); - turnpathoff(); - bx = pop(); - es = pop(); +void DreamGenContext::turnpathon(uint8 param) { + findormake(param, 0xff, data.byte(kRoomnum) + 100); + uint8 *roomsPaths = getroomspathsCPP(); + if (param == 0xff) + return; + roomsPaths[8 * param + 6] = 0xff; +} + +void DreamGenContext::turnpathoff() { + turnpathoff(al); +} + +void DreamGenContext::turnpathoff(uint8 param) { + findormake(param, 0x00, data.byte(kRoomnum) + 100); + uint8 *roomsPaths = getroomspathsCPP(); + if (param == 0xff) + return; + roomsPaths[8 * param + 6] = 0x00; } void DreamGenContext::getroomspaths() { diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 7b41bbddab..13db909dbe 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -414,7 +414,7 @@ void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) { } if (sprite->frame == 6) { - turnpathonCPP(data.byte(kDoorpath)); + turnpathon(data.byte(kDoorpath)); } if ((data.byte(kThroughdoor) == 1) && (sprite->frame == 0)) { @@ -445,7 +445,7 @@ shutdoor2: sprite->b15 = objData->index = objData->b18[sprite->frame]; if (sprite->frame == 0) { - turnpathoffCPP(data.byte(kDoorpath)); + turnpathoff(data.byte(kDoorpath)); data.byte(kLockstatus) = 1; } } @@ -453,7 +453,7 @@ shutdoor2: void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) { uint8 liftFlag = data.byte(kLiftflag); if (liftFlag == 0) { //liftclosed - turnpathoffCPP(data.byte(kLiftpath)); + turnpathoff(data.byte(kLiftpath)); if (data.byte(kCounttoopen) != 0) { _dec(data.byte(kCounttoopen)); @@ -464,7 +464,7 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) { sprite->b15 = objData->index = objData->b18[sprite->frame]; } else if (liftFlag == 1) { //liftopen - turnpathonCPP(data.byte(kLiftpath)); + turnpathon(data.byte(kLiftpath)); if (data.byte(kCounttoclose) != 0) { _dec(data.byte(kCounttoclose)); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index d085fb880b..57016a4f67 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -103,8 +103,10 @@ void showreelframe(); void showreelframe(Reel *reel); const Frame *getreelframeax(uint16 frame); - void turnpathonCPP(uint8 param); - void turnpathoffCPP(uint8 param); + void turnpathon(uint8 param); + void turnpathoff(uint8 param); + void turnpathon(); + void turnpathoff(); void getroomspaths(); uint8 *getroomspathsCPP(); void makebackob(SetObject *objData); -- cgit v1.2.3