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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Oct 9 15:00:33 CEST 2006


Revision: 24253
          http://svn.sourceforge.net/scummvm/?rev=24253&view=rev
Author:   kirben
Date:     2006-10-09 06:00:25 -0700 (Mon, 09 Oct 2006)

Log Message:
-----------
Use correct video window values for each game and minor cleanup

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

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-09 11:42:12 UTC (rev 24252)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-09 13:00:25 UTC (rev 24253)
@@ -377,6 +377,7 @@
 	memset(_displayPalette, 0, sizeof(_displayPalette));
 
 	memset(_videoBuf1, 0, sizeof(_videoBuf1));
+	memset(_videoWindows, 0, sizeof(_videoWindows));
 
 	_dummyWindow = new WindowBlock;
 	_windowList = new WindowBlock[16];
@@ -558,6 +559,22 @@
 	return 0;
 }
 
+const static uint16 initialVideoWindows_Simon[24] = {
+	0,  0, 20, 200,
+	0,  0,  3, 136,
+	17, 0,  3, 136,
+	0,  0, 20, 200,
+	0,  0, 20, 134
+};
+
+const static uint16 initialVideoWindows_Common[24] = {
+	 3, 0, 14, 136,
+	 0, 0,  3, 136,
+	17, 0,  3, 136,
+	 0, 0, 20, 200,
+	 3, 3, 14, 127,
+};
+
 void AGOSEngine::setupGame() {
 	if (getGameType() == GType_PP) {
 		gss = PTR(puzzlepack_settings);
@@ -695,6 +712,13 @@
 	_noOverWrite = 0xFFFF;
 
 	_stringIdLocalMin = 1;
+
+	for (int i = 0; i < 24; i++) {
+		if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
+			_videoWindows[i] = initialVideoWindows_Simon[i];
+		else
+			_videoWindows[i] = initialVideoWindows_Common[i];
+	}
 }
 
 AGOSEngine::~AGOSEngine() {

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-09 11:42:12 UTC (rev 24252)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-09 13:00:25 UTC (rev 24253)
@@ -472,6 +472,7 @@
 	uint8 _displayPalette[1024];
 
 	byte _videoBuf1[3000];
+	uint16 _videoWindows[128];
 
 	VgaTimerEntry _vgaTimerList[205];
 
@@ -1241,7 +1242,7 @@
 	byte *getBackGround();
 	byte *getScaleBuf();
 
-	void convertAmiga(byte *srcBuf, int32 flength);
+	void convertAmiga(byte *srcBuf, int32 fileSize);
 	void loadVGAFile(uint id, uint type);
 	void loadSimonVGAFile(uint id);
 

Modified: scummvm/trunk/engines/agos/icons.cpp
===================================================================
--- scummvm/trunk/engines/agos/icons.cpp	2006-10-09 11:42:12 UTC (rev 24252)
+++ scummvm/trunk/engines/agos/icons.cpp	2006-10-09 13:00:25 UTC (rev 24253)
@@ -178,7 +178,7 @@
 		if (getPlatform() == Common::kPlatformAmiga) {
 			src = _iconFilePtr;
 			src += READ_BE_UINT32(&((uint32 *)src)[icon]);
-			decompressIconAmiga (dst, src, 224, _dxSurfacePitch);
+			decompressIconAmiga (dst, src, 16, _dxSurfacePitch);
 		} else {
 			src = _iconFilePtr;
 			src += READ_LE_UINT16(&((uint16 *)src)[icon]);

Modified: scummvm/trunk/engines/agos/res_ami.cpp
===================================================================
--- scummvm/trunk/engines/agos/res_ami.cpp	2006-10-09 11:42:12 UTC (rev 24252)
+++ scummvm/trunk/engines/agos/res_ami.cpp	2006-10-09 13:00:25 UTC (rev 24253)
@@ -87,14 +87,14 @@
 	uint16 length, i, j, k, word1, word2, word3, word4, cliplength;
 	byte outbyte, outbyte1, x, y;
 	char n;
-	uncbuffer = (byte *)malloc(height * width * 2);
-	uncbfrout = (byte *)malloc(height * width * 2);
+	uncbuffer = (byte *)malloc(height * width * 4);
+	uncbfrout = (byte *)malloc(height * width * 4);
 	length = width / 16;
 	length *= height;
-	plane0 = READ_BE_UINT32(clipptr) + clipptr; clipptr += 4; plane0 += 4;
-	plane1 = READ_BE_UINT32(clipptr) + clipptr; clipptr += 4; plane1 += 4;
-	plane2 = READ_BE_UINT32(clipptr) + clipptr; clipptr += 4; plane2 += 4;
-	plane3 = READ_BE_UINT32(clipptr) + clipptr; clipptr += 4; plane3 += 4;
+	plane0 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane0 += 4;
+	plane1 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane1 += 4;
+	plane2 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane2 += 4;
+	plane3 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane3 += 4;
 	plane0 -= 4;
 	plane1 -= 8;
 	plane2 -= 12;

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-10-09 11:42:12 UTC (rev 24252)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-10-09 13:00:25 UTC (rev 24253)
@@ -737,15 +737,15 @@
 byte *AGOSEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) {
 	w *= 8;
 
-	byte *src_org, *dst_org;
+	byte *src_org, *dstPtr;
 	byte color;
 	int8 cur = -0x80;
 	uint i, w_cur = w;
 
-	dst_org = _videoBuf1 + w;
+	dstPtr = _videoBuf1 + w;
 
 	do {
-		byte *dst = dst_org;
+		byte *dst = dstPtr;
 		uint h_cur = h;
 
 		if (cur == -0x80)
@@ -781,14 +781,14 @@
 			cur = *src++;
 		}
 	next_line:
-		dst_org++;
+		dstPtr++;
 	} while (--w_cur);
 
 
-	src_org = dst_org = _videoBuf1 + w;
+	src_org = dstPtr = _videoBuf1 + w;
 
 	do {
-		byte *dst = dst_org;
+		byte *dst = dstPtr;
 		for (i = 0; i != w; ++i) {
 			byte b = src_org[i];
 			b = (b >> 4) | (b << 4);
@@ -796,66 +796,40 @@
 		}
 
 		src_org += w;
-		dst_org += w;
+		dstPtr += w;
 	} while (--h);
 
 	return _videoBuf1;
 }
 
 byte *AGOSEngine::vc10_flip(const byte *src, uint w, uint h) {
-	if (src == _vc10BasePtrOld)
-		return _videoBuf1;
+	w *= 8;
 
-	_vc10BasePtrOld = src;
-
-	byte *dst_org, *src_org;
+	byte *dstPtr;
 	uint i;
 
-	w *= 8;
-	src_org = dst_org = _videoBuf1 + w;
+	dstPtr = _videoBuf1 + w;
 
 	do {
-		byte *dst = dst_org;
+		byte *dst = dstPtr;
 		for (i = 0; i != w; ++i) {
-			byte b = src_org[i];
+			byte b = src[i];
 			b = (b >> 4) | (b << 4);
 			*--dst = b;
 		}
 
-		src_org += w;
-		dst_org += w;
+		src += w;
+		dstPtr += w;
 	} while (--h);
 
 	return _videoBuf1;
 }
 
-/* must not be const */
-// FIXME: In that case it is *wrong* to have it as a static
-// variable here! Rather, it should be turned into a member
-// of class AGOSEngine.
-static uint16 _video_windows[128] = {
-	0,  0, 20, 200,
-	0,  0,  3, 136,
-	17, 0,  3, 136,
-	0,  0, 20, 200,
-	0,  0, 20, 134
-};
-
-/* Elvira 1/2 & Waxworks
-static uint16 _video_windows[128] = {
-	 3, 0, 14, 136,
-	 0, 0,  3, 136,
-	17, 0,  3, 136,
-	 0, 0, 20, 200,
-	 3, 3, 14, 127,
-};
- */
-
 void AGOSEngine::decodeColumn(byte *dst, const byte *src, int height) {
 	const uint pitch = _dxSurfacePitch;
 	int8 reps = (int8)0x80;
 	byte color;
-	byte *dst_org = dst;
+	byte *dstPtr = dst;
 	uint h = height, w = 8;
 
 	for (;;) {
@@ -872,7 +846,7 @@
 					/* reached right edge? */
 					if (--w == 0)
 						return;
-					dst = ++dst_org;
+					dst = ++dstPtr;
 					h = height;
 				}
 			} while (--reps >= 0);
@@ -887,7 +861,7 @@
 					/* reached right edge? */
 					if (--w == 0)
 						return;
-					dst = ++dst_org;
+					dst = ++dstPtr;
 					h = height;
 				}
 			} while (++reps != 0);
