[Scummvm-cvs-logs] CVS: scummvm/bs2/driver d_draw.cpp,1.31,1.32 d_sound.cpp,1.66,1.67 d_sound.h,1.23,1.24 sprite.cpp,1.24,1.25

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Thu Oct 2 00:02:15 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv4199/driver

Modified Files:
	d_draw.cpp d_sound.cpp d_sound.h sprite.cpp 
Log Message:
Cleanups, mostly related to sound effects.


Index: d_draw.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/d_draw.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- d_draw.cpp	30 Sep 2003 16:07:04 -0000	1.31
+++ d_draw.cpp	2 Oct 2003 07:01:12 -0000	1.32
@@ -322,5 +322,12 @@
 		BS2_SetPalette(0, 256, oldPal, RDPAL_INSTANT);
 	}
 
+	// Lead-in and lead-out music are, as far as I can tell, only used for
+	// the animated cut-scenes, so this seems like a good place to close
+	// both of them.
+
+	g_sound->closeFx(-1);
+	g_sound->closeFx(-2);
+
 	return RD_OK;
 }

Index: d_sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/d_sound.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- d_sound.cpp	1 Oct 2003 06:36:25 -0000	1.66
+++ d_sound.cpp	2 Oct 2003 07:01:12 -0000	1.67
@@ -50,7 +50,7 @@
 #define GetCompressedSign(n)       (((n) >> 3) & 1)
 #define GetCompressedAmplitude(n)  ((n) & 7)
 
-int32 panTable[33] = {
+static int32 panTable[33] = {
 	-127, -119, -111, -103,  -95,  -87,  -79,  -71,
 	 -63,  -55,  -47,  -39,  -31,  -23,  -15,   -7,
 	   0,
@@ -58,7 +58,7 @@
           71,   79,   87,   95,  103,  111,  119,  127
 };
 
-int32 musicVolTable[17] = {
+static int32 musicVolTable[17] = {
 	  0,  15,  31,  47,  63,  79,  95, 111, 127,
 	143, 159, 175, 191, 207, 223, 239, 255
 };
@@ -249,8 +249,6 @@
 		ServiceWindows();
 		g_system->delay_msecs(30);
 	}
-
-	closeFx(-2);
 }
 
 // --------------------------------------------------------------------------
@@ -271,12 +269,6 @@
 	return getFxIndex(id) == MAXFX;
 }
 
-// --------------------------------------------------------------------------
-// This function checks the status of all current sound effects, and clears
-// out the ones which are no longer required in a buffer.  It is called by
-// a separate thread.
-// --------------------------------------------------------------------------
-
 void Sword2Sound::fxServer(int16 *data, uint len) {
 	StackLock lock(_mutex);
 
@@ -287,48 +279,6 @@
 
 	if (!_music[0]._streaming && !_music[1]._streaming && fpMus.isOpen())
 		fpMus.close();
-
-	// FIXME: Doing this sort of things from a separate thread seems like
-	// just asking for trouble. But removing it outright causes regressions
-	// which need to be investigated.
-	//
-	// I've fixed one such regression, and as far as I can tell it's
-	// working now.
-
-#if 0
-	int i;
-
-	if (_fxPaused) {
-		for (i = 0; i < MAXFX; i++) {
-			if ((_fx[i]._id == -1) || (_fx[i]._id == -2)) {
-				if (!_fx[i]._handle) {
-					_fx[i]._id = 0;
-					if (_fx[i]._buf != NULL) {
-						free(_fx[i]._buf);
-						_fx[i]._buf = NULL;
-					}
-					_fx[i]._bufSize = 0;
-					_fx[i]._flags = 0;
-				}
-			}
-		}
-		return;
-	}
-
-	for (i = 0; i < MAXFX; i++) {
-		if (_fx[i]._id) {
-			if (!_fx[i]._handle) {
-				_fx[i]._id = 0;
-				if (_fx[i]._buf != NULL) {
-					free(_fx[i]._buf);
-					_fx[i]._buf = NULL;
-				}
-				_fx[i]._bufSize = 0;
-				_fx[i]._flags = 0;
-			}
-		}
-	}
-#endif
 }
 
 /**
@@ -610,17 +560,10 @@
 
 		if (fxi == MAXFX) {
 			// Expire the first sound effect that isn't currently
-			// playing.
-
-			// FIXME. This may need a bit of work. I still haven't
-			// grasped all the intricacies of the sound effects
-			// handling.
-			//
-			// Anyway, it'd be nicer - in theory - to expire the
-			// least recently used slot.
-			//
-			// This used to be done by the "garbage collector" in
-			// fxServer().
+			// playing. This usually shouldn't happen since the
+			// game engine manually clears all sound effects (at
+			// least except for lead-ins and lead-outs) when moving
+			// between rooms.
 
 			for (fxi = 0; fxi < MAXFX; fxi++) {
 				if (!_fx[fxi]._handle)

Index: d_sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/d_sound.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- d_sound.h	1 Oct 2003 06:36:25 -0000	1.23
+++ d_sound.h	2 Oct 2003 07:01:12 -0000	1.24
@@ -73,9 +73,6 @@
 	FxHandle _fx[MAXFX];
 	MusicHandle _music[MAXMUS + 1];
 
-	// We used to have two music volumes - one for each channel -
-	// but they were always set to the same value.
-
 	uint8 _musicVol;
 
 	uint8 _soundOn;

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/sprite.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- sprite.cpp	29 Sep 2003 14:06:02 -0000	1.24
+++ sprite.cpp	2 Oct 2003 07:01:12 -0000	1.25
@@ -615,6 +615,8 @@
 					dst += screenWide;
 				}
 			} else if (s->blend & 0x02) {
+				debug(2, "DrawSprite: s->blend & 0x02");
+
 				// FIXME: This case looks bogus to me. The
 				// same value for the red, green and blue
 				// parameters, and we multiply with the source
@@ -622,8 +624,7 @@
 				// component.
 				//
 				// But as far as I can see, that's how the
-				// original
-				// code did it.
+				// original code did it.
 				//
 				// Does anyone know where this case was used
 				// anyway?





More information about the Scummvm-git-logs mailing list