From 92f2e9691edf0b7466841b8f7c99f2e50eb7feda Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Sep 2006 08:39:06 +0000 Subject: Fixed handling of player occupied areas during room changes svn-id: r23826 --- engines/lure/game.cpp | 1 + engines/lure/hotspots.cpp | 11 ++++++++--- engines/lure/hotspots.h | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index 8e3d70e968..56930f5e4c 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -259,6 +259,7 @@ void Game::playerChangeRoom() { player->setRoomNumber(roomNum); //player->setPosition((newPos.x & 0xfff8) || 5, newPos.y & 0xfff8); player->setPosition(newPos.x, newPos.y); + player->setOccupied(true); room.setRoomNumber(roomNum, false); } diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 63c8b5b953..5fa8f46ac8 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -2146,9 +2146,10 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { // Walking done h.currentActions().top().setAction(DISPATCH_ACTION); - if (h.destHotspotId() != 0) + if (h.destHotspotId() != 0) { // Walking to an exit, check for any required room change Support::checkRoomChange(h); + } } h.setOccupied(true); @@ -2448,7 +2449,9 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { } // Check for whether need to change room - Support::checkRoomChange(h); + if (Support::checkRoomChange(h)) + // Player changinge room - break now to avoid resetting occupied status + break; } h.setOccupied(true); break; @@ -3461,7 +3464,7 @@ bool Support::checkForIntersectingCharacter(Hotspot &h) { // Check whether a character needs to change the room they're in -void Support::checkRoomChange(Hotspot &h) { +bool Support::checkRoomChange(Hotspot &h) { int16 x = h.x() + (h.widthCopy() >> 1); int16 y = h.y() + h.heightCopy() - (h.yCorrection() >> 1); @@ -3476,6 +3479,8 @@ void Support::checkRoomChange(Hotspot &h) { exitRec->x, exitRec->y, exitRec->direction); } } + + return (exitRec != NULL); } void Support::characterChangeRoom(Hotspot &h, uint16 roomNumber, diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h index ae35e3f148..e58567e778 100644 --- a/engines/lure/hotspots.h +++ b/engines/lure/hotspots.h @@ -40,7 +40,7 @@ private: public: static int findIntersectingCharacters(Hotspot &h, uint16 *charList); static bool checkForIntersectingCharacter(Hotspot &h); - static void checkRoomChange(Hotspot &h); + static bool checkRoomChange(Hotspot &h); static void characterChangeRoom(Hotspot &h, uint16 roomNumber, int16 newX, int16 newY, Direction dir); static bool charactersIntersecting(HotspotData *hotspot1, HotspotData *hotspot2); -- cgit v1.2.3