aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-12-10 22:37:56 -0500
committerPaul Gilbert2015-12-10 22:37:56 -0500
commit7b671f42bca024e628ba2a2c1559c88cfc3eb6ba (patch)
tree179071acda52ed0ab4fb64e8c1230b2b3d2e2a49 /engines
parente6f3b9d29f0fc695a616323be133f579c309388b (diff)
downloadscummvm-rg350-7b671f42bca024e628ba2a2c1559c88cfc3eb6ba.tar.gz
scummvm-rg350-7b671f42bca024e628ba2a2c1559c88cfc3eb6ba.tar.bz2
scummvm-rg350-7b671f42bca024e628ba2a2c1559c88cfc3eb6ba.zip
ACCESS: Fix crash when talking to Librarian
Diffstat (limited to 'engines')
-rw-r--r--engines/access/bubble_box.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index df8adc1bc6..831ba507a1 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -95,8 +95,9 @@ void BubbleBox::placeBubble1(const Common::String &msg) {
void BubbleBox::calcBubble(const Common::String &msg) {
// Save points
- Common::Point printOrg = _vm->_screen->_printOrg;
- Common::Point printStart = _vm->_screen->_printStart;
+ Screen &screen = *_vm->_screen;
+ Common::Point printOrg = screen._printOrg;
+ Common::Point printStart = screen._printStart;
// Figure out maximum width allowed
if (_type == kBoxTypeFileDialog) {
@@ -114,15 +115,15 @@ void BubbleBox::calcBubble(const Common::String &msg) {
int width = 0;
bool lastLine;
do {
- lastLine = _vm->_fonts._font2.getLine(s, _vm->_screen->_maxChars * 6, line, width);
+ lastLine = _vm->_fonts._font2.getLine(s, screen._maxChars * 6, line, width);
_vm->_fonts._printMaxX = MAX(width, _vm->_fonts._printMaxX);
- _vm->_screen->_printOrg.y += 6;
- _vm->_screen->_printOrg.x = _vm->_screen->_printStart.x;
+ screen._printOrg.y += 6;
+ screen._printOrg.x = screen._printStart.x;
} while (!lastLine);
if (_type == kBoxTypeFileDialog)
- ++_vm->_screen->_printOrg.y += 6;
+ ++screen._printOrg.y += 6;
// Determine the width for the area
width = (((_vm->_fonts._printMaxX >> 4) + 1) << 4) + 5;
@@ -131,7 +132,7 @@ void BubbleBox::calcBubble(const Common::String &msg) {
bounds.setWidth(width);
// Determine the height for area
- int y = _vm->_screen->_printOrg.y + 6;
+ int y = screen._printOrg.y + 6;
if (_type == kBoxTypeFileDialog)
y += 6;
int height = y - bounds.top;
@@ -141,6 +142,9 @@ void BubbleBox::calcBubble(const Common::String &msg) {
if (height >= 0)
bounds.setHeight(bounds.height() + 13 - (height % 13));
+ if (bounds.bottom > screen.h)
+ bounds.translate(0, screen.h - bounds.bottom);
+
// Add the new bounds to the bubbles list
_bubbles.push_back(bounds);