[Scummvm-cvs-logs] SF.net SVN: scummvm:[47877] scummvm/trunk/engines/sci/graphics/frameout.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Thu Feb 4 17:12:47 CET 2010


Revision: 47877
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47877&view=rev
Author:   m_kiewitz
Date:     2010-02-04 16:12:47 +0000 (Thu, 04 Feb 2010)

Log Message:
-----------
SCI: added clipping inside frameout (fixes torin)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/frameout.cpp

Modified: scummvm/trunk/engines/sci/graphics/frameout.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.cpp	2010-02-04 16:06:56 UTC (rev 47876)
+++ scummvm/trunk/engines/sci/graphics/frameout.cpp	2010-02-04 16:12:47 UTC (rev 47877)
@@ -105,7 +105,7 @@
 	int16 planePictureCels = 0;
 	int16 planePictureCel;
 	int16 planePriority;
-	int16 planeTop, planeLeft;
+	Common::Rect planeRect;
 	int16 planeResY, planeResX;
 
 	reg_t itemObject;
@@ -131,11 +131,16 @@
 			planePictureCels = planePicture->getSci32celCount();
 		}
 
-		planeTop = GET_SEL32V(_segMan, planeObject, top);
-		planeLeft = GET_SEL32V(_segMan, planeObject, left);
+		planeRect.top = GET_SEL32V(_segMan, planeObject, top);
+		planeRect.left = GET_SEL32V(_segMan, planeObject, left);
+		planeRect.bottom = GET_SEL32V(_segMan, planeObject, bottom);
+		planeRect.right = GET_SEL32V(_segMan, planeObject, right);
 		planeResY = GET_SEL32V(_segMan, planeObject, resY);
 		planeResX = GET_SEL32V(_segMan, planeObject, resX);
 
+		planeRect.top = (planeRect.top * _screen->getHeight()) / planeResY;
+		planeRect.left = (planeRect.left * _screen->getWidth()) / planeResX;
+
 		// Fill our itemlist for this plane
 		itemCount = 0;
 		itemEntry = itemData;
@@ -156,10 +161,10 @@
 				itemEntry->scaleY = GET_SEL32V(_segMan, itemObject, scaleY);
 				itemEntry->object = itemObject;
 
-				itemEntry->y += planeTop;
-				itemEntry->x += planeLeft;
 				itemEntry->y = ((itemEntry->y * _screen->getHeight()) / planeResY);
 				itemEntry->x = ((itemEntry->x * _screen->getWidth()) / planeResX);
+				itemEntry->y += planeRect.top;
+				itemEntry->x += planeRect.left;
 
 				if (itemEntry->priority == 0)
 					itemEntry->priority = itemEntry->y;
@@ -205,10 +210,14 @@
 					continue;
 				}
 
+				Common::Rect clipRect;
+				clipRect = itemEntry->celRect;
+				clipRect.clip(planeRect);
+
 				if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
-					view->draw(itemEntry->celRect, itemEntry->celRect, itemEntry->celRect, itemEntry->loopNo, itemEntry->celNo, 255, 0, false);
+					view->draw(itemEntry->celRect, clipRect, clipRect, itemEntry->loopNo, itemEntry->celNo, 255, 0, false);
 				else
-					view->drawScaled(itemEntry->celRect, itemEntry->celRect, itemEntry->celRect, itemEntry->loopNo, itemEntry->celNo, 255, itemEntry->scaleX, itemEntry->scaleY);
+					view->drawScaled(itemEntry->celRect, clipRect, clipRect, itemEntry->loopNo, itemEntry->celNo, 255, itemEntry->scaleX, itemEntry->scaleY);
 			} else {
 				// Most likely a text entry
 				// This draws text the "SCI0-SCI11" way. In SCI2, text is prerendered in kCreateTextBitmap


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