DREAMWEB: Move checkDest() to DreamBase

This commit is contained in:
Max Horn 2011-12-07 15:37:59 +01:00
parent c6ec610d5c
commit 8b0ecc7462
3 changed files with 11 additions and 12 deletions

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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();