[Scummvm-cvs-logs] SF.net SVN: scummvm:[45061] scummvm/trunk/engines/sci/gui/gui_picture.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Oct 14 11:46:02 CEST 2009


Revision: 45061
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45061&view=rev
Author:   m_kiewitz
Date:     2009-10-14 09:46:02 +0000 (Wed, 14 Oct 2009)

Log Message:
-----------
SCI/newgui: support for embedded cel data < 320 pixels width. fixes jones/vga

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui_picture.cpp

Modified: scummvm/trunk/engines/sci/gui/gui_picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-14 09:37:22 UTC (rev 45060)
+++ scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-14 09:46:02 UTC (rev 45061)
@@ -117,10 +117,10 @@
 	byte priority = _addToFlag ? _priority : 0;
 	byte clearColor = headerPtr[6];
 	byte curByte, runLength;
-	int16 y, x, lastY;
+	int16 y, lastY, x, leftX, rightX;
 	uint16 pixelNr, pixelCount;
 
-	if (displaceX || displaceY || width != 320)
+	if (displaceX || displaceY)
 		error("unsupported embedded cel-data in picture");
 
 	pixelCount = width * height;
@@ -199,31 +199,31 @@
 	// Set initial vertical coordinate by using current port
 	y = callerY + _gfx->GetPort()->top;
 	lastY = MIN<int16>(height + y, _gfx->GetPort()->rect.bottom + _gfx->GetPort()->top);
-	if (callerX != 0)
-		error("drawCelData() called with callerX != 0");
+	leftX = callerX + _gfx->GetPort()->left;
+	rightX = MIN<int16>(width + leftX, _gfx->GetPort()->rect.right + _gfx->GetPort()->left);
 
 	ptr = celBitmap;
 	if (!_mirroredFlag) {
 		// Draw bitmap to screen
-		x = 0;
+		x = leftX;
 		while (y < lastY) {
 			curByte = *ptr++;
 			if ((curByte != clearColor) && (priority >= _screen->getPriority(x, y)))
-				_screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL | SCI_SCREEN_MASK_PRIORITY, curByte, priority, 0);
+				_screen->putPixel(callerX + x, y, SCI_SCREEN_MASK_VISUAL | SCI_SCREEN_MASK_PRIORITY, curByte, priority, 0);
 			x++;
-			if (x >= _screen->_width) {
-				x -= _screen->_width; y++;
+			if (x >= rightX) {
+				x = leftX; y++;
 			}
 		}
 	} else {
 		// Draw bitmap to screen (mirrored)
-		x = _screen->_width - 1;
+		x = rightX - 1;
 		while (y < lastY) {
 			curByte = *ptr++;
 			if ((curByte != clearColor) && (priority >= _screen->getPriority(x, y)))
-				_screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL | SCI_SCREEN_MASK_PRIORITY, curByte, priority, 0);
-			if (x == 0) {
-				x = _screen->_width; y++;
+				_screen->putPixel(callerX + x, y, SCI_SCREEN_MASK_VISUAL | SCI_SCREEN_MASK_PRIORITY, curByte, priority, 0);
+			if (x == leftX) {
+				x = rightX; y++;
 			}
 			x--;
 		}


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