[Scummvm-cvs-logs] scummvm master -> 40dee7d9668423908998cf2d823eec15a39a1f3d

dreammaster dreammaster at scummvm.org
Wed Jul 15 02:25:48 CEST 2015


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:
40dee7d966 SHERLOCK: RT: Fix display of talk windows with multiple options


Commit: 40dee7d9668423908998cf2d823eec15a39a1f3d
    https://github.com/scummvm/scummvm/commit/40dee7d9668423908998cf2d823eec15a39a1f3d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-14T20:24:37-04:00

Commit Message:
SHERLOCK: RT: Fix display of talk windows with multiple options

Changed paths:
    engines/sherlock/tattoo/widget_talk.cpp



diff --git a/engines/sherlock/tattoo/widget_talk.cpp b/engines/sherlock/tattoo/widget_talk.cpp
index 55f7df3..276c837 100644
--- a/engines/sherlock/tattoo/widget_talk.cpp
+++ b/engines/sherlock/tattoo/widget_talk.cpp
@@ -45,7 +45,6 @@ WidgetTalk::WidgetTalk(SherlockEngine *vm) : WidgetBase(vm) {
 
 void WidgetTalk::getTalkWindowSize() {
 	TattooTalk &talk = *(TattooTalk *)_vm->_talk;
-	Common::StringArray lines;
 	const char *const NUM_STR = "19.";
 	int width, height;
 
@@ -68,9 +67,6 @@ void WidgetTalk::getTalkWindowSize() {
 		if (talk._statements[idx]._talkMap != -1) {
 			splitLines(talk._statements[idx]._statement, statementLines, width, 999);
 			numLines += statementLines.size();
-
-			for (uint sIdx = 0; sIdx < statementLines.size(); ++sIdx)
-				lines.push_back(statementLines[sIdx]);
 		}
 	}
 
@@ -93,12 +89,7 @@ void WidgetTalk::getTalkWindowSize() {
 
 	// Form the background for the new window
 	makeInfoArea();
-
-	int yp = 5;
-	for (int lineNum = 0; yp < (_bounds.height() - _surface.fontHeight() / 2); ++lineNum) {
-		_surface.writeString(lines[lineNum], Common::Point(_surface.widestChar(), yp), INFO_TOP);
-		yp += _surface.fontHeight() + 1;
-	}
+	render(HL_CHANGED_HIGHLIGHTS);
 }
 
 void WidgetTalk::load() {
@@ -543,43 +534,12 @@ void WidgetTalk::setStatementLines() {
 			// Get the next statement text to process
 			Common::String str = talk._statements[statementNum]._statement;
 
-			// Process the statement
-			Common::String line;
-			do {
-				line = "";
-
-				// Find out how much of the statement will fit on the line
-				int width = 0;
-				const char *ch = str.c_str();
-				const char *space = nullptr;
-
-				while (width < xSize && *ch) {
-					width += _surface.charWidth(*ch);
-
-					// Keep track of where spaces are
-					if (*ch == ' ')
-						space = ch;
-					++ch;
-				}
-
-				// If the line was too wide to fit on a single line, go back to the last space and split it there.
-				// But if there isn't (and this shouldn't ever happen), just split the line right at that point
-				if (width > xSize) {
-					if (space) {
-						line = Common::String(str.c_str(), space);
-						str = Common::String(space + 1);
-					} else {
-						line = Common::String(str.c_str(), ch);
-						str = Common::String(ch);
-					}
-				} else {
-					line = str;
-					str = "";
-				}
+			Common::StringArray statementLines;
+			splitLines(str, statementLines, xSize, 999);
 
-				// Add the line in
-				_statementLines.push_back(StatementLine(line, statementNum));
-			} while (!line.empty());
+			// Add the lines in
+			for (uint idx = 0; idx < statementLines.size(); ++idx)
+				_statementLines.push_back(StatementLine(statementLines[idx], statementNum));
 		}
 	}
 }






More information about the Scummvm-git-logs mailing list