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

Hkz at users.sourceforge.net Hkz at users.sourceforge.net
Sun May 24 15:59:47 CEST 2009


Revision: 40862
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40862&view=rev
Author:   Hkz
Date:     2009-05-24 13:59:47 +0000 (Sun, 24 May 2009)

Log Message:
-----------
tinsel: take into account clipping when drawing PSX 4-bit images

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

Modified: scummvm/trunk/engines/tinsel/graphics.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/graphics.cpp	2009-05-24 13:21:00 UTC (rev 40861)
+++ scummvm/trunk/engines/tinsel/graphics.cpp	2009-05-24 13:59:47 UTC (rev 40862)
@@ -296,14 +296,12 @@
 								*(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + (xp - boxBounds.left)) = *(p + (xp - boxBounds.left));
 						}
 				} else {
-					if (*p & 0x0f || !transparency)
-						*(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + 0) = (*p & 0x0f) + palStart;
-					if ((*p & 0xf0) >> 4 || !transparency)
-						*(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + 1) = ((*p & 0xf0) >> 4) + palStart;
-					if (*(p + 1) & 0x0f || !transparency)
-						*(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + 2) = (*(p + 1) & 0x0f) + palStart;
-					if ((*(p + 1) & 0xf0) >> 4 || !transparency)
-						*(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + 3) = ((*(p + 1) & 0xf0) >> 4) + palStart;
+					for (int xp = boxBounds.left; xp <= boxBounds.right; ++xp) {
+						// Extract pixel value from byte
+						byte pixValue =  (*(p + (xp / 2)) & (xp % 2 ? 0xf0 : 0x0f)) >> (xp % 2 ? 4 : 0);
+						if (pixValue || !transparency)
+							*(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + (xp - boxBounds.left)) = pixValue;
+					}
 				}
 			}
 
@@ -867,6 +865,11 @@
 			// WrtTrans with/without clipping
 			WrtTrans(pObj, destPtr, typeId == 0xC4);
 			break;
+		case 0x04:
+		case 0x44:
+			// WrtConst with/without clipping
+			WrtConst(pObj, destPtr, typeId == 0x44);
+			break;
 		default:
 			error("Unknown drawing type %d", typeId);
 		}


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