aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/hotspots.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2009-07-23 10:49:30 +0000
committerPaul Gilbert2009-07-23 10:49:30 +0000
commit53783575d8291c9cf29db6c78029c2a5ac977081 (patch)
treeb1628effbf6d65db5fcf840df6f38660c1c02094 /engines/lure/hotspots.cpp
parentc8d7b677f864dde05a5544d3b0cb6cac3c22fcbe (diff)
downloadscummvm-rg350-53783575d8291c9cf29db6c78029c2a5ac977081.tar.gz
scummvm-rg350-53783575d8291c9cf29db6c78029c2a5ac977081.tar.bz2
scummvm-rg350-53783575d8291c9cf29db6c78029c2a5ac977081.zip
Bugfix for player blocking room entrance causing NPCs trying to enter getting an excessive number of action entries
svn-id: r42676
Diffstat (limited to 'engines/lure/hotspots.cpp')
-rw-r--r--engines/lure/hotspots.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index 969d8215fb..5231c9217f 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -2691,7 +2691,19 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) {
return;
}
h.currentActions().top().setAction(WALKING);
- h.setPosition(h.x(), h.y() & 0xfff8);
+
+ // WORKAROUND: A character that had enteredg an exit area might have been blocked from entering the new room.
+ // The Y position adjust below could thus place a character further into the exit area. So don't do the
+ // position adjustment if the user is already in an exit area
+ int16 x = h.x() + (h.widthCopy() >> 1);
+ int16 y = h.y() + h.heightCopy() - (h.yCorrection() >> 1);
+
+ RoomData *roomData = Resources::getReference().getRoom(h.roomNumber());
+ RoomExitData *exitRec = roomData->exits.checkExits(x, y);
+
+ if (!exitRec)
+ h.setPosition(h.x(), h.y() & 0xfff8);
+
} else if (h.blockedState() == BS_FINAL) {
// If this point is reached, the character twice hasn't found a walking path
debugC(ERROR_DETAILED, kLureDebugAnimations, "Character is hopelessly blocked");