[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.298,2.299 scumm.cpp,1.168,1.169 scumm.h,1.469,1.470

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun Sep 5 08:46:52 CEST 2004


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

Modified Files:
	gfx.cpp scumm.cpp scumm.h 
Log Message:
Fixed scrollEffect() regression introduced when move_screen() was removed.
I have tested this on all the cases I know of where scrollEffect() is used:

* The diving scene in Monkey Island 2
* The camel and balloon rides in Fate of Atlantis
* The arrival of the thunder storm in Day of the Tentacle
* Seeing the loose end in Sam & Max

So far it seems to work fine. Knock on wood.


Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.298
retrieving revision 2.299
diff -u -d -r2.298 -r2.299
--- gfx.cpp	5 Sep 2004 10:10:29 -0000	2.298
+++ gfx.cpp	5 Sep 2004 15:44:29 -0000	2.299
@@ -2768,6 +2768,12 @@
 }
 
 void ScummEngine::scrollEffect(int dir) {
+	// It is at least technically possible that this function will be
+	// called without _scrollBuffer having been set up, but will it ever
+	// happen? I don't know.
+	if (!_scrollBuffer)
+		warning("scrollEffect: No scroll buffer. This may look bad");
+
 	VirtScreen *vs = &virtscr[0];
 
 	int x, y;
@@ -2789,6 +2795,11 @@
 				vs->pitch,
 				0, vs->h - y,
 				vs->w, y);
+			if (_scrollBuffer)
+				_system->copyRectToScreen(_scrollBuffer + y * vs->w,
+					vs->w,
+					0, 0,
+					vs->w, vs->h - y);
 			_system->updateScreen();
 			waitForTimer(kPictureDelay);
 
@@ -2803,6 +2814,11 @@
 				vs->pitch,
 				0, 0,
 				vs->w, y);
+			if (_scrollBuffer)
+				_system->copyRectToScreen(_scrollBuffer,
+					vs->w,
+					0, y,
+					vs->w, vs->h - y);
 			_system->updateScreen();
 			waitForTimer(kPictureDelay);
 
@@ -2817,6 +2833,11 @@
 				vs->pitch,
 				vs->w - x, 0,
 				x, vs->h);
+			if (_scrollBuffer)
+				_system->copyRectToScreen(_scrollBuffer + x,
+					vs->w,
+					0, 0,
+					vs->w - x, vs->h);
 			_system->updateScreen();
 			waitForTimer(kPictureDelay);
 
@@ -2831,6 +2852,11 @@
 				vs->pitch,
 				0, 0,
 				x, vs->h);
+			if (_scrollBuffer)
+				_system->copyRectToScreen(_scrollBuffer,
+					vs->w,
+					x, 0,
+					vs->w - x, vs->h);
 			_system->updateScreen();
 			waitForTimer(kPictureDelay);
 
@@ -2838,6 +2864,9 @@
 		}
 		break;
 	}
+
+	free(_scrollBuffer);
+	_scrollBuffer = NULL;
 }
 
 void ScummEngine::unkScreenEffect6() {

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- scumm.cpp	5 Sep 2004 09:36:51 -0000	1.168
+++ scumm.cpp	5 Sep 2004 15:44:29 -0000	1.169
@@ -598,6 +598,7 @@
 	_newEffect = 0;
 	_switchRoomEffect2 = 0;
 	_switchRoomEffect = 0;
+	_scrollBuffer = NULL;
 	_doEffect = false;
 	memset(&_flashlight, 0, sizeof(_flashlight));
 	_roomStrips = 0;
@@ -2260,6 +2261,26 @@
 		VAR(VAR_NEW_ROOM) = room; // gamevars, eg Zak cashcards
 
 	runExitScript();
+
+	if (_switchRoomEffect >= 130 && _switchRoomEffect <= 133) {
+		// We're going to use scrollEffect(), so we'll need a copy of
+		// the current VirtScreen zero.
+
+		VirtScreen *vs = &virtscr[0];
+
+		free(_scrollBuffer);
+		_scrollBuffer = (byte *) malloc(vs->h * vs->w);
+
+		byte *src = vs->getPixels(0, 0);
+		byte *dst = _scrollBuffer;
+
+		for (int y = 0; y < vs->h; y++) {
+			memcpy(dst, src, vs->w);
+			src += vs->w;
+			dst += vs->pitch;
+		}
+	}
+
 	killScriptsAndResources();
 	clearEnqueue();
 	if (_version >= 4 && _heversion <= 60)

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.469
retrieving revision 1.470
diff -u -d -r1.469 -r1.470
--- scumm.h	5 Sep 2004 09:36:51 -0000	1.469
+++ scumm.h	5 Sep 2004 15:44:29 -0000	1.470
@@ -890,6 +890,8 @@
 
 	byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
 	bool _doEffect;
+
+	byte *_scrollBuffer;
 	
 	struct {
 		int x, y, w, h;





More information about the Scummvm-git-logs mailing list