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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Nov 6 09:07:55 CET 2006


Revision: 24633
          http://svn.sourceforge.net/scummvm/?rev=24633&view=rev
Author:   kirben
Date:     2006-11-06 00:07:47 -0800 (Mon, 06 Nov 2006)

Log Message:
-----------
Split draw code for earlier games, to prevent regressions for now

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

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-11-06 07:58:37 UTC (rev 24632)
+++ scummvm/trunk/engines/agos/agos.h	2006-11-06 08:07:47 UTC (rev 24633)
@@ -1275,9 +1275,12 @@
 	void opp_restartClock();
 
 protected:
+	bool drawImages_clip(VC10_state *state);
+
 	void drawImages(VC10_state *state);
+	void drawImages_Simon(VC10_state *state);
 	void drawImages_Feeble(VC10_state *state);
-	bool drawImages_clip(VC10_state *state);
+
 	void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
 	void horizontalScroll(VC10_state *state);
 	void verticalScroll(VC10_state *state);

Modified: scummvm/trunk/engines/agos/gfx.cpp
===================================================================
--- scummvm/trunk/engines/agos/gfx.cpp	2006-11-06 07:58:37 UTC (rev 24632)
+++ scummvm/trunk/engines/agos/gfx.cpp	2006-11-06 08:07:47 UTC (rev 24633)
@@ -387,38 +387,14 @@
 	} 
 }
 
