[Scummvm-cvs-logs] SF.net SVN: scummvm: [21675] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Fri Apr 7 17:13:02 CEST 2006


Revision: 21675
Author:   kirben
Date:     2006-04-07 17:12:16 -0700 (Fri, 07 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21675&view=rev

Log Message:
-----------
Add initial support for vertical scrolling in FF

Modified Paths:
--------------
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/vga.cpp
Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-07 22:47:06 UTC (rev 21674)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-08 00:12:16 UTC (rev 21675)
@@ -2689,35 +2689,55 @@
 void SimonEngine::scrollEvent() {
 	byte *dst = getFrontBuf();
 	const byte *src;
-	uint x;
+	uint x, y;;
 
-	if (_scrollFlag < 0) {
-		memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8);
+	if (_scrollXMax == 0) {
+		if (_scrollFlag < 0) {
+			memmove(dst + 8 * _screenWidth, dst, (_scrollHeight - 8) * _screenWidth);
+		} else {
+			memmove(dst, dst + 8 * _screenWidth, (_scrollHeight - 8) * _screenWidth);
+		}
+
+		y = _scrollY - 8;
+
+		if (_scrollFlag > 0) {
+			dst += (_scrollHeight - 8) * _screenWidth;
+			y += 488;
+		}
+
+		src = _scrollImage + y / 2;
+		decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth);
+
+		_scrollY += _scrollFlag;
+		vcWriteVar(250, _scrollY);
 	} else {
-		memmove(dst, dst + 8, _screenWidth * _scrollHeight - 8);
-	}
+		if (_scrollFlag < 0) {
+			memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8);
+		} else {
+			memmove(dst, dst + 8, _screenWidth * _scrollHeight - 8);
+		}
 
-	x = _scrollX;
-	x -= (getGameType() == GType_FF) ? 8 : 1;
+		x = _scrollX;
+		x -= (getGameType() == GType_FF) ? 8 : 1;
 
-	if (_scrollFlag > 0) {
-		dst += _screenWidth - 8;
-		x += (getGameType() == GType_FF) ? 648 : 41;
+		if (_scrollFlag > 0) {
+			dst += _screenWidth - 8;
+			x += (getGameType() == GType_FF) ? 648 : 41;
+		}
+
+		if (getGameType() == GType_FF)
+			src = _scrollImage + x / 2;
+		else
+			src = _scrollImage + x * 4;
+		decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight);
+
+		_scrollX += _scrollFlag;
+		vcWriteVar(251, _scrollX);
 	}
 
-	if (getGameType() == GType_FF)
-		src = _scrollImage + x / 2;
-	else
-		src = _scrollImage + x * 4;
-	decodeStripA(dst, src + readUint32Wrapper(src), _scrollHeight);
-
 	memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight);
-	dx_copy_from_attached_to_3(_scrollHeight);
+	memcpy(_sdl_buf_3, _sdl_buf_attached, _scrollHeight * _screenWidth);
 
-	_scrollX += _scrollFlag;
-
-	vcWriteVar(251, _scrollX);
-
 	_scrollFlag = 0;
 }
 

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-07 22:47:06 UTC (rev 21674)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-08 00:12:16 UTC (rev 21675)
@@ -1101,7 +1101,8 @@
 	void o_waitForMark(uint i);
 	void scrollEvent();
 
-	void decodeStripA(byte *dst, const byte *src, int height);
+	void decodeColumn(byte *dst, const byte *src, int height);
+	void decodeRow(byte *dst, const byte *src, int width);
 	void scroll_timeout();
 	void hitarea_stuff_helper_2();
 	void fastFadeIn();

Modified: scummvm/trunk/engines/simon/vga.cpp
===================================================================
--- scummvm/trunk/engines/simon/vga.cpp	2006-04-07 22:47:06 UTC (rev 21674)
+++ scummvm/trunk/engines/simon/vga.cpp	2006-04-08 00:12:16 UTC (rev 21675)
@@ -608,7 +608,7 @@
 };
 
 /* simon2 specific */
-void SimonEngine::decodeStripA(byte *dst, const byte *src, int height) {
+void SimonEngine::decodeColumn(byte *dst, const byte *src, int height) {
 	const uint pitch = _dxSurfacePitch;
 	int8 reps = (int8)0x80;
 	byte color;
@@ -652,6 +652,50 @@
 	}
 }
 
+void SimonEngine::decodeRow(byte *dst, const byte *src, int width) {
+	const uint pitch = _dxSurfacePitch;
+	int8 reps = (int8)0x80;
+	byte color;
+	byte *dst_org = dst;
+	uint w = width, h = 8;
+
+	for (;;) {
+		reps = *src++;
+		if (reps >= 0) {
+			color = *src++;
+
+			do {
+				*dst++ = color;
+
+				/* reached right edge? */
+				if (--w == 0) {
+					/* reached bottom? */
+					if (--h == 0)
+						return;
+					dst_org += pitch;
+					dst = dst_org;
+					w = width;
+				}
+			} while (--reps >= 0);
+		} else {
+
+			do {
+				*dst++ = *src++;
+
+				/* reached right edge? */
+				if (--w == 0) {
+					/* reached bottom? */
+					if (--h == 0)
+						return;
+					dst_org += pitch;
+					dst = dst_org;
+					w = width;
+				}
+			} while (++reps != 0);
+		}
+	}
+}
+
 void SimonEngine::vc10_draw() {
 	byte *p2;
 	uint width, height;
@@ -1281,7 +1325,7 @@
 		src = state->depack_src + _scrollX * 4;
 
 	for (w = 0; w < _screenWidth; w += 8) {
-		decodeStripA(dst, src + readUint32Wrapper(src), state->height);
+		decodeColumn(dst, src + readUint32Wrapper(src), state->height);
 		dst += 8;
 		src += 4;
 	}
@@ -1309,8 +1353,8 @@
 	src = state->depack_src + _scrollY / 2;
 
 	for (h = 0; h < _screenHeight; h += 8) {
-		//decodeRow(dst, src + READ_LE_UINT32(src), state->width);
-		dst += 8;
+		decodeRow(dst, src + READ_LE_UINT32(src), state->width);
+		dst += 8 * state->width;
 		src += 4;
 	}
 }
@@ -1862,7 +1906,7 @@
 
 		y = vsp->y;
 		vsp->y = y1;
-		checkScrollY(y, y1);
+		checkScrollY(y1 - y, y1);
 
 		_variableArray[11] = readUint16Wrapper(p);
 		_variableArray[13] = pos;
@@ -2356,7 +2400,8 @@
 	vsp->y += getScale(vsp->y, y);
 	_variableArray[var] = vsp->y;
 
-	checkScrollY(y, vsp->y);
+	if (y != 0) 
+		checkScrollY(y, vsp->y);
 
 	vsp->flags = kDFScaled;
 }


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