aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--saga/actor.cpp22
-rw-r--r--saga/sprite.cpp13
2 files changed, 30 insertions, 5 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 5109293e5b..7b722c6f75 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -1256,11 +1256,33 @@ void Actor::calcScreenPosition(CommonObjectData *commonObjectData) {
}
uint16 Actor::hitTest(const Point &testPoint, bool skipProtagonist) {
+ // We can only interact with objects or actors that are inside the
+ // scene area. While this is usually the upper part of the screen, it
+ // could also be an inset. Note that other kinds of hit areas may be
+ // outside the inset, and that those are still perfectly fine to
+ // interact with. For example, the door entrance at the glass makers
+ // in ITE's ferret village.
+
+ SCENE_BGINFO bg_info;
+ Common::Rect sceneRect;
+
+ _vm->_scene->getBGInfo(&bg_info);
+
+ sceneRect.left = bg_info.bg_x;
+ sceneRect.top = bg_info.bg_y;
+ sceneRect.right = bg_info.bg_x + bg_info.bg_w;
+ sceneRect.bottom = bg_info.bg_y + bg_info.bg_h;
+
+ if (!sceneRect.contains(testPoint))
+ return ID_NOTHING;
+
CommonObjectOrderList::iterator drawOrderIterator;
CommonObjectDataPointer drawObject;
int frameNumber;
SpriteList *spriteList;
+
createDrawOrderList();
+
for (drawOrderIterator = _drawOrderList.begin(); drawOrderIterator != _drawOrderList.end(); ++drawOrderIterator) {
drawObject = drawOrderIterator.operator*();
if (skipProtagonist && (drawObject == _protagonist)) {
diff --git a/saga/sprite.cpp b/saga/sprite.cpp
index ac07ec3cf4..64447eefa0 100644
--- a/saga/sprite.cpp
+++ b/saga/sprite.cpp
@@ -338,10 +338,14 @@ int Sprite::drawOccluded(SURFACE *ds, SpriteList &spriteList, int spriteNumber,
spriteSourceRect.right = width;
spriteSourceRect.bottom = height;
- spriteDestRect.left = 0;
- spriteDestRect.top = 0;
- spriteDestRect.right = ds->clip_rect.right;
- spriteDestRect.bottom = MIN(ds->clip_rect.bottom, (int16)maskHeight);
+ SCENE_BGINFO bg_info;
+
+ _vm->_scene->getBGInfo(&bg_info);
+
+ spriteDestRect.left = bg_info.bg_x;
+ spriteDestRect.top = bg_info.bg_y;
+ spriteDestRect.right = bg_info.bg_x + bg_info.bg_w;
+ spriteDestRect.bottom = bg_info.bg_y + bg_info.bg_h;
ci.dst_rect = &spriteDestRect;
ci.src_rect = &spriteSourceRect;
@@ -353,7 +357,6 @@ int Sprite::drawOccluded(SURFACE *ds, SpriteList &spriteList, int spriteNumber,
return SUCCESS;
}
-
// Finally, draw the occluded sprite
src_row_p = spriteBuffer + ci.src_draw_x + (ci.src_draw_y * width);