diff options
author | Martin Kiewitz | 2016-02-07 00:23:46 +0100 |
---|---|---|
committer | Martin Kiewitz | 2016-02-07 00:24:11 +0100 |
commit | c43ee3a7a5af5b6ff8b36de3d53fd267ded7caa0 (patch) | |
tree | 38c463238d96034e19a00e089ba096b7db871902 /engines/agi | |
parent | 3e90a83aa438d747ff8416d91c6192d453e5e1bd (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/agi/text.cpp | 13 |
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; |