aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2016-10-26 19:58:16 -0400
committerPaul Gilbert2016-10-26 19:58:16 -0400
commit74bb5c52070a7a5379324ce34145ac2ff2d6dd6f (patch)
tree6b5861f2b4d77ea7aa08979a9658b7a255f90e61 /engines/titanic/support
parent5291a72742ff87153ba4b7b7937682f614363c69 (diff)
downloadscummvm-rg350-74bb5c52070a7a5379324ce34145ac2ff2d6dd6f.tar.gz
scummvm-rg350-74bb5c52070a7a5379324ce34145ac2ff2d6dd6f.tar.bz2
scummvm-rg350-74bb5c52070a7a5379324ce34145ac2ff2d6dd6f.zip
TITANIC: Fix incorrect clipping of inventory tooltip text
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/font.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp
index 625d03720b..7bcac9ba08 100644
--- a/engines/titanic/support/font.cpp
+++ b/engines/titanic/support/font.cpp
@@ -245,11 +245,8 @@ WriteCharacterResult STFont::writeChar(CVideoSurface *surface, unsigned char c,
if (c == 233)
c = '$';
- Rect tempRect;
- tempRect.left = _chars[c]._offset;
- tempRect.right = _chars[c]._offset + _chars[c]._width;
- tempRect.top = 0;
- tempRect.bottom = _fontHeight;
+ Rect charRect(_chars[c]._offset, 0,
+ _chars[c]._offset + _chars[c]._width, _fontHeight);
Point destPos(pt.x + destRect.left, pt.y + destRect.top);
if (srcRect->isEmpty())
@@ -257,34 +254,34 @@ WriteCharacterResult STFont::writeChar(CVideoSurface *surface, unsigned char c,
if (destPos.y > srcRect->bottom)
return WC_OUTSIDE_BOTTOM;
- if ((destPos.y + tempRect.height()) > srcRect->bottom) {
- tempRect.bottom += tempRect.top - destPos.y;
+ if ((destPos.y + charRect.height()) > srcRect->bottom) {
+ charRect.bottom += srcRect->bottom - (destPos.y + charRect.height());
}
if (destPos.y < srcRect->top) {
- if ((tempRect.height() + destPos.y) < srcRect->top)
+ if ((charRect.height() + destPos.y) < srcRect->top)
return WC_OUTSIDE_TOP;
- tempRect.top += srcRect->top - destPos.y;
+ charRect.top += srcRect->top - destPos.y;
destPos.y = srcRect->top;
}
if (destPos.x < srcRect->left) {
- if ((tempRect.width() + destPos.x) < srcRect->left)
+ if ((charRect.width() + destPos.x) < srcRect->left)
return WC_OUTSIDE_LEFT;
- tempRect.left += srcRect->left - destPos.x;
+ charRect.left += srcRect->left - destPos.x;
destPos.x = srcRect->left;
} else {
- if ((tempRect.width() + destPos.x) > srcRect->right) {
+ if ((charRect.width() + destPos.x) > srcRect->right) {
if (destPos.x > srcRect->right)
return WC_OUTSIDE_RIGHT;
- tempRect.right += srcRect->left - destPos.x;
+ charRect.right += srcRect->left - destPos.x;
}
}
- copyRect(surface, destPos, tempRect);
+ copyRect(surface, destPos, charRect);
return WC_IN_BOUNDS;
}