[Scummvm-cvs-logs] CVS: scummvm/queen display.cpp,1.58.2.2,1.58.2.3

Gregory Montoir cyx at users.sourceforge.net
Tue Jun 29 14:39:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25149/queen

Modified Files:
      Tag: branch-0-6-0
	display.cpp 
Log Message:
backport of long command strings patch

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.58.2.2
retrieving revision 1.58.2.3
diff -u -d -r1.58.2.2 -r1.58.2.3
--- display.cpp	18 Mar 2004 21:53:20 -0000	1.58.2.2
+++ display.cpp	29 Jun 2004 21:38:25 -0000	1.58.2.3
@@ -824,8 +824,18 @@
 }
 
 void Display::setTextCentered(uint16 y, const char *text, bool outlined) {
-	uint16 x = (GAME_SCREEN_WIDTH - textWidth(text)) / 2;
-	setText(x, y, text, outlined);
+	int len = strlen(text);
+	int16 x;
+	while ((x = (GAME_SCREEN_WIDTH - textWidth(text, len)) / 2) <= 0) {
+		++text;
+		len -= 2;
+	}
+	assert(y < GAME_SCREEN_HEIGHT);
+	TextSlot *pts = &_texts[y];
+	pts->x = x;
+	pts->color = _curTextColor;
+	pts->outlined = outlined;
+	pts->text = Common::String(text, len);
 }
 
 void Display::drawTexts() {





More information about the Scummvm-git-logs mailing list