aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-07-05 06:12:40 +0000
committerTorbjörn Andersson2005-07-05 06:12:40 +0000
commit792ca1aec42d68d8e46331331db3aa01215ff49c (patch)
tree5dbc36a721f4922467fb820be73ad17c98239349
parent8b460fdf893dd2c202ff630dd87f66729391bf34 (diff)
downloadscummvm-rg350-792ca1aec42d68d8e46331331db3aa01215ff49c.tar.gz
scummvm-rg350-792ca1aec42d68d8e46331331db3aa01215ff49c.tar.bz2
scummvm-rg350-792ca1aec42d68d8e46331331db3aa01215ff49c.zip
Clip actors and objects to the scene (which may be an inset), and only
allow interaction with actors and objects inside this same area. Other hit zones may - indeed must - still exist outside the inset, and they are not affected by this patch. This fixes some glitches at the glass makers's house in ITE. svn-id: r18493
-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);