[Scummvm-cvs-logs] SF.net SVN: scummvm:[51334] scummvm/trunk/engines/sci/graphics

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Mon Jul 26 23:25:08 CEST 2010


Revision: 51334
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51334&view=rev
Author:   m_kiewitz
Date:     2010-07-26 21:25:07 +0000 (Mon, 26 Jul 2010)

Log Message:
-----------
SCI: fixing scroll transitions for kq6 hires

fixes bug #3034587

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/transitions.cpp
    scummvm/trunk/engines/sci/graphics/transitions.h

Modified: scummvm/trunk/engines/sci/graphics/transitions.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/transitions.cpp	2010-07-26 20:59:50 UTC (rev 51333)
+++ scummvm/trunk/engines/sci/graphics/transitions.cpp	2010-07-26 21:25:07 UTC (rev 51334)
@@ -407,39 +407,39 @@
 	}
 }
 
+void GfxTransitions::scrollCopyOldToScreen(Common::Rect screenRect, int16 x, int16 y) {
+	byte *oldScreenPtr = _oldScreen;
+	int16 screenWidth = _screen->getDisplayWidth();
+	if (_screen->getUpscaledHires()) {
+		_screen->adjustToUpscaledCoordinates(screenRect.top, screenRect.left);
+		_screen->adjustToUpscaledCoordinates(screenRect.bottom, screenRect.right);
+		_screen->adjustToUpscaledCoordinates(y, x);
+	}
+	oldScreenPtr += screenRect.left + screenRect.top * screenWidth;
+	g_system->copyRectToScreen(oldScreenPtr, screenWidth, x, y, screenRect.width(), screenRect.height());
+}
+
 // Scroll old screen (up/down/left/right) and insert new screen that way - works
 // on _picRect area only.
 void GfxTransitions::scroll(int16 number) {
 	int16 screenWidth, screenHeight;
-	byte *oldScreenPtr;
 	int16 stepNr = 0;
 	Common::Rect oldMoveRect = _picRect;
+	Common::Rect oldScreenRect = _picRect;
 	Common::Rect newMoveRect = _picRect;
 	Common::Rect newScreenRect = _picRect;
 
 	_screen->copyFromScreen(_oldScreen);
 	screenWidth = _screen->getDisplayWidth(); screenHeight = _screen->getDisplayHeight();
 
-	oldScreenPtr = _oldScreen + _picRect.left + _picRect.top * screenWidth;
-	if (_screen->getUpscaledHires()) {
-		oldScreenPtr += _picRect.left + _picRect.top * screenWidth;
-	}
-
 	switch (number) {
 	case SCI_TRANSITIONS_SCROLL_LEFT:
 		newScreenRect.right = newScreenRect.left;
 		newMoveRect.left = newMoveRect.right;
 		while (oldMoveRect.left < oldMoveRect.right) {
-			oldScreenPtr++;
-			if (_screen->getUpscaledHires())
-				oldScreenPtr++;
-			oldMoveRect.right--;
-			if (oldMoveRect.right > oldMoveRect.left) {
-				if (!_screen->getUpscaledHires())
-					g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height());
-				else
-					g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left * 2, oldMoveRect.top * 2, oldMoveRect.width() * 2, oldMoveRect.height() * 2);
-			}
+			oldMoveRect.right--; oldScreenRect.left++;
+			if (oldMoveRect.right > oldMoveRect.left)
+				scrollCopyOldToScreen(oldScreenRect, oldMoveRect.left, oldMoveRect.top);
 			newScreenRect.right++; newMoveRect.left--;
 			_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
 			if ((stepNr & 1) == 0) {
@@ -458,13 +458,9 @@
 	case SCI_TRANSITIONS_SCROLL_RIGHT:
 		newScreenRect.left = newScreenRect.right;
 		while (oldMoveRect.left < oldMoveRect.right) {
-			oldMoveRect.left++;
-			if (oldMoveRect.right > oldMoveRect.left) {
-				if (!_screen->getUpscaledHires())
-					g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height());
-				else
-					g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left * 2, oldMoveRect.top * 2, oldMoveRect.width() * 2, oldMoveRect.height() * 2);
-			}
+			oldMoveRect.left++; oldScreenRect.right--;
+			if (oldMoveRect.right > oldMoveRect.left)
+				scrollCopyOldToScreen(oldScreenRect, oldMoveRect.left, oldMoveRect.top);
 			newScreenRect.left--;
 			_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
 			if ((stepNr & 1) == 0) {
@@ -484,16 +480,9 @@
 		newScreenRect.bottom = newScreenRect.top;
 		newMoveRect.top = newMoveRect.bottom;
 		while (oldMoveRect.top < oldMoveRect.bottom) {
-			oldScreenPtr += screenWidth;
-			if (_screen->getUpscaledHires())
-				oldScreenPtr += screenWidth;
-			oldMoveRect.top++;
-			if (oldMoveRect.top < oldMoveRect.bottom) {
-				if (!_screen->getUpscaledHires())
-					g_system->copyRectToScreen(oldScreenPtr, screenWidth, _picRect.left, _picRect.top, oldMoveRect.width(), oldMoveRect.height());
-				else
-					g_system->copyRectToScreen(oldScreenPtr, screenWidth, _picRect.left * 2, _picRect.top * 2, oldMoveRect.width() * 2, oldMoveRect.height() * 2);
-			}
+			oldMoveRect.top++; oldScreenRect.top++; 
+			if (oldMoveRect.top < oldMoveRect.bottom)
+				scrollCopyOldToScreen(oldScreenRect, _picRect.left, _picRect.top);
 			newScreenRect.bottom++;	newMoveRect.top--;
 			_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
 			updateScreenAndWait(3);
@@ -503,13 +492,9 @@
 	case SCI_TRANSITIONS_SCROLL_DOWN:
 		newScreenRect.top = newScreenRect.bottom;
 		while (oldMoveRect.top < oldMoveRect.bottom) {
-			oldMoveRect.top++;
-			if (oldMoveRect.top < oldMoveRect.bottom) {
-				if (!_screen->getUpscaledHires())
-					g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height());
-				else
-					g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left * 2, oldMoveRect.top * 2, oldMoveRect.width() * 2, oldMoveRect.height() * 2);
-			}
+			oldMoveRect.top++; oldScreenRect.bottom--;
+			if (oldMoveRect.top < oldMoveRect.bottom)
+				scrollCopyOldToScreen(oldScreenRect, oldMoveRect.left, oldMoveRect.top);
 			newScreenRect.top--;
 			_screen->copyRectToScreen(newScreenRect, _picRect.left, _picRect.top);
 			updateScreenAndWait(3);

Modified: scummvm/trunk/engines/sci/graphics/transitions.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/transitions.h	2010-07-26 20:59:50 UTC (rev 51333)
+++ scummvm/trunk/engines/sci/graphics/transitions.h	2010-07-26 21:25:07 UTC (rev 51334)
@@ -83,6 +83,7 @@
 	void pixelation(bool blackoutFlag);
 	void blocks(bool blackoutFlag);
 	void straight(int16 number, bool blackoutFlag);
+	void scrollCopyOldToScreen(Common::Rect screenRect, int16 x, int16 y);
 	void scroll(int16 number);
 	void verticalRollFromCenter(bool blackoutFlag);
 	void verticalRollToCenter(bool blackoutFlag);


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