aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-17 12:01:28 -0400
committerPaul Gilbert2014-08-17 12:01:28 -0400
commit77626b72a59f0a9bf35da3f77032c018fe5d7963 (patch)
treeb5c4b61fc810b0e110f5bc8717edaf9d43bfe2ab
parent404c7cd5d33e81c7724cb78dfce5701b26b4659b (diff)
downloadscummvm-rg350-77626b72a59f0a9bf35da3f77032c018fe5d7963.tar.gz
scummvm-rg350-77626b72a59f0a9bf35da3f77032c018fe5d7963.tar.bz2
scummvm-rg350-77626b72a59f0a9bf35da3f77032c018fe5d7963.zip
ACCESS: Add missing string parameters to bubble box methods
-rw-r--r--engines/access/bubble_box.cpp22
-rw-r--r--engines/access/bubble_box.h24
-rw-r--r--engines/access/scripts.cpp11
3 files changed, 38 insertions, 19 deletions
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 2b6d9dd11a..5f0cb9443b 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -55,27 +55,27 @@ void BubbleBox::clearBubbles() {
_bubbles.clear();
}
-void BubbleBox::placeBubble() {
+void BubbleBox::placeBubble(const Common::String &msg) {
BubbleBox::_maxChars = 27;
- placeBubble1();
+ placeBubble1(msg);
}
-void BubbleBox::placeBubble1() {
+void BubbleBox::placeBubble1(const Common::String &msg) {
BubbleBox::clearBubbles();
_vm->_fonts._charSet._lo = 1;
_vm->_fonts._charSet._hi = 8;
_vm->_fonts._charFor._lo = 29;
_vm->_fonts._charFor._hi = 32;
- calcBubble();
+ calcBubble(msg);
Common::Rect r = BubbleBox::_bubbles[0];
r.translate(-2, 0);
_vm->_screen->saveBlock(r);
- printBubble();
+ printBubble(msg);
}
-void BubbleBox::calcBubble() {
+void BubbleBox::calcBubble(const Common::String &msg) {
// Save points
Common::Point printOrg = _vm->_fonts._printOrg;
Common::Point printStart = _vm->_fonts._printStart;
@@ -84,19 +84,19 @@ void BubbleBox::calcBubble() {
if (_edgeSize == 4) {
_vm->_fonts._printMaxX = 110;
} else {
- _vm->_fonts._printMaxX = _vm->_fonts._font2.stringWidth(BubbleBox::_bubblePtr);
+ _vm->_fonts._printMaxX = _vm->_fonts._font2.stringWidth(_bubblePtr);
}
// Start of with a rect with the given starting x and y
Common::Rect bounds(printOrg.x - 2, printOrg.y, printOrg.x - 2, printOrg.y);
// Loop through getting lines
- Common::String msg(BubbleBox::_bubblePtr);
+ Common::String s = msg;
Common::String line;
int width = 0;
bool lastLine;
do {
- lastLine = _vm->_fonts._font2.getLine(msg, _vm->_fonts._printMaxX, line, width);
+ lastLine = _vm->_fonts._font2.getLine(s, _vm->_fonts._printMaxX, line, width);
width = MIN(width, _vm->_fonts._printMaxX);
_vm->_fonts._printOrg.y += 6;
@@ -131,8 +131,8 @@ void BubbleBox::calcBubble() {
_vm->_fonts._printStart = printStart;
}
-void BubbleBox::printBubble() {
- //drawBubble(BubbleBox::_bubbles.size() - 1);
+void BubbleBox::printBubble(const Common::String &msg) {
+ drawBubble(BubbleBox::_bubbles.size() - 1);
error("TODO: printBubble");
}
diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h
index e02fa7c572..189e0b1c04 100644
--- a/engines/access/bubble_box.h
+++ b/engines/access/bubble_box.h
@@ -58,13 +58,23 @@ public:
void clearBubbles();
- void placeBubble();
- void placeBubble1();
-
- void calcBubble();
-
- void printBubble();
-
+ void placeBubble(const Common::String &msg);
+ void placeBubble1(const Common::String &msg);
+
+ /**
+ * Calculate the size of a bubble needed to hold a given string
+ */
+ void calcBubble(const Common::String &msg);
+
+ /**
+ * Prints a text bubble and it's contents
+ */
+ void printBubble(const Common::String &msg);
+
+ /*
+ * Draws the background for a text bubble
+ * @param index Index of bounds in _bubbles array
+ */
void drawBubble(int index);
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index f91b49c9ef..640514aca7 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -176,13 +176,22 @@ void Scripts::cmdPrint() {
_vm->_timers[PRINT_TIMER]._initTm = 50;
_vm->_timers[PRINT_TIMER]._flag = true;
- _vm->_bubbleBox->placeBubble();
+ // Get a text line for display
+ Common::String msg;
+ byte c;
+ while ((c = (char)_data->readByte()) != '\0')
+ msg += c;
+
+ // Display the text in a bubble, and wait for a keypress or mouse click
+ _vm->_bubbleBox->placeBubble(msg);
_vm->_events->waitKeyMouse();
+ // Wait until the bubble display is expired
while (_vm->_timers[PRINT_TIMER]._flag) {
_vm->_events->pollEvents();
}
+ // Restore the original screen over the text bubble
_vm->_screen->restoreBlock();
}