[Scummvm-cvs-logs] SF.net SVN: scummvm:[34569] scummvm/trunk/engines/drascula/graphics.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Sep 16 09:16:56 CEST 2008


Revision: 34569
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34569&view=rev
Author:   thebluegr
Date:     2008-09-16 07:16:26 +0000 (Tue, 16 Sep 2008)

Log Message:
-----------
- Fixed centerText() to print text at the correct height
- Removed some duplicate code

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/graphics.cpp

Modified: scummvm/trunk/engines/drascula/graphics.cpp
===================================================================
--- scummvm/trunk/engines/drascula/graphics.cpp	2008-09-15 22:43:20 UTC (rev 34568)
+++ scummvm/trunk/engines/drascula/graphics.cpp	2008-09-16 07:16:26 UTC (rev 34569)
@@ -192,25 +192,7 @@
 }
 
 void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) {
-	byte *ptr = VGA;
-
-	ptr += xdes + ydes * 320;
-	buffer += xorg + yorg * 320;
-
-	/* Unoptimized code
-	for (int x = 0; x < height; x++) {
-		memcpy(ptr + 320 * x, buffer + 320 * x, width);
-	} */
-
-	// A bit more optimized code, thanks to Fingolfin
-	// Uses 2 less registers and performs 2 less multiplications
-	int x = height;
-	while (x--) {
-		memcpy(ptr, buffer, width);
-		ptr += 320;
-		buffer += 320;
-	}
-
+	copyBackground(xorg, yorg, xdes, ydes, width, height, buffer, VGA);
 	_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
 	_system->updateScreen();
 }
@@ -316,7 +298,8 @@
 	char *curWord;
 	int curLine = 0;
 	int x = 0;
-	int y = textY - (3 * CHAR_HEIGHT);	// original starts printing 3 lines above textY
+	// original starts printing 4 lines above textY
+	int y = CLIP<int>(textY - (4 * CHAR_HEIGHT), 0, 320);
 
 	strcpy(msg, message);
 
@@ -351,7 +334,7 @@
 		}
 
 		// Get next word
-		curWord = strtok (NULL, " ");
+		curWord = strtok(NULL, " ");
 
 		if (curWord == NULL) {
 			x = CLIP<int>(textX - strlen(messageLine) * CHAR_WIDTH / 2, 60, 255);


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