diff options
author | Martin Kiewitz | 2016-02-19 15:56:00 +0100 |
---|---|---|
committer | Martin Kiewitz | 2016-02-19 15:56:00 +0100 |
commit | 4a204af5b71ad000ec8f2952f8343ac0328d45cd (patch) | |
tree | dc047dcba3778c33d9f1891456f84054aefbb284 | |
parent | 453a8ac11d5b29d38d6c89cdc7ff2ae9775d7a25 (diff) | |
download | scummvm-rg350-4a204af5b71ad000ec8f2952f8343ac0328d45cd.tar.gz scummvm-rg350-4a204af5b71ad000ec8f2952f8343ac0328d45cd.tar.bz2 scummvm-rg350-4a204af5b71ad000ec8f2952f8343ac0328d45cd.zip |
AGI: Fix a tiny inaccuracy in string word wrapper
Fixes one message box in Gold Rush during Stagecoach path,
that wasn't wrapped correctly.
-rw-r--r-- | engines/agi/text.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 7c8594b62a..611bd135eb 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -943,8 +943,9 @@ char *TextMgr::stringWordWrap(const char *originalText, int16 maxWidth, int16 *c //memset(resultWrappedBuffer, 0, sizeof(resultWrappedBuffer)); for debugging // Good testcases: - // King's Quest 1 intro: the scrolling text is filled up with spaces, so that old lines are erased - // Apple IIgs restart system UI: spaces used to make the window larger + // King's Quest 1 intro: the scrolling text is filled up with spaces, so that old lines are erased + // Apple IIgs restart system UI: spaces used to make the window larger + // Gold Rush Stagecoach path room 60: " Lake Michigan!", with max length 9 -> should get split into " Lake" / "Michigan!" while (originalText[curReadPos]) { // Try to find out length of next word @@ -967,6 +968,15 @@ char *TextMgr::stringWordWrap(const char *originalText, int16 maxWidth, int16 *c if (wordLen >= lineWidthLeft) { // Not enough space left + + // If first character right after the new line is a space, skip over it + if (wordLen) { + if (originalText[wordStartPos] == ' ') { + wordStartPos++; + wordLen--; + } + } + if (wordLen > maxWidth) { // Word way too long, split it in half curReadPos = curReadPos - (wordLen - maxWidth); @@ -983,14 +993,6 @@ char *TextMgr::stringWordWrap(const char *originalText, int16 maxWidth, int16 *c // Reached absolute maximum? -> exit now if (boxHeight >= HEIGHT_MAX) break; - - // If first character right after the new line is a space, skip over it - if (wordLen) { - if (originalText[wordStartPos] == ' ') { - wordStartPos++; - wordLen--; - } - } } // Copy current word over |