[Scummvm-cvs-logs] CVS: scummvm/sword1 screen.cpp,1.17,1.18

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sun Dec 21 09:46:01 CET 2003


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv10647/sword1

Modified Files:
	screen.cpp 
Log Message:
fixed scrolling

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- screen.cpp	21 Dec 2003 17:34:44 -0000	1.17
+++ screen.cpp	21 Dec 2003 17:45:15 -0000	1.18
@@ -57,29 +57,23 @@
 	if (!SwordLogic::_scriptVars[SCROLL_FLAG])
 		return ; // screen is smaller than 640x400 => no need for scrolling
 
-	uint32 scrlToX, scrlToY;
-
 	offsetX = inRange(0, offsetX, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X]);
 	offsetY = inRange(0, offsetY, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
-	_oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X];
-	_oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y];
-	scrlToX = (uint32)offsetX;
-	scrlToY = (uint32)offsetY;
 
-	if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) // first time on this screen - need absolute scroll immediately!
+	if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) { // first time on this screen - need absolute scroll immediately!
+		_oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X] = (uint32)offsetX;
+		_oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y] = (uint32)offsetY;
 		SwordLogic::_scriptVars[SCROLL_FLAG] = 1;
-	scrlToX = inRange(0, scrlToX, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X]);
-	scrlToY = inRange(0, scrlToY, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
-	if ((scrlToX != SwordLogic::_scriptVars[SCROLL_OFFSET_X]) || (scrlToY != SwordLogic::_scriptVars[SCROLL_OFFSET_Y])) {
 		_fullRefresh = true;
-		SwordLogic::_scriptVars[SCROLL_OFFSET_X] = scrlToX;
-		SwordLogic::_scriptVars[SCROLL_OFFSET_Y] = scrlToY;
-	} else
-		_fullRefresh = false;
-	if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) {
-		_oldScrollX = scrlToX;
-		_oldScrollY = scrlToY;
-		SwordLogic::_scriptVars[SCROLL_FLAG] = 1;
+	} else if (SwordLogic::_scriptVars[SCROLL_FLAG] == 1) {
+		_oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X];
+		_oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y];
+		int32 distX = inRange(-MAX_SCROLL_DISTANCE, _oldScrollX - offsetX, MAX_SCROLL_DISTANCE);
+		int32 distY = inRange(-MAX_SCROLL_DISTANCE, _oldScrollY - offsetY, MAX_SCROLL_DISTANCE);
+		if ((distX != 0) || (distY != 0))
+			_fullRefresh = true;
+		SwordLogic::_scriptVars[SCROLL_OFFSET_X] -= distX;
+		SwordLogic::_scriptVars[SCROLL_OFFSET_Y] -= distY;
 	}
 }
 





More information about the Scummvm-git-logs mailing list