@@ -899,7 +873,7 @@
 	const uint pitch = _dxSurfacePitch;
 	int8 reps = (int8)0x80;
 	byte color;
-	byte *dst_org = dst;
+	byte *dstPtr = dst;
 	uint w = width, h = 8;
 
 	for (;;) {
@@ -915,8 +889,8 @@
 					/* reached bottom? */
 					if (--h == 0)
 						return;
-					dst_org += pitch;
-					dst = dst_org;
+					dstPtr += pitch;
+					dst = dstPtr;
 					w = width;
 				}
 			} while (--reps >= 0);
@@ -930,8 +904,8 @@
 					/* reached bottom? */
 					if (--h == 0)
 						return;
-					dst_org += pitch;
-					dst = dst_org;
+					dstPtr += pitch;
+					dst = dstPtr;
 					w = width;
 				}
 			} while (++reps != 0);
@@ -1056,7 +1030,7 @@
 	uint maxWidth, maxHeight;
 	int cur;
 
-	vlut = &_video_windows[_windowNum * 4];
+	vlut = &_videoWindows[_windowNum * 4];
 
 	if (getGameType() != GType_FF && getGameType() != GType_PP) {
 		state->draw_width = state->width * 2;
@@ -1116,16 +1090,16 @@
 			state->surf_pitch = _dxSurfacePitch;
 
 			uint w, h;
-			byte *src, *dst, *dst_org;
+			byte *src, *dst, *dstPtr;
 
 			state->dl = state->width;
 			state->dh = state->height;
 
-			dst_org = state->surf_addr;
+			dstPtr = state->surf_addr;
 			w = 0;
 			do {
 				src = vc10_depackColumn(state);
-				dst = dst_org;
+				dst = dstPtr;
 
 				h = 0;
 				do {
@@ -1133,7 +1107,7 @@
 					dst += _screenWidth;
 					src++;
 				} while (++h != state->draw_height);
-				dst_org++;
+				dstPtr++;
 			} while (++w != state->draw_width);
 
 			if (_vgaCurSpritePriority % 10 != 9) {
@@ -1150,18 +1124,18 @@
 			state->surf_addr += (state->x + _scrollX) + (state->y + _scrollY) * state->surf_pitch;
 
 			uint w, h;
-			byte *src, *dst, *dst_org;
+			byte *src, *dst, *dstPtr;
 
 			state->dl = state->width;
 			state->dh = state->height;
 
-			dst_org = state->surf_addr;
+			dstPtr = state->surf_addr;
 			w = 0;
 			do {
 				byte color;
 
 				src = vc10_depackColumn(state);
-				dst = dst_org;
+				dst = dstPtr;
 
 				h = 0;
 				do {
@@ -1171,7 +1145,7 @@
 					dst += _screenWidth;
 					src++;
 				} while (++h != state->draw_height);
-				dst_org++;
+				dstPtr++;
 			} while (++w != state->draw_width);
 
 			if (_vgaCurSpritePriority % 10 == 9) {
@@ -1184,7 +1158,7 @@
 			state->surf_addr += state->x + state->y * state->surf_pitch;
 
 			uint w, h;
-			byte *src, *dst, *dst_org;
+			byte *src, *dst, *dstPtr;
 
 			state->dl = state->width;
 			state->dh = state->height;
@@ -1204,13 +1178,13 @@
 						return;
 				}
 
-				dst_org = state->surf_addr;
+				dstPtr = state->surf_addr;
 				w = 0;
 				do {
 					byte color;
 
 					src = vc10_depackColumn(state);
-					dst = dst_org;
+					dst = dstPtr;
 
 					h = 0;
 					do {
@@ -1220,16 +1194,16 @@
 						dst += _screenWidth;
 						src++;
 					} while (++h != state->draw_height);
-					dst_org++;
+					dstPtr++;
 				} while (++w != state->draw_width);
 			} else {
-				dst_org = state->surf_addr;
+				dstPtr = state->surf_addr;
 				w = 0;
 				do {
 					byte color;
 
 					src = vc10_depackColumn(state);
-					dst = dst_org;
+					dst = dstPtr;
 
 					h = 0;
 					do {
@@ -1239,7 +1213,7 @@
 						dst += _screenWidth;
 						src++;
 					} while (++h != state->draw_height);
-					dst_org++;
+					dstPtr++;
 				} while (++w != state->draw_width);
 			}
 		}
