[Scummvm-git-logs] scummvm master -> 927adb7f05e06ecc3a6303dbc2437e8b8f45dd70

dreammaster dreammaster at scummvm.org
Sun Nov 6 20:26: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:
927adb7f05 TITANIC: Fix word wrapping in the conversation log


Commit: 927adb7f05e06ecc3a6303dbc2437e8b8f45dd70
    https://github.com/scummvm/scummvm/commit/927adb7f05e06ecc3a6303dbc2437e8b8f45dd70
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-06T14:26:44-05:00

Commit Message:
TITANIC: Fix word wrapping in the conversation log

Changed paths:
    engines/titanic/pet_control/pet_text.cpp
    engines/titanic/support/font.cpp



diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index 3ad14d0..c7c6f49 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -296,7 +296,7 @@ int CPetText::getTextWidth(CScreenManager *screenManager) {
 int CPetText::getTextHeight(CScreenManager *screenManager) {
 	mergeStrings();
 	int oldFontNumber = screenManager->setFontNumber(_fontNumber);
-	int textHeight = screenManager->getTextBounds(_lines, _bounds.width());
+	int textHeight = screenManager->getTextBounds(_lines, _bounds.width() - 4);
 	screenManager->setFontNumber(oldFontNumber);
 
 	return textHeight;
diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp
index 2e98639..f81251b 100644
--- a/engines/titanic/support/font.cpp
+++ b/engines/titanic/support/font.cpp
@@ -315,10 +315,10 @@ void STFont::extendBounds(Point &textSize, byte c, int maxWidth) const {
 void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) const {
 	bool flag = false;
 	int totalWidth = 0;
-	for (const char *srcPtr = str + 1; *srcPtr && *srcPtr != ' '; ++srcPtr) {
-		if (*srcPtr == ' ' && flag)
-			break;
 
+	// Loop forward getting the width of the word (including preceding space)
+	// until a space is encountered following at least one character
+	for (const char *srcPtr = str; *srcPtr && (*srcPtr != ' ' || !flag); ++srcPtr) {
 		if (*srcPtr == TEXTCMD_NPC) {
 			srcPtr += 3;
 		} else if (*srcPtr == TEXTCMD_SET_COLOR) {





More information about the Scummvm-git-logs mailing list