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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed Oct 11 14:03:55 CEST 2006


Revision: 24272
          http://svn.sourceforge.net/scummvm/?rev=24272&view=rev
Author:   kirben
Date:     2006-10-11 05:03:47 -0700 (Wed, 11 Oct 2006)

Log Message:
-----------
Add support for clearWindow and cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/vga.cpp
    scummvm/trunk/engines/agos/vga.h

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-11 09:21:59 UTC (rev 24271)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-11 12:03:47 UTC (rev 24272)
@@ -559,7 +559,7 @@
 	return 0;
 }
 
-const static uint16 initialVideoWindows_Simon[20] = {
+static const uint16 initialVideoWindows_Simon[20] = {
 	0,  0, 20, 200,
 	0,  0,  3, 136,
 	17, 0,  3, 136,
@@ -567,7 +567,7 @@
 	0,  0, 20, 134
 };
 
-const static uint16 initialVideoWindows_Common[20] = {
+static const uint16 initialVideoWindows_Common[20] = {
 	 3, 0, 14, 136,
 	 0, 0,  3, 136,
 	17, 0,  3, 136,
@@ -1765,6 +1765,8 @@
 		}
 	}
 
+	clearWindow(_windowNum, READ_BE_UINT16(&((ImageHeader_WW *) b)->color));
+
 	vc_ptr_org = _vcPtr;
 
 	if (getGameType() == GType_FF || getGameType() == GType_PP) {

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-11 09:21:59 UTC (rev 24271)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-11 12:03:47 UTC (rev 24272)
@@ -1217,6 +1217,8 @@
 	void checkScrollY(int16 y, int16 ypos);
 	void centreScroll();
 
+	void clearWindow(uint windowNum, uint color);
+
 	void startOverlayAnims();
 	void startAnOverlayAnim();
 

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-10-11 09:21:59 UTC (rev 24271)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-10-11 12:03:47 UTC (rev 24272)
@@ -737,7 +737,7 @@
 byte *AGOSEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) {
 	w *= 8;
 
-	byte *src_org, *dstPtr;
+	byte *dst, *dstPtr, *srcPtr;
 	byte color;
 	int8 cur = -0x80;
 	uint i, w_cur = w;
@@ -745,7 +745,7 @@
 	dstPtr = _videoBuf1 + w;
 
 	do {
-		byte *dst = dstPtr;
+		dst = dstPtr;
 		uint h_cur = h;
 
 		if (cur == -0x80)
@@ -784,18 +784,17 @@
 		dstPtr++;
 	} while (--w_cur);
 
+	srcPtr = dstPtr = _videoBuf1 + w;
 
-	src_org = dstPtr = _videoBuf1 + w;
-
 	do {
-		byte *dst = dstPtr;
+		dst = dstPtr;
 		for (i = 0; i != w; ++i) {
-			byte b = src_org[i];
+			byte b = srcPtr[i];
 			b = (b >> 4) | (b << 4);
 			*--dst = b;
 		}
 
-		src_org += w;
+		srcPtr += w;
 		dstPtr += w;
 	} while (--h);
 
@@ -1252,48 +1251,43 @@
 	if (drawImages_clip(state) == 0)
 		return;
 
-	uint offs, offs2;
+	uint xoffs, yoffs;
 	if (getGameType() == GType_ELVIRA1) {
-		//if (_windowNum != 2 && _windowNum != 3) {
-		//	offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
-		//	offs2 = (vlut[1] - _videoWindows[17] + state->y);
+		//if (_windowNum != 2 && _windowNum != 3 && _windowNum != 6) {
+		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
 		//} else {
-			offs = (vlut[0] * 2 + state->x) * 8;
-			offs2 = vlut[1] + state->y;
+			xoffs = (vlut[0] * 2 + state->x) * 8;
+			yoffs = vlut[1] + state->y;
 		//}
 	} else if (getGameType() == GType_ELVIRA2) {
 		//if (_windowNum == 4 || _windowNum >= 10) {
-		//	offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
-		//	offs2 = (vlut[1] - _videoWindows[17] + state->y);
+		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
 		//} else {
-			offs = (vlut[0] * 2 + state->x) * 8;
-			offs2 = vlut[1] + state->y;
+			xoffs = (vlut[0] * 2 + state->x) * 8;
+			yoffs = vlut[1] + state->y;
 		//}
 	} else if (getGameType() == GType_WW) {
-		//if (_windowNum == 4 || (_windowNum >= 10 && _windowsNum < 28)) {
-		//	offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
-		//	offs2 = (vlut[1] - _videoWindows[17] + state->y);
+		//if (_windowNum == 4 || (_windowNum >= 10 && _windowNum < 28)) {
+		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
 		//} else {
-			offs = (vlut[0] * 2 + state->x) * 8;
-			offs2 = vlut[1] + state->y;
+			xoffs = (vlut[0] * 2 + state->x) * 8;
+			yoffs = vlut[1] + state->y;
 		//}
-	} else if (getGameType() == GType_SIMON1) {
+	} else if (getGameType() == GType_SIMON1 && (_subroutine == 2923 || _subroutine == 2926)) {
 		// Allow one section of Simon the Sorcerer 1 introduction to be displayed
 		// in lower half of screen
-		if ((getGameType() == GType_SIMON1) && (_subroutine == 2923 || _subroutine == 2926)) {
-			offs = state->x * 8;
-			offs2 = state->y;
-		} else {
-			offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
-			offs2 = (vlut[1] - _videoWindows[17] + state->y);
-		}
+		xoffs = state->x * 8;
+		yoffs = state->y;
 	} else {
-		offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
-		offs2 = (vlut[1] - _videoWindows[17] + state->y);
+		xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		yoffs = (vlut[1] - _videoWindows[17] + state->y);
 	}
 
-	state->surf2_addr += offs + offs2 * state->surf2_pitch;
-	state->surf_addr += offs + offs2 * state->surf_pitch;
+	state->surf2_addr += xoffs + yoffs * state->surf_pitch;
+	state->surf_addr += xoffs + yoffs * state->surf2_pitch;
 
 	if (state->flags & kDFMasked) {
 		byte *mask, *src, *dst;
@@ -1988,11 +1982,32 @@
 	_leftButtonDown = 0;
 }
 
+void AGOSEngine::clearWindow(uint num, uint color) {
+	if (getGameType() == GType_ELVIRA1) {
+		if (num == 2 || num == 6)
+			return;
+	} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
+		if (num != 4 && num < 10)
+			return;
+	}
+
+	if (num == 3) {
+		memset(getBackBuf(), 0, _screenWidth * _screenHeight);
+	} else { 
+		const uint16 *vlut = &_videoWindows[num * 4];
+		byte *dst = getBackBuf() + vlut[0] * 16 + vlut[1] * _dxSurfacePitch;
+
+		for (uint h = 0; h < vlut[3]; h++) {
+			memset(dst, 0, vlut[2] * 16);
+			dst += _screenWidth;
+		}
+	}
+}
+
 void AGOSEngine::vc35_clearWindow() {
 	uint16 num = vcReadNextWord();
 	uint16 color = vcReadNextWord();
-
-	debug(0, "vc35_clearWindow: window %d color %d", num, color);
+	clearWindow(num, color);
 }
 
 void AGOSEngine::vc36_setWindowImage() {

Modified: scummvm/trunk/engines/agos/vga.h
===================================================================
--- scummvm/trunk/engines/agos/vga.h	2006-10-11 09:21:59 UTC (rev 24271)
+++ scummvm/trunk/engines/agos/vga.h	2006-10-11 12:03:47 UTC (rev 24272)
@@ -71,7 +71,7 @@
 // Elvira 1/2 and Waxworks
 struct ImageHeader_WW {
 	uint16 id;
-	uint16 x_1;
+	uint16 color;
 	uint16 x_2;
 	uint16 scriptOffs;
 };


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