diff options
-rw-r--r-- | engines/dreamweb/dreambase.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/pathfind.cpp | 19 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
3 files changed, 11 insertions, 12 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index eeb1fa21e7..b1bdf62126 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -60,6 +60,9 @@ public: } public: + // from pathfind.cpp + void checkDest(const RoomPaths *roomsPaths); + // from print.cpp uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount); uint8 getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset); diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp index 986cdbeb8f..9f6a382a11 100644 --- a/engines/dreamweb/pathfind.cpp +++ b/engines/dreamweb/pathfind.cpp @@ -105,8 +105,7 @@ void DreamGenContext::setWalk() { } void DreamGenContext::autoSetWalk() { - al = data.byte(kManspath); - if (data.byte(kFinaldest) == al) + if (data.byte(kFinaldest) == data.byte(kManspath)) return; const RoomPaths *roomsPaths = getRoomsPaths(); checkDest(roomsPaths); @@ -123,21 +122,19 @@ void DreamGenContext::autoSetWalk() { data.byte(kLinepointer) = 0; } -void DreamGenContext::checkDest(const RoomPaths *roomsPaths) { +void DreamBase::checkDest(const RoomPaths *roomsPaths) { const PathSegment *segments = roomsPaths->segments; - ah = data.byte(kManspath) << 4; - al = data.byte(kDestination); + const uint8 tmp = data.byte(kManspath) << 4; uint8 destination = data.byte(kDestination); for (size_t i = 0; i < 24; ++i) { - dh = segments[i].b0 & 0xf0; - dl = segments[i].b0 & 0x0f; - if (ax == dx) { + if ((segments[i].b0 & 0xf0) == tmp && + (segments[i].b0 & 0x0f) == data.byte(kDestination)) { data.byte(kDestination) = segments[i].b1 & 0x0f; return; } - dl = (segments[i].b0 & 0xf0) >> 4; - dh = (segments[i].b0 & 0x0f) << 4; - if (ax == dx) { + + if (((segments[i].b0 & 0x0f) << 4) == tmp && + ((segments[i].b0 & 0xf0) >> 4) == data.byte(kDestination)) { destination = segments[i].b1 & 0x0f; } } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 85253c2b77..266f62fabb 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -102,7 +102,6 @@ void faceRightWay(); void walking(Sprite *sprite); void autoSetWalk(); - void checkDest(const RoomPaths *roomsPaths); void aboutTurn(Sprite *sprite); void backObject(Sprite *sprite); void backObject(); |