Skip to content

Commit

Permalink
ACCESS: Add missing string parameters to bubble box methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 17, 2014
1 parent 404c7cd commit 77626b7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
22 changes: 11 additions & 11 deletions engines/access/bubble_box.cpp
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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");
}

Expand Down
24 changes: 17 additions & 7 deletions engines/access/bubble_box.h
Expand Up @@ -58,13 +58,23 @@ class BubbleBox: public Box {

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);


Expand Down
11 changes: 10 additions & 1 deletion engines/access/scripts.cpp
Expand Up @@ -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();
}

Expand Down

0 comments on commit 77626b7

Please sign in to comment.