[Scummvm-cvs-logs] SF.net SVN: scummvm: [29758] scummvm/trunk/engines/cine

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sat Dec 8 10:10:09 CET 2007


Revision: 29758
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29758&view=rev
Author:   cyx
Date:     2007-12-08 01:10:08 -0800 (Sat, 08 Dec 2007)

Log Message:
-----------
simplified gfxConvertSpriteToRaw, some renaming

Modified Paths:
--------------
    scummvm/trunk/engines/cine/gfx.cpp
    scummvm/trunk/engines/cine/gfx.h
    scummvm/trunk/engines/cine/various.cpp

Modified: scummvm/trunk/engines/cine/gfx.cpp
===================================================================
--- scummvm/trunk/engines/cine/gfx.cpp	2007-12-08 08:49:22 UTC (rev 29757)
+++ scummvm/trunk/engines/cine/gfx.cpp	2007-12-08 09:10:08 UTC (rev 29758)
@@ -27,6 +27,7 @@
 #include "cine/bg.h"
 #include "cine/various.h"
 
+#include "common/endian.h"
 #include "common/system.h"
 
 #include "graphics/cursorman.h"
@@ -99,7 +100,7 @@
 	memset(page1Raw, 0, 320 * 200);
 	memset(page2Raw, 0, 320 * 200);
 	memset(page3Raw, 0, 320 * 200);
-	
+
 	memset(additionalBgTable, 0, sizeof(additionalBgTable));
 	additionalBgTable[0] = page2Raw;
 	additionalBgTable[8] = page3Raw;
@@ -192,8 +193,7 @@
 	}
 }
 
