aboutsummaryrefslogtreecommitdiff
path: root/engines/access/bubble_box.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-26 19:48:14 -0400
committerPaul Gilbert2016-07-26 19:48:14 -0400
commit504cf6ecb688a3f1c65a857bffd527d8b0e6ba63 (patch)
tree0c0d96d4061c11850c851f0fc981c75a58c20515 /engines/access/bubble_box.cpp
parentd8c28d15ae553d047b7e571f98727fa79ee143f3 (diff)
parente19922d181e775791f9105b8be7ff410770ede51 (diff)
downloadscummvm-rg350-504cf6ecb688a3f1c65a857bffd527d8b0e6ba63.tar.gz
scummvm-rg350-504cf6ecb688a3f1c65a857bffd527d8b0e6ba63.tar.bz2
scummvm-rg350-504cf6ecb688a3f1c65a857bffd527d8b0e6ba63.zip
Merge branch 'master' into xeen
Diffstat (limited to 'engines/access/bubble_box.cpp')
-rw-r--r--engines/access/bubble_box.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index df8adc1bc6..29b58a3f1b 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -46,6 +46,9 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w
}
_btnUpPos = Common::Rect(0, 0, 0, 0);
_btnDownPos = Common::Rect(0, 0, 0, 0);
+ _startItem = _startBox = 0;
+ _charCol = 0;
+ _rowOff = 0;
}
void BubbleBox::load(Common::SeekableReadStream *stream) {
@@ -95,8 +98,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 +118,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 +135,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 +145,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);
@@ -158,7 +165,7 @@ void BubbleBox::printBubble(const Common::String &msg) {
void BubbleBox::printBubble_v1(const Common::String &msg) {
drawBubble(_bubbles.size() - 1);
-
+
// Loop through drawing the lines
Common::String s = msg;
Common::String line;
@@ -221,7 +228,7 @@ void BubbleBox::drawBubble(int index) {
void BubbleBox::doBox(int item, int box) {
FontManager &fonts = _vm->_fonts;
- ASurface &screen = *_vm->_screen;
+ Screen &screen = *_vm->_screen;
_startItem = item;
_startBox = box;
@@ -362,7 +369,7 @@ void BubbleBox::displayBoxData() {
_vm->_screen->drawRect();
_vm->_events->showCursor();
}
-
+
_vm->_events->hideCursor();
int oldPStartY = _boxPStartY;
++_boxPStartY;
@@ -467,7 +474,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
--_vm->_screen->_orgX2;
--_vm->_screen->_orgY2;
_vm->_screen->_lColor = 0xF9;
-
+
// Draw the inner border
_vm->_screen->drawBox();
@@ -604,6 +611,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
_vm->_events->showCursor();
warning("TODO: pop values");
_vm->_screen->restoreScreen();
+ delete icons;
return retval_;
}
@@ -635,7 +643,9 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
}
}
}
-
+
+ delete icons;
+
_vm->_screen->restoreScreen();
_vm->_boxDataStart = _startItem;
_vm->_boxSelectYOld = -1;
@@ -725,7 +735,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
if (_type != TYPE_3)
continue;
-
+
if ((_vm->_events->_mousePos.x < tmpX) || (_vm->_events->_mousePos.x > tmpX + 144))
continue;