diff options
author | Paul Gilbert | 2007-05-20 12:39:15 +0000 |
---|---|---|
committer | Paul Gilbert | 2007-05-20 12:39:15 +0000 |
commit | 56bb400ef97cc28368fb2e831bf2ee81e9951e1f (patch) | |
tree | e391d18dd1d8cacb32fcb6b9329646fb3ccd8722 /engines | |
parent | e0159324cce0b6ad354c8eeff0484431d52b4b00 (diff) | |
download | scummvm-rg350-56bb400ef97cc28368fb2e831bf2ee81e9951e1f.tar.gz scummvm-rg350-56bb400ef97cc28368fb2e831bf2ee81e9951e1f.tar.bz2 scummvm-rg350-56bb400ef97cc28368fb2e831bf2ee81e9951e1f.zip |
Fixed several room change, NPC behaviour, and door closing code
svn-id: r26887
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lure/hotspots.cpp | 25 | ||||
-rw-r--r-- | engines/lure/res_struct.cpp | 8 |
2 files changed, 18 insertions, 15 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 82ecc295cd..290838f969 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -477,7 +477,8 @@ void Hotspot::setDirection(Direction dir) { _charRectY = 0; break; default: - break; + // No need to change + return; } setFrameNumber(newFrameNumber); @@ -547,7 +548,7 @@ void Hotspot::setRandomDest() { // Try up to 20 times to find an unoccupied destination for (int tryCtr = 0; tryCtr < 20; ++tryCtr) { xp = rect.left + rnd.getRandomNumber(rect.right - rect.left); - yp = rect.left + rnd.getRandomNumber(rect.bottom - rect.top); + yp = rect.top + rnd.getRandomNumber(rect.bottom - rect.top); setDestPosition(xp, yp); setDestHotspot(0); @@ -1033,15 +1034,16 @@ bool Hotspot::doorCloseCheck(uint16 doorId) { if ((hsCurrent->hotspotId() == 0xfffe) || (hsCurrent->hotspotId() == 0xffff)) continue; - // Check the dimensions of the animation - if ((hsCurrent->x() < bounds.right) && - ((hsCurrent->x() + hsCurrent->widthCopy()) > bounds.left) && - ((hsCurrent->y() + hsCurrent->heightCopy() + hsCurrent->charRectY()) >= bounds.top) && - ((hsCurrent->y() + hsCurrent->heightCopy() - hsCurrent->charRectY() - - hsCurrent->yCorrection()) > bounds.bottom)) { - // Return false - the door can't be closed - return false; - } + // Check to see if the character is intersecting the door area + int tempY = hsCurrent->y() + hsCurrent->heightCopy(); + if ((hsCurrent->x() >= bounds.right) || + (hsCurrent->x() + hsCurrent->widthCopy() <= bounds.left) || + (tempY + hsCurrent->charRectY() < bounds.top) || + (tempY - hsCurrent->yCorrection() - hsCurrent->charRectY() > bounds.bottom)) + continue; + + // At this point we know a character is blocking door, so return false + return false; } // No blocking characters, so return true that the door can be closed @@ -3736,6 +3738,7 @@ PathFinderResult PathFinder::process() { add(LEFT, -_xDestPos); _inProgress = false; + result = PF_OK; goto final_step; } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index fa220d719a..1d6e0ea04f 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -218,7 +218,7 @@ void RoomPathsData::decompress(RoomPathsDecompressedData &dataOut, int character // Handle padding for last row, including left/right edge padding, as // well as the right column of the second row for (paddingCtr = 0; paddingCtr < (DECODED_PATHS_WIDTH + 1); ++paddingCtr) - *pOut-- = 0xffff; + *pOut-- = 0; for (int y = 0; y < ROOM_PATHS_HEIGHT; ++y) { charState = false; @@ -258,15 +258,15 @@ void RoomPathsData::decompress(RoomPathsDecompressedData &dataOut, int character } // Store 2 words to allow off-screen row-start/prior row end - *pOut-- = 0xffff; - *pOut-- = 0xffff; + *pOut-- = 0; + *pOut-- = 0; charState = false; } // Handle padding for final top row - no need for end column, as end of prior // row provided padding for it for (paddingCtr = 0; paddingCtr < (ROOM_PATHS_WIDTH + 1); ++paddingCtr) - *pOut-- = 0xffff; + *pOut-- = 0; } // Room data class |