[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.166,2.167 script_v6he.cpp,2.63,2.64 script_v7he.cpp,2.15,2.16 sound.cpp,1.335,1.336 sound.h,1.65,1.66

Travis Howell kirben at users.sourceforge.net
Tue Jun 22 03:41:03 CEST 2004


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

Modified Files:
	intern.h script_v6he.cpp script_v7he.cpp sound.cpp sound.h 
Log Message:

Add FBEAR: Partial fix for the piano, patch #977249


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.166
retrieving revision 2.167
diff -u -d -r2.166 -r2.167
--- intern.h	20 Jun 2004 14:47:14 -0000	2.166
+++ intern.h	22 Jun 2004 10:39:46 -0000	2.167
@@ -596,7 +596,7 @@
 	void o6_readFile();
 	void o6_rename();
 	void o6_writeFile();
-	void o6_setVolume();
+	void o6_soundOps();
 	void o6_seekFilePos();
 	void o6_localizeArray();
 	void o6_redimArray();

Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.63
retrieving revision 2.64
diff -u -d -r2.63 -r2.64
--- script_v6he.cpp	20 Jun 2004 14:47:14 -0000	2.63
+++ script_v6he.cpp	22 Jun 2004 10:39:46 -0000	2.64
@@ -331,7 +331,7 @@
 		OPCODE(o6_deleteFile),
 		OPCODE(o6_rename),
 		/* E0 */
-		OPCODE(o6_setVolume),
+		OPCODE(o6_soundOps),
 		OPCODE(o6_unknownE1),
 		OPCODE(o6_localizeArray),
 		OPCODE(o6_pickVarRandom),
@@ -402,6 +402,9 @@
 
 void ScummEngine_v6he::o6_startSound() {
 	// Seems to range between 952 - 9000
+	// In Fatty Bear's Birthday Surprise the piano uses offsets 1 - 23 to
+	// indicate which note to play, but only when using the standard piano
+	// sound. See also o6_soundOps().
 	int offset = pop();
 	debug(2, "o6_startSound: offset %d", offset);
 	_sound->addSoundToQueue(pop());
@@ -1136,17 +1139,18 @@
 	}
 }
 
-void ScummEngine_v6he::o6_setVolume() {
+void ScummEngine_v6he::o6_soundOps() {
 	byte subOp = fetchScriptByte();
-	int soundVolumeMaster;
 	int volume = pop();
 	switch (subOp) {
 	case 0xde:
 		_mixer->setMusicVolume(volume);
 		break;
 	case 0xe0:
-		soundVolumeMaster = ConfMan.getInt("master_volume");
-		_mixer->setVolume(volume * soundVolumeMaster / 255);
+		// Fatty Bear's Birthday surprise uses this when playing the
+		// piano, but only when using one of the digitized instruments.
+		// See also o6_startSound().
+		_sound->setOverrideFreq(volume);
 		break;
 	}
 }

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -d -r2.15 -r2.16
--- script_v7he.cpp	6 Jun 2004 02:20:53 -0000	2.15
+++ script_v7he.cpp	22 Jun 2004 10:39:46 -0000	2.16
@@ -331,7 +331,7 @@
 		OPCODE(o6_deleteFile),
 		OPCODE(o6_rename),
 		/* E0 */
-		OPCODE(o6_setVolume),
+		OPCODE(o6_soundOps),
 		OPCODE(o6_unknownE1),
 		OPCODE(o6_localizeArray),
 		OPCODE(o6_pickVarRandom),

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.335
retrieving revision 1.336
diff -u -d -r1.335 -r1.336
--- sound.cpp	5 Jun 2004 12:02:36 -0000	1.335
+++ sound.cpp	22 Jun 2004 10:39:46 -0000	1.336
@@ -68,6 +68,7 @@
 	_mouthSyncMode(false),
 	_endOfMouthSync(false),
 	_curSoundPos(0),
+	_overrideFreq(0),
 	_currentCDSound(0),
 	_soundsPaused(false),
 	_sfxMode(0) {
@@ -140,6 +141,10 @@
 	_soundQuePos = 0;
 }
 
+void Sound::setOverrideFreq(int freq) {
+	_overrideFreq = freq;
+}
+
 void Sound::playSound(int soundID) {
 	byte *ptr;
 	char *sound;
@@ -182,7 +187,12 @@
 
 		size = READ_BE_UINT32(ptr+4) - 8;
 		// FIXME - what value here ?!? 11025 is just a guess based on strings in w32 bin, prev guess 8000
-		rate = 11025;
+		if (_overrideFreq) {
+			// Used by the piano in Fatty Bear's Birthday Surprise
+			rate = _overrideFreq;
+			_overrideFreq = 0;
+		} else
+			rate = 11025;
 
 		// Allocate a sound buffer, copy the data into it, and play
 		sound = (char *)malloc(size);

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- sound.h	16 Apr 2004 12:47:55 -0000	1.65
+++ sound.h	22 Jun 2004 10:39:46 -0000	1.66
@@ -70,6 +70,8 @@
 	uint16 _mouthSyncTimes[64];
 	uint _curSoundPos;
 
+	int _overrideFreq;
+
 	int _currentCDSound;
 public:
 	PlayingSoundHandle _talkChannelHandle;	// Handle of mixer channel actor is talking on
@@ -82,6 +84,7 @@
 	void addSoundToQueue(int sound);
 	void addSoundToQueue2(int sound);
 	void processSoundQues();
+	void setOverrideFreq(int freq);
 	void playSound(int sound);
 	void startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle *handle = NULL);
 	void stopTalkSound();





More information about the Scummvm-git-logs mailing list