aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-08 19:10:42 -0400
committerPaul Gilbert2015-07-08 19:10:42 -0400
commitb7c2c345e318e1d359b0ce64c8b2d898e37b5e73 (patch)
tree5f2ce56df6cfa4def1f6ccde5fb5c22b8542f832 /engines/sherlock
parent02db9190509a78f33507162f24a8ffbfe056b43d (diff)
downloadscummvm-rg350-b7c2c345e318e1d359b0ce64c8b2d898e37b5e73.tar.gz
scummvm-rg350-b7c2c345e318e1d359b0ce64c8b2d898e37b5e73.tar.bz2
scummvm-rg350-b7c2c345e318e1d359b0ce64c8b2d898e37b5e73.zip
SHERLOCK: RT: Fix display of tooltips in scrolled scenes
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/tattoo/widget_base.cpp8
-rw-r--r--engines/sherlock/tattoo/widget_tooltip.cpp10
2 files changed, 10 insertions, 8 deletions
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index cdebe698aa..905dd31be0 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -143,12 +143,12 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA
void WidgetBase::restrictToScreen() {
Screen &screen = *_vm->_screen;
- if (_bounds.left < 0)
- _bounds.moveTo(0, _bounds.top);
+ if (_bounds.left < screen._currentScroll.x)
+ _bounds.moveTo(screen._currentScroll.x, _bounds.top);
if (_bounds.top < 0)
_bounds.moveTo(_bounds.left, 0);
- if (_bounds.right > screen._backBuffer1.w())
- _bounds.moveTo(screen._backBuffer1.w() - _bounds.width(), _bounds.top);
+ if (_bounds.right > SHERLOCK_SCENE_WIDTH)
+ _bounds.moveTo(SHERLOCK_SCENE_WIDTH - _bounds.width(), _bounds.top);
if (_bounds.bottom > SHERLOCK_SCREEN_HEIGHT)
_bounds.moveTo(_bounds.left, SHERLOCK_SCREEN_HEIGHT - _bounds.height());
}
diff --git a/engines/sherlock/tattoo/widget_tooltip.cpp b/engines/sherlock/tattoo/widget_tooltip.cpp
index 7e211bbe9f..b1c13c7a29 100644
--- a/engines/sherlock/tattoo/widget_tooltip.cpp
+++ b/engines/sherlock/tattoo/widget_tooltip.cpp
@@ -39,6 +39,8 @@ void WidgetTooltipBase::draw() {
erase();
if (_bounds.width() > 0 && !_surface.empty()) {
+ restrictToScreen();
+
// Blit the affected area to the screen
screen.slamRect(_bounds);
@@ -140,8 +142,8 @@ void WidgetTooltip::setText(const Common::String &str) {
}
// Set the initial display position for the tooltip text
- int tagX = CLIP(mousePos.x - width / 2, 0, SHERLOCK_SCREEN_WIDTH - width);
- int tagY = MAX(mousePos.y - height, 0);
+ int tagX = mousePos.x - width / 2;
+ int tagY = mousePos.y - height;
_bounds = Common::Rect(tagX, tagY, tagX + width, tagY + height);
} else {
@@ -158,8 +160,8 @@ void WidgetTooltip::handleEvents() {
Common::Point mousePos = events.mousePos();
// Set the new position for the tooltip
- int xp = CLIP(mousePos.x - _bounds.width() / 2, 0, SHERLOCK_SCREEN_WIDTH - _bounds.width());
- int yp = MAX(mousePos.y - _bounds.height(), 0);
+ int xp = mousePos.x - _bounds.width() / 2;
+ int yp = mousePos.y - _bounds.height();
_bounds.moveTo(xp, yp);
}