-void AGOSEngine::drawImages(VC10_state *state) {
+void AGOSEngine::drawImages_Simon(VC10_state *state) {
 	const uint16 *vlut = &_videoWindows[_windowNum * 4];
 
 	if (drawImages_clip(state) == 0)
 		return;
 
 	uint xoffs, yoffs;
-	if (getGameType() == GType_ELVIRA1) {
-		//if (_windowNum != 2 && _windowNum != 3 && _windowNum != 6) {
-		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
-		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
-		//} else {
-			xoffs = (vlut[0] * 2 + state->x) * 8;
-			yoffs = vlut[1] + state->y;
-		//}
-	} else if (getGameType() == GType_ELVIRA2) {
-		//if (_windowNum == 4 || _windowNum >= 10) {
-		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
-		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
-		//} else {
-			xoffs = (vlut[0] * 2 + state->x) * 8;
-			yoffs = vlut[1] + state->y;
-		//}
-	} else if (getGameType() == GType_WW) {
-		//if (_windowNum == 4 || (_windowNum >= 10 && _windowNum < 28)) {
-		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
-		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
-		//} else {
-			xoffs = (vlut[0] * 2 + state->x) * 8;
-			yoffs = vlut[1] + state->y;
-		//}
-	} else if (getGameType() == GType_SIMON1 && (_subroutine == 2923 || _subroutine == 2926)) {
+	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
 		xoffs = state->x * 8;
@@ -478,7 +454,6 @@
 			}
 		} while (++w != state->draw_width);
 	} else if ((((_lockWord & 0x20) && state->palette == 0) || state->palette == 0xC0) &&
-		(getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
 		getPlatform() != Common::kPlatformAmiga) {
 		const byte *src;
 		byte *dst;
@@ -548,14 +523,11 @@
 			} while (--h);
 		}
 	} else {
-		if (state->flags & kDFUseFrontBuf) {
+		if (getGameType() == GType_SIMON2 && state->flags & kDFUseFrontBuf && getBitFlag(171)) {
 			state->surf_addr = state->surf2_addr;
 			state->surf_pitch = state->surf2_pitch;
 		}
 
-		if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
-			state->palette = state->surf_addr[0] & 0xF0;
-
 		if (state->flags & kDFCompressed) {
 			uint w, h;
 			byte *src, *dst, *dstPtr;
@@ -617,6 +589,111 @@
 	}
 }
 
+void AGOSEngine::drawImages(VC10_state *state) {
+	const uint16 *vlut = &_videoWindows[_windowNum * 4];
+
+	if (drawImages_clip(state) == 0)
+		return;
+
+	uint xoffs, yoffs;
+	if (getGameType() == GType_ELVIRA1) {
+		//if (_windowNum != 2 && _windowNum != 3 && _windowNum != 6) {
+		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
+		//} else {
+			xoffs = (vlut[0] * 2 + state->x) * 8;
+			yoffs = vlut[1] + state->y;
+		//}
+	} else if (getGameType() == GType_ELVIRA2) {
+		//if (_windowNum == 4 || _windowNum >= 10) {
+		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
+		//} else {
+			xoffs = (vlut[0] * 2 + state->x) * 8;
+			yoffs = vlut[1] + state->y;
+		//}
+	} else if (getGameType() == GType_WW) {
+		//if (_windowNum == 4 || (_windowNum >= 10 && _windowNum < 28)) {
+		//	xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		//	yoffs = (vlut[1] - _videoWindows[17] + state->y);
+		//} else {
+			xoffs = (vlut[0] * 2 + state->x) * 8;
+			yoffs = vlut[1] + state->y;
+		//}
+	} else {
+		xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+		yoffs = (vlut[1] - _videoWindows[17] + state->y);
+	}
+
+	state->surf2_addr += xoffs + yoffs * state->surf_pitch;
+	state->surf_addr += xoffs + yoffs * state->surf2_pitch;
+
+	if (state->flags & kDFUseFrontBuf) {
+		state->surf_addr = state->surf2_addr;
+		state->surf_pitch = state->surf2_pitch;
+	}
+
+	if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
+		state->palette = state->surf_addr[0] & 0xF0;
+
+	if (state->flags & kDFCompressed) {
+		uint w, h;
+		byte *src, *dst, *dstPtr;
+
+		state->x_skip *= 4;				/* reached */
+
+		state->dl = state->width;
+		state->dh = state->height;
+
+		vc10_skip_cols(state);
+
+		dstPtr = state->surf_addr;
+		w = 0;
+		do {
+			byte color;
+
+			src = vc10_depackColumn(state);
+			dst = dstPtr;
+
+			h = 0;
+			do {
+				color = (*src / 16);
+				if ((state->flags & kDFNonTrans) || color != 0)
+					dst[0] = color | state->palette;
+				color = (*src & 15);
+				if ((state->flags & kDFNonTrans) || color != 0)
+					dst[1] = color | state->palette;
+				dst += _screenWidth;
+				src++;
+			} while (++h != state->draw_height);
+			dstPtr += 2;
+		} while (++w != state->draw_width);
+	} else {
+		const byte *src;
+		byte *dst;
+		uint count;
+
+		src = state->depack_src + (state->width * state->y_skip) * 8;
+		dst = state->surf_addr;
+		state->x_skip *= 4;
+
+		do {
+			for (count = 0; count != state->draw_width; count++) {
+				byte color;
+				color = (src[count + state->x_skip] / 16);
+				if ((state->flags & kDFNonTrans) || color)
+					dst[count * 2] = color | state->palette;
+				color = (src[count + state->x_skip] & 15);
+				if ((state->flags & kDFNonTrans) || color)
+					dst[count * 2 + 1] = color | state->palette;
+			}
+			dst += _screenWidth;
+			src += state->width * 8;
+		} while (--state->draw_height);
+	}
+}
+
+
 void AGOSEngine::horizontalScroll(VC10_state *state) {
 	const byte *src;
 	byte *dst;

Modified: scummvm/trunk/engines/agos/subroutine.cpp
===================================================================
--- scummvm/trunk/engines/agos/subroutine.cpp	2006-11-06 07:58:37 UTC (rev 24632)
+++ scummvm/trunk/engines/agos/subroutine.cpp	2006-11-06 08:07:47 UTC (rev 24633)
@@ -523,6 +523,16 @@
 	int result = -1;
 	SubroutineLine *sl = (SubroutineLine *)((byte *)sub + sub->first);
 
+	// WORKAROUND: Bit Flag 171 isn't set when Simon rides the lion to the
+	// goblin camp in non-English versions. Bit Flag 171 is required to display 
+	// the red trail between locations on the map, during the ride.
+	if (getGameType() == GType_SIMON2) {
+		if (sub->id == 13020)
+			setBitFlag(171, true);
+		if (sub->id == 13021)
+			setBitFlag(171, false);
+	}
+
 	const byte *old_code_ptr = _codePtr;
 	Subroutine *old_currentTable = _currentTable;
 	SubroutineLine *old_currentLine = _currentLine;

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-11-06 07:58:37 UTC (rev 24632)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-11-06 08:07:47 UTC (rev 24633)
@@ -671,6 +671,8 @@
 
 	if (getGameType() == GType_FF || getGameType() == GType_PP) {
 		drawImages_Feeble(&state);
+	} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
+		drawImages_Simon(&state);
 	} else {
 		drawImages(&state);
 	}


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