[Scummvm-cvs-logs] SF.net SVN: scummvm: [26853] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed May 16 14:58:47 CEST 2007


Revision: 26853
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26853&view=rev
Author:   kirben
Date:     2007-05-16 05:58:47 -0700 (Wed, 16 May 2007)

Log Message:
-----------
Add code for handling special walls in Elvira 1/2.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/draw.cpp
    scummvm/trunk/engines/agos/icons.cpp

Modified: scummvm/trunk/engines/agos/draw.cpp
===================================================================
--- scummvm/trunk/engines/agos/draw.cpp	2007-05-16 10:03:02 UTC (rev 26852)
+++ scummvm/trunk/engines/agos/draw.cpp	2007-05-16 12:58:47 UTC (rev 26853)
@@ -164,6 +164,29 @@
 		_vgaSpriteChanged++;
 	}
 
+	if ((getGameType() == GType_ELVIRA1 && !_variableArray[293] ||
+		getGameType() == GType_ELVIRA2 && !_variableArray[71]) &&
+		_wallOn) {
+
+		VC10_state state;
+		state.srcPtr  = getBackGround() + 504;
+		state.height = 127;
+		state.width = 14;
+		state.y = 0;
+		state.x = 0;
+		state.palette = 0;
+		state.paletteMod = 0;
+		state.flags = kDFNonTrans;
+
+		_windowNum = 4;
+
+		_backFlag = 1;
+		drawImage(&state);
+		_backFlag = 0;
+
+		_vgaSpriteChanged++;
+	}
+
 	if (!_scrollFlag && !_vgaSpriteChanged) {
 		return;
 	}
@@ -201,6 +224,74 @@
 		vsp++;
 	}
 
+	if (getGameType() == GType_ELVIRA1 && _variableArray[293]) {
+		debug(0, "Using special wall");
+
+		uint8 color, h, len;
+		byte *dst = _window4BackScn;
+
+		color = (_variableArray[293] & 1) ? 13 : 15;
+		_wallOn = 2;
+
+		h = 127;
+		while (h) {
+			len = 112;
+			while (len--) {
+				*dst++ = color;
+				dst++;
+			}
+
+			h--;
+			if (h == 0)
+				break;
+
+			len = 112;
+			while (len--) {
+				dst++;
+				*dst++ = color;
+			}
+			h--;
+		}			
+
+		_window4Flag = 1;
+		setMoveRect(0, 224, 0, 127);
+	} else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) {
+		debug(0, "Using special wall");
+
+		uint8 color, h, len;
+		byte *dst = _window4BackScn;
+
+		color = 1;
+		_wallOn = 2;
+
+		h = 43;
+		while (h) {
+			len = 56;
+			while (len--) {
+				*dst++ = color;
+				dst += 3;
+			}
+
+			h--;
+			if (h == 0)
+				break;
+
+			dst += 448;
+
+			len = 56;
+			while (len--) {
+				dst += 2;
+				*dst++ = color;
+				dst++;
+			}
+			dst += 448;
+			h--;
+		}			
+
+		_window4Flag = 1;
+		setMoveRect(0, 224, 0, 127);
+	}
+
 	if (_window6Flag == 1)
 		_window6Flag++;
 

Modified: scummvm/trunk/engines/agos/icons.cpp
===================================================================
--- scummvm/trunk/engines/agos/icons.cpp	2007-05-16 10:03:02 UTC (rev 26852)
+++ scummvm/trunk/engines/agos/icons.cpp	2007-05-16 12:58:47 UTC (rev 26853)
@@ -64,6 +64,8 @@
 // Thanks to Stuart Caie for providing the original
 // C conversion upon which this function is based.
 static void decompressIconPlanar(byte *dst, byte *src, uint width, uint height, byte base, uint pitch, bool decompress = true) {
+	printf("decompressIconPlanar\n");
+
 	byte icon_pln[288];
 	byte *i, *o, *srcPtr, x, y;
 
@@ -72,7 +74,7 @@
 		// Decode RLE planar icon data
 		i = src;
 		o = icon_pln;
-		while (o < &icon_pln[288]) {
+		while (o < &icon_pln[width * height / 2]) {
 			x = *i++;
 			if (x < 128) {
 				do {
@@ -93,14 +95,16 @@
 		srcPtr = icon_pln;
 	}
 
+	printf("decompressIconPlanar: Decompressed\n");
+
 	// Translate planar data to chunky (very slow method)
-	for (y = 0; y < 24; y++) {
-		for (x = 0; x < 24; x++) {
+	for (y = 0; y < height; y++) {
+		for (x = 0; x < width; x++) {
 			byte pixel =
-				  (srcPtr[((     y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 1 : 0)
-				| (srcPtr[((24 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0)
-				| (srcPtr[((48 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 4 : 0)
-				| (srcPtr[((72 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 8 : 0);
+				  (srcPtr[((height * 0 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 1 : 0)
+				| (srcPtr[((height * 1 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0)
+				| (srcPtr[((height * 2 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 4 : 0)
+				| (srcPtr[((height * 3 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 8 : 0);
 			if (pixel)
 				dst[x] = pixel | base;
 		}
@@ -207,7 +211,7 @@
 	} else {
 		src = _iconFilePtr;
 		src += READ_LE_UINT16(&((uint16 *)src)[icon]);
-		decompressIcon(dst, src, 24, 12, 224, _dxSurfacePitch);
+		decompressIcon(dst, src, 24, 24, 224, _dxSurfacePitch);
 	}
 
 	_lockWord &= ~0x8000;
@@ -225,8 +229,13 @@
 
 	uint8 color = dst[0] & 0xF0;
 	if (getPlatform() == Common::kPlatformAmiga) {
-		// TODO
-		return;
+		src = _iconFilePtr;
+		src += READ_BE_UINT16(&((uint16 *)src)[icon]);
+
+
+		//decompressIcon(dst, src, 24, 10, color, _dxSurfacePitch);
+
+		decompressIconPlanar(dst, src, 24, 24, color, _dxSurfacePitch);
 	} else {
 		src = _iconFilePtr;
 		src += READ_LE_UINT16(&((uint16 *)src)[icon]);
@@ -254,7 +263,7 @@
 	} else {
 		src = _iconFilePtr;
 		src += READ_LE_UINT16(&((uint16 *)src)[icon]);
-		decompressIcon(dst, src, 24, 12, color, _dxSurfacePitch);
+		decompressIcon(dst, src, 24, 24, color, _dxSurfacePitch);
 	}
 
 	_lockWord &= ~0x8000;


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