[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.159,1.160 actor.h,1.35,1.36 script_v8.cpp,2.190,2.191 sound.cpp,1.218,1.219

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Wed Sep 3 10:02:02 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv17423

Modified Files:
	actor.cpp actor.h script_v8.cpp sound.cpp 
Log Message:
Implement the ACTOR_PAN opcode. The only place I know of where it's used is
between between ship-to-ship combats, so I didn't bother yet to store it in
savegames.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- actor.cpp	29 Aug 2003 04:05:22 -0000	1.159
+++ actor.cpp	3 Sep 2003 17:00:30 -0000	1.160
@@ -101,6 +101,7 @@
 	ignoreTurns = false;
 	
 	talkFrequency = 256;
+	talkPan = 64;
 	
 	if (_vm->_version <= 2) {
 		initFrame = 2;

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- actor.h	27 Jul 2003 23:45:43 -0000	1.35
+++ actor.h	3 Sep 2003 17:00:33 -0000	1.36
@@ -90,6 +90,7 @@
 	byte room;
 	byte talkColor;
 	int talkFrequency;
+	byte talkPan;
 	byte scalex, scaley;
 	byte charset;
 	byte moving;

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.190
retrieving revision 2.191
diff -u -d -r2.190 -r2.191
--- script_v8.cpp	14 Aug 2003 17:17:11 -0000	2.190
+++ script_v8.cpp	3 Sep 2003 17:00:33 -0000	2.191
@@ -1070,9 +1070,18 @@
 		a->talkFrequency = pop();
 		break;
 	case 0x89:		// SO_ACTOR_PAN
-		// TODO - implement this!
-		i = pop();
-		warning("o8_actorOps: setActorPan(%d) not implemented", i);
+		// FIXME: This should be stored in savegames.
+		// 0 = left, 64 = middle, 127 = right.
+		a->talkPan = pop();
+
+		// If the actor is talking at the moment, adjust the panning
+		// on the current talk channel handle. (If the handle is 0,
+		// setChannelPan() won't do anything.)
+
+		if (_actorToPrintStrFor == a->number)
+			_mixer->setChannelPan(_sound->_talkChannelHandle,
+				(a->talkPan != 64) ? 2 * a->talkPan - 127 : 0);
+
 		break;
 	default:
 		error("o8_actorOps: default case 0x%x", subOp);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -d -r1.218 -r1.219
--- sound.cpp	2 Sep 2003 07:49:39 -0000	1.218
+++ sound.cpp	3 Sep 2003 17:00:33 -0000	1.219
@@ -1290,7 +1290,7 @@
 	if (!result)
 		return;
 
-	int32 rate = 22050, channels, output_size = 0;
+	int32 rate = 22050, pan = 0, channels, output_size = 0;
 	int32 tag, size = -1, bits = 0;
 
 	if (_scumm->_gameId == GID_CMI) {
@@ -1356,6 +1356,10 @@
 	if (_scumm->_actorToPrintStrFor != 0xFF && _scumm->_actorToPrintStrFor != 0) {
 		Actor *a = _scumm->derefActor(_scumm->_actorToPrintStrFor, "playBundleSound");
 		rate = (rate * a->talkFrequency) / 256;
+
+		// Adjust to fit the mixer's notion of panning.
+		if (pan != 64)
+			pan = 2 * a->talkPan - 127;
 	}
 	
 	// Stop any sound currently playing on the given handle
@@ -1363,12 +1367,12 @@
 		_scumm->_mixer->stopHandle(*handle);
 
 	if (bits == 8) {
-		_scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 127, 0);
+		_scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 127, pan);
 	} else if (bits == 16) {
 		// FIXME: For some weird reasons, sometimes we get an odd size, even though
 		// the data is supposed to be in 16 bit format... that makes no sense...
 		size &= ~1;
-		_scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, 127, 0);
+		_scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, 127, pan);
 	} else {
 		warning("Sound::playBundleSound() to do more options to playRaw...");
 	}





More information about the Scummvm-git-logs mailing list