diff options
author | Filippos Karapetis | 2007-06-11 01:22:45 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-06-11 01:22:45 +0000 |
commit | 7522d4ea51201b8c234725adcb60e9348a0e9021 (patch) | |
tree | 5a6414b7a73f5e116f8bd18f78749d6c47ef195a | |
parent | e0b8d4ef53c8ba9b6fa2eb8dbc68a84200f1f68b (diff) | |
download | scummvm-rg350-7522d4ea51201b8c234725adcb60e9348a0e9021.tar.gz scummvm-rg350-7522d4ea51201b8c234725adcb60e9348a0e9021.tar.bz2 scummvm-rg350-7522d4ea51201b8c234725adcb60e9348a0e9021.zip |
Fix for stacked objects in IHNM. It is now possible to interact with the chalk in Ted's chapter
svn-id: r27337
-rw-r--r-- | engines/saga/actor.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp index f108820136..57cbcb77cc 100644 --- a/engines/saga/actor.cpp +++ b/engines/saga/actor.cpp @@ -1671,6 +1671,20 @@ uint16 Actor::hitTest(const Point &testPoint, bool skipProtagonist) { // fine to interact with. For example, the door entrance at the glass // makers's house in ITE's ferret village. + // Note that in IHNM, there are some items that overlap on other items + // Since we're checking the draw list from the FIRST item drawn to the + // LAST one, sometimes the object drawn first is incorrectly returned. + // An example is the chalk on the magic circle in Ted's chapter, which + // is drawn AFTER the circle, but HitTest incorrectly returns the circle + // id in this case, even though the chalk was drawn after the circle. + // Therefore, for IHNM, we iterate through the whole draw list and + // return the last match found, not the first one. + // Unfortunately, it is only possible to search items in the sorted draw + // list from start to end, not reverse, so it's necessary to search + // through the whole list to get the item drawn last + + uint16 result = ID_NOTHING; + if (!_vm->_scene->getSceneClip().contains(testPoint)) return ID_NOTHING; @@ -1690,10 +1704,12 @@ uint16 Actor::hitTest(const Point &testPoint, bool skipProtagonist) { continue; } if (_vm->_sprite->hitTest(*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, testPoint)) { - return drawObject->_id; + result = drawObject->_id; + if (_vm->getGameType() == GType_ITE) + return result; // in ITE, return the first result found (read above) } } - return ID_NOTHING; + return result; // in IHNM, return the last result found (read above) } void Actor::createDrawOrderList() { |