[Scummvm-cvs-logs] CVS: scummvm/sword1 screen.cpp,1.56,1.57

Robert Göffringmann lavosspawn at users.sourceforge.net
Fri Nov 4 07:42:25 CET 2005


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24052/sword1

Modified Files:
	screen.cpp 
Log Message:
fixed bug #1345130: BS1: Scrolling regression.

Could possibly cause other problems, needs testing.
Testing, also in respect to #1077394

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- screen.cpp	18 Oct 2005 01:30:24 -0000	1.56
+++ screen.cpp	4 Nov 2005 15:40:54 -0000	1.57
@@ -76,12 +76,6 @@
 }
 
 void Screen::setScrolling(int16 offsetX, int16 offsetY) {
-	if (!Logic::_scriptVars[SCROLL_FLAG]) {
-		Logic::_scriptVars[SCROLL_OFFSET_X] = _oldScrollX = 0;
-		Logic::_scriptVars[SCROLL_OFFSET_Y] = _oldScrollY = 0;
-		return ; // screen is smaller than 640x400 => no need for scrolling
-	}
-
 	offsetX = inRange(0, offsetX, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
 	offsetY = inRange(0, offsetY, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
 
@@ -106,6 +100,17 @@
 			_fullRefresh = true;
 		Logic::_scriptVars[SCROLL_OFFSET_X] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_X] + scrlDistX, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
 		Logic::_scriptVars[SCROLL_OFFSET_Y] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_Y] + scrlDistY, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
+	} else {
+		// SCROLL_FLAG == 0, this usually means that the screen is smaller than 640x400 and doesn't need scrolling at all
+		// however, it can also mean that the gamescript overwrote the scrolling flag to take care of scrolling directly,
+		// (see bug report #1345130) so we ignore the offset arguments in this case
+		Logic::_scriptVars[SCROLL_OFFSET_X] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_X], Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
+		Logic::_scriptVars[SCROLL_OFFSET_Y] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_Y], Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
+		if ((Logic::_scriptVars[SCROLL_OFFSET_X] != _oldScrollX) || (Logic::_scriptVars[SCROLL_OFFSET_Y] != _oldScrollY)) {
+			_fullRefresh = true;
+			_oldScrollX = Logic::_scriptVars[SCROLL_OFFSET_X];
+			_oldScrollY = Logic::_scriptVars[SCROLL_OFFSET_Y];
+		}
 	}
 }
 
@@ -151,7 +156,7 @@
 }
 
 bool Screen::showScrollFrame(void) {
-	if ((!_fullRefresh) || Logic::_scriptVars[NEW_PALETTE] || (!Logic::_scriptVars[SCROLL_FLAG]))
+	if ((!_fullRefresh) || Logic::_scriptVars[NEW_PALETTE])
 		return false; // don't draw an additional frame if we aren't scrolling or have to change the palette
 	if ((_oldScrollX == Logic::_scriptVars[SCROLL_OFFSET_X]) &&
 		(_oldScrollY == Logic::_scriptVars[SCROLL_OFFSET_Y]))
@@ -290,9 +295,10 @@
 		Logic::_scriptVars[SCROLL_FLAG] = 0;
 		Logic::_scriptVars[MAX_SCROLL_OFFSET_X] = 0;
 		Logic::_scriptVars[MAX_SCROLL_OFFSET_Y] = 0;
-		Logic::_scriptVars[SCROLL_OFFSET_X] = 0;
-		Logic::_scriptVars[SCROLL_OFFSET_Y] = 0;
 	}
+	Logic::_scriptVars[SCROLL_OFFSET_X] = 0;
+	Logic::_scriptVars[SCROLL_OFFSET_Y] = 0;
+
 	if (_screenBuf)
 		free(_screenBuf);
 	if (_screenGrid)





More information about the Scummvm-git-logs mailing list