[Scummvm-cvs-logs] SF.net SVN: scummvm: [30547] scummvm/trunk/engines/lure/surface.cpp

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Fri Jan 18 11:49:48 CET 2008


Revision: 30547
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30547&view=rev
Author:   dreammaster
Date:     2008-01-18 02:49:48 -0800 (Fri, 18 Jan 2008)

Log Message:
-----------
Enhanced Surface::writeSubstring to crop any string that exceeds the width of the surface - this fixes a visual glitch in the German version where some lines were so long they were exceeding the size of the screen

Modified Paths:
--------------
    scummvm/trunk/engines/lure/surface.cpp

Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp	2008-01-18 10:47:01 UTC (rev 30546)
+++ scummvm/trunk/engines/lure/surface.cpp	2008-01-18 10:49:48 UTC (rev 30547)
@@ -263,11 +263,16 @@
 		colour = LureEngine::getReference().isEGA() ? EGA_DIALOG_TEXT_COLOUR : VGA_DIALOG_TEXT_COLOUR;
 
 	for (int index = 0; (index < len) && (*sPtr != '\0'); ++index, ++sPtr) {
+		int charSize = varLength ? fontSize[(uint8)*sPtr - 32] + 2 : FONT_WIDTH;
+		if (x + charSize >= width())
+			// Passed the right hand edge of the surface
+			break;
+
+		// Write next character
 		writeChar(x, y, (uint8) *sPtr, transparent, colour);
 
 		// Move to after the character in preparation for the next character
-		if (!varLength) x += FONT_WIDTH;
-		else x += fontSize[(uint8)*sPtr - 32] + 2;
+		x += charSize;
 	}
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list