From a8a7018926f68d4792f3114ea8496ae721c2490c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Aug 2014 21:53:46 -0400 Subject: ACCESS: Fix showing bubble box text correctly --- engines/access/bubble_box.cpp | 6 +++--- engines/access/data.cpp | 14 ++++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp index 4bd4b74588..5a17b3b1a3 100644 --- a/engines/access/bubble_box.cpp +++ b/engines/access/bubble_box.cpp @@ -143,9 +143,9 @@ void BubbleBox::printBubble(const Common::String &msg) { // Set font colors font2._fontColors[0] = 0; - font2._fontColors[1] = 0; - font2._fontColors[2] = 0; - font2._fontColors[3] = 0; + font2._fontColors[1] = 27; + font2._fontColors[2] = 28; + font2._fontColors[3] = 29; int xp = _vm->_fonts._printOrg.x; if (_type == TYPE_4) diff --git a/engines/access/data.cpp b/engines/access/data.cpp index 36797b62ea..90f712af3b 100644 --- a/engines/access/data.cpp +++ b/engines/access/data.cpp @@ -22,6 +22,8 @@ #include "common/algorithm.h" #include "access/data.h" +#include "graphics/palette.h" +#include "common/system.h" namespace Access { @@ -127,9 +129,13 @@ bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &w if (width < maxWidth) continue; - // Reached maximum allowed. Work backwards to find space at the - // start of the current word as a point to split the line on - --src; + // Reached maximum allowed size + // If this was the last character of the string, let it go + if (*src == '\0') + break; + + // Work backwards to find space at the start of the current word + // as a point to split the line on while (src >= s.c_str() && *src != ' ') { width -= charWidth(*src); --src; @@ -138,7 +144,7 @@ bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &w error("Could not fit line"); // Split the line around the space - line = Common::String(s.c_str(), src - 1); + line = Common::String(s.c_str(), src); s = Common::String(src + 1); return false; } -- cgit v1.2.3