-// gfxDrawMaskedSprite
-void gfxSpriteFunc1(byte *spritePtr, byte *maskPtr, uint16 width, uint16 height, byte *page, int16 x, int16 y) {
+void gfxDrawMaskedSprite(byte *spritePtr, byte *maskPtr, uint16 width, uint16 height, byte *page, int16 x, int16 y) {
 	int16 i, j;
 
 	for (i = 0; i < height; i++) {
@@ -211,11 +211,10 @@
 	}
 }
 
-// gfxUpdateSpriteMask
-void gfxSpriteFunc2(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 height, byte *maskPtr,
+void gfxUpdateSpriteMask(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 height, byte *maskPtr,
 	int16 maskWidth, int16 maskHeight, byte *bufferSprPtr, byte *bufferMskPtr, int16 xs, int16 ys, int16 xm, int16 ym, byte maskIdx) {
 	int16 i, j, d, spritePitch, maskPitch;
-        
+
 	width *= 8;
 	maskWidth *= 8;
 
@@ -226,7 +225,7 @@
 		memcpy(bufferSprPtr, spritePtr, spritePitch * height);
 		memcpy(bufferMskPtr, spriteMskPtr, spritePitch * height);
 	}
-    
+
 	if (ys > ym) {
 		d = ys - ym;
 		maskPtr += d * maskPitch;
@@ -331,32 +330,19 @@
 	memset(pageRaw, 0, 320 * 200);
 }
 
-void gfxConvertSpriteToRaw(byte *dst, byte *src, uint16 width, uint16 height) {
-	int x, y, d, bit, plane;
-
-	width >>= 3;
-	for (y = 0; y < height; y++) {
-		for (x = 0; x < width; x++) {
-			byte data[2][4];
-			data[0][0] = *src++;
-			data[1][0] = *src++;
-			data[0][1] = *src++;
-			data[1][1] = *src++;
-			data[0][2] = *src++;
-			data[1][2] = *src++;
-			data[0][3] = *src++;
-			data[1][3] = *src++;
-			for (d = 0; d < 2; ++d) {
-				for (bit = 0; bit < 8; ++bit) {
-					byte color = 0;
-					for (plane = 0; plane < 4; ++plane) {
-						if (data[d][plane] & (1 << (7 - bit))) {
-							color |= 1 << plane;
-						}
+void gfxConvertSpriteToRaw(byte *dst, const byte *src, uint16 w, uint16 h) {
+	for (int y = 0; y < h; ++y) {
+		for (int x = 0; x < w / 8; ++x) {
+			for (int bit = 0; bit < 16; ++bit) {
+				uint8 color = 0;
+				for (int p = 0; p < 4; ++p) {
+					if (READ_BE_UINT16(src + p * 2) & (1 << (15 - bit))) {
+						color |= 1 << p;
 					}
-					*dst++ = color;
 				}
+				*dst++ = color;
 			}
+			src += 8;
 		}
 	}
 }

Modified: scummvm/trunk/engines/cine/gfx.h
===================================================================
--- scummvm/trunk/engines/cine/gfx.h	2007-12-08 08:49:22 UTC (rev 29757)
+++ scummvm/trunk/engines/cine/gfx.h	2007-12-08 09:10:08 UTC (rev 29758)
@@ -38,17 +38,15 @@
 
 void gfxInit();
 void setMouseCursor(int cursor);
-void convertGfx(byte *source, byte *dest, const uint16 width, const uint16 height);
-void convertGfx2(byte *source, byte *dest, const uint16 width, const uint16 height);
 void gfxCopyPage(byte *source, byte *dest);
 
 void transformPaletteRange(byte startColor, byte numColor, int8 r, int8 g, int8 b);
 void gfxFlipPage(void);
 
-void gfxSpriteFunc1(byte *ptr, byte *msk, uint16 width, uint16 height, byte *page, int16 x, int16 y);
+void gfxDrawMaskedSprite(byte *ptr, byte *msk, uint16 width, uint16 height, byte *page, int16 x, int16 y);
 void gfxFillSprite(byte *src4, uint16 sw, uint16 sh, byte *dst4, int16 sx, int16 sy, uint8 fillColor = 0);
 
-void gfxSpriteFunc2(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 height, byte *maskPtr,
+void gfxUpdateSpriteMask(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 height, byte *maskPtr,
     int16 maskWidth, int16 maskHeight, byte *bufferSprPtr, byte *bufferMskPtr, int16 xs, int16 ys, int16 xm, int16 ym, byte maskIdx);
 
 void gfxDrawLine(int16 x1, int16 y1, int16 x2, int16 y2, byte color, byte *page);
@@ -59,7 +57,7 @@
 int16 gfxGetBit(int16 x, int16 y, byte *ptr, int16 width);
 
 void gfxResetRawPage(byte *pageRaw);
-void gfxConvertSpriteToRaw(byte *dest, byte *source, uint16 width, uint16 height);
+void gfxConvertSpriteToRaw(byte *dst, const byte *src, uint16 w, uint16 h);
 void gfxCopyRawPage(byte *source, byte * dest);
 void gfxFlipRawPage(byte *frontBuffer);
 void drawSpriteRaw(byte *spritePtr, byte *maskPtr, int16 width, int16 height, byte *page, int16 x, int16 y);
@@ -68,7 +66,7 @@
 
 void fadeToBlack(void);
 
-void gfxFuncGen1(byte *param1, byte *param2, byte *param3, byte *param4, int16 param5);
+void gfxDrawMaskedSprite(byte *param1, byte *param2, byte *param3, byte *param4, int16 param5);
 void ptrGfxFunc13(void);
 void gfxFuncGen2(void);
 

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2007-12-08 08:49:22 UTC (rev 29757)
+++ scummvm/trunk/engines/cine/various.cpp	2007-12-08 09:10:08 UTC (rev 29758)
@@ -2181,7 +2181,7 @@
 
 			maskWidth = animDataTable[maskSpriteIdx].width / 2;
 			maskHeight = animDataTable[maskSpriteIdx].height;
-			gfxSpriteFunc2(spritePtr, maskPtr, width, height, animDataTable[maskSpriteIdx].ptr1, maskWidth, maskHeight, ptr, msk, x, y, maskX, maskY, i++);
+			gfxUpdateSpriteMask(spritePtr, maskPtr, width, height, animDataTable[maskSpriteIdx].ptr1, maskWidth, maskHeight, ptr, msk, x, y, maskX, maskY, i++);
 #ifdef DEBUG_SPRITE_MASK
 			gfxFillSprite(animDataTable[maskSpriteIdx].ptr1, maskWidth, maskHeight, page, maskX, maskY, 1);
 #endif
@@ -2191,11 +2191,11 @@
 	}
 
 	if (si) {
-		gfxSpriteFunc1(ptr, msk, width, height, page, x, y);
+		gfxDrawMaskedSprite(ptr, msk, width, height, page, x, y);
 		free(ptr);
 		free(msk);
 	} else {
-		gfxSpriteFunc1(spritePtr, maskPtr, width, height, page, x, y);
+		gfxDrawMaskedSprite(spritePtr, maskPtr, width, height, page, x, y);
 	}
 }
 


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