aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/text.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-07 00:23:46 +0100
committerMartin Kiewitz2016-02-07 00:24:11 +0100
commitc43ee3a7a5af5b6ff8b36de3d53fd267ded7caa0 (patch)
tree38c463238d96034e19a00e089ba096b7db871902 /engines/agi/text.cpp
parent3e90a83aa438d747ff8416d91c6192d453e5e1bd (diff)
downloadscummvm-rg350-c43ee3a7a5af5b6ff8b36de3d53fd267ded7caa0.tar.gz
scummvm-rg350-c43ee3a7a5af5b6ff8b36de3d53fd267ded7caa0.tar.bz2
scummvm-rg350-c43ee3a7a5af5b6ff8b36de3d53fd267ded7caa0.zip
AGI: Fix regression from stringWordWrap rewrite
Space at the end of the string was handled inaccurately Fixes kq1 text scrolling bug #7021 Rewrite was done in commit efb65324688f20cc534a25312f558f9264125762
Diffstat (limited to 'engines/agi/text.cpp')
-rw-r--r--engines/agi/text.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 965de69335..62590737c3 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -941,8 +941,17 @@ 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
+
while (originalText[curReadPos]) {
// Try to find out length of next word
+
+ // If first character is a space, skip it, so that we process at least this space
+ if (originalText[curReadPos] == ' ')
+ curReadPos++;
+
while (originalText[curReadPos]) {
if (originalText[curReadPos] == ' ')
break;
@@ -1005,10 +1014,6 @@ char *TextMgr::stringWordWrap(const char *originalText, int16 maxWidth, int16 *c
}
wordStartPos = curReadPos;
-
- // Last word ended with a space, skip this space for reading the next word
- if (wordEndChar == ' ')
- curReadPos++;
}
resultWrappedBuffer[curWritePos] = 0;