[Scummvm-cvs-logs] scummvm master -> c43ee3a7a5af5b6ff8b36de3d53fd267ded7caa0

m-kiewitz m_kiewitz at users.sourceforge.net
Sun Feb 7 00:24:51 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c43ee3a7a5 AGI: Fix regression from stringWordWrap rewrite


Commit: c43ee3a7a5af5b6ff8b36de3d53fd267ded7caa0
    https://github.com/scummvm/scummvm/commit/c43ee3a7a5af5b6ff8b36de3d53fd267ded7caa0
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-07T00:24:11+01:00

Commit Message:
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

Changed paths:
    engines/agi/text.cpp



diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 965de69..6259073 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;






More information about the Scummvm-git-logs mailing list