@@ -1273,7 +1247,7 @@
 }
 
 void AGOSEngine::drawImages(VC10_state *state) {
-	const uint16 *vlut = &_video_windows[_windowNum * 4];
+	const uint16 *vlut = &_videoWindows[_windowNum * 4];
 
 	if (drawImages_clip(state) == 0)
 		return;
@@ -1281,24 +1255,24 @@
 	uint offs, offs2;
 	if (getGameType() == GType_ELVIRA1) {
 		//if (_windowNum != 2 && _windowNum != 3) {
-		//	offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
-		//	offs2 = (vlut[1] - _video_windows[17] + state->y);
+		//	offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	offs2 = (vlut[1] - _videoWindows[17] + state->y);
 		//} else {
 			offs = (vlut[0] * 2 + state->x) * 8;
 			offs2 = vlut[1] + state->y;
 		//}
 	} else if (getGameType() == GType_ELVIRA2) {
 		//if (_windowNum == 4 || _windowNum >= 10) {
-		//	offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
-		//	offs2 = (vlut[1] - _video_windows[17] + state->y);
+		//	offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	offs2 = (vlut[1] - _videoWindows[17] + state->y);
 		//} else {
 			offs = (vlut[0] * 2 + state->x) * 8;
 			offs2 = vlut[1] + state->y;
 		//}
 	} else if (getGameType() == GType_WW) {
 		//if (_windowNum == 4 || (_windowNum >= 10 && _windowsNum < 28)) {
-		//	offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
-		//	offs2 = (vlut[1] - _video_windows[17] + state->y);
+		//	offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	offs2 = (vlut[1] - _videoWindows[17] + state->y);
 		//} else {
 			offs = (vlut[0] * 2 + state->x) * 8;
 			offs2 = vlut[1] + state->y;
@@ -1310,12 +1284,12 @@
 			offs = state->x * 8;
 			offs2 = state->y;
 		} else {
-			offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
-			offs2 = (vlut[1] - _video_windows[17] + state->y);
+			offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+			offs2 = (vlut[1] - _videoWindows[17] + state->y);
 		}
 	} else {
-		offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
-		offs2 = (vlut[1] - _video_windows[17] + state->y);
+		offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		offs2 = (vlut[1] - _videoWindows[17] + state->y);
 	}
 
 	state->surf2_addr += offs + offs2 * state->surf2_pitch;
@@ -1377,7 +1351,7 @@
 		uint h, i;
 
 		if (state->flags & kDFCompressed) {
-			byte *dst_org = state->surf_addr;
+			byte *dstPtr = state->surf_addr;
 			src = state->depack_src;
 			/* AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD EEEEEEEE
 			 * aaaaabbb bbcccccd ddddeeee efffffgg ggghhhhh
@@ -1386,7 +1360,7 @@
 			do {
 				uint count = state->draw_width / 4;
 
-				dst = dst_org;
+				dst = dstPtr;
 				do {
 					uint32 bits = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | (src[3]);
 					byte color;
@@ -1422,7 +1396,7 @@
 					dst += 8;
 					src += 5;
 				} while (--count);
-				dst_org += _screenWidth;
+				dstPtr += _screenWidth;
 			} while (--state->draw_height);
 		} else {
 			src = state->depack_src + (state->width * state->y_skip * 16) + (state->x_skip * 8);
@@ -1448,7 +1422,7 @@
 
 		if (state->flags & kDFCompressed) {
 			uint w, h;
-			byte *src, *dst, *dst_org;
+			byte *src, *dst, *dstPtr;
 
 			state->x_skip *= 4;				/* reached */
 
@@ -1457,16 +1431,16 @@
 
 			vc10_skip_cols(state);
 
-			dst_org = state->surf_addr;
+			dstPtr = state->surf_addr;
 			if (!(state->flags & kDFNonTrans) && (state->flags & 0x40)) { /* reached */
-				dst_org += vcReadVar(252);
+				dstPtr += vcReadVar(252);
 			}
 			w = 0;
 			do {
 				byte color;
 
 				src = vc10_depackColumn(state);
-				dst = dst_org;
+				dst = dstPtr;
 
 				h = 0;
 				do {
@@ -1479,7 +1453,7 @@
 					dst += _screenWidth;
 					src++;
 				} while (++h != state->draw_height);
-				dst_org += 2;
+				dstPtr += 2;
 			} while (++w != state->draw_width);
 			/* vc10_helper_6 */
 		} else {
@@ -1915,7 +1889,7 @@
 }
 
 void AGOSEngine::vc26_setSubWindow() {
-	uint16 *as = &_video_windows[vcReadNextWord() * 4]; // number
+	uint16 *as = &_videoWindows[vcReadNextWord() * 4]; // number
 	as[0] = vcReadNextWord(); // x
 	as[1] = vcReadNextWord(); // y
 	as[2] = vcReadNextWord(); // width
@@ -2018,7 +1992,7 @@
 	uint16 num = vcReadNextWord();
 	uint16 color = vcReadNextWord();
 
-	debug(0, "vc35_clearWindow: window %d color %d\n", num, color);
+	debug(0, "vc35_clearWindow: window %d color %d", num, color);
 }
 
 void AGOSEngine::vc36_setWindowImage() {
@@ -2154,7 +2128,7 @@
 		uint num = vcReadNextWord();
 		uint color = vcReadNextWord();
 
-		debug(0, "vc45: window %d color %d\n", num, color);
+		debug(0, "vc45: window %d color %d", num, color);
 	} else {
 		VgaSprite *vsp = findCurSprite();
 		vsp->x = vcReadVar(vcReadNextWord());


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