[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.207,1.208 intern.h,2.326,2.327 script_v100he.cpp,2.36,2.37 script_v72he.cpp,2.198,2.199 script_v80he.cpp,2.71,2.72 script_v90he.cpp,2.120,2.121 sound.cpp,1.417,1.418 sound.h,1.80,1.81

kirben kirben at users.sourceforge.net
Sun Jan 30 03:07:57 CET 2005


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

Modified Files:
	akos.cpp intern.h script_v100he.cpp script_v72he.cpp 
	script_v80he.cpp script_v90he.cpp sound.cpp sound.h 
Log Message:

Check sound queue for music in HE games.
Avoid extra sound channel.


Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -d -r1.207 -r1.208
--- akos.cpp	24 Jan 2005 10:59:44 -0000	1.207
+++ akos.cpp	30 Jan 2005 11:03:46 -0000	1.208
@@ -211,7 +211,6 @@
 							while (size--) {
 								if (READ_LE_UINT32(akst) == 0) {
 									a->cost.seq3[i] = READ_LE_UINT32(akst + 4);
-									akst += 8;
 									found = true;
 									break;
 								}
@@ -243,7 +242,6 @@
 								if (READ_LE_UINT16(aksf) == start) {
 									a->cost.seq1[i] = READ_LE_UINT16(aksf + 2);
 									a->cost.seq2[i] = READ_LE_UINT16(aksf + 4);
-									aksf += 6;
 									found = true;
 									break;
 								}
@@ -268,7 +266,6 @@
 							while (size--) {
 								if (READ_LE_UINT32(akst) == start) {
 									a->cost.seq3[i] = READ_LE_UINT32(akst + 4);
-									akst += 8;
 									found = true;
 									break;
 								}

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.326
retrieving revision 2.327
diff -u -d -r2.326 -r2.327
--- intern.h	30 Jan 2005 05:34:03 -0000	2.326
+++ intern.h	30 Jan 2005 11:03:47 -0000	2.327
@@ -759,7 +759,7 @@
 	void o72_captureWizImage();
 	void o72_getTimer();
 	void o72_setTimer();
-	void o72_unknown5A();
+	void o72_getSoundElapsedTimeOfSound();
 	void o72_startScript();
 	void o72_startObject();
 	void o72_drawObject();

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.36
retrieving revision 2.37
diff -u -d -r2.36 -r2.37
--- script_v100he.cpp	30 Jan 2005 07:00:50 -0000	2.36
+++ script_v100he.cpp	30 Jan 2005 11:03:47 -0000	2.37
@@ -311,7 +311,7 @@
 		OPCODE(o6_isScriptRunning),
 		OPCODE(o90_sin),
 		/* D8 */
-		OPCODE(o72_unknown5A),
+		OPCODE(o72_getSoundElapsedTimeOfSound),
 		OPCODE(o6_isSoundRunning),
 		OPCODE(o80_getSoundVar),
 		OPCODE(o100_unknown25),

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.198
retrieving revision 2.199
diff -u -d -r2.198 -r2.199
--- script_v72he.cpp	29 Jan 2005 17:57:57 -0000	2.198
+++ script_v72he.cpp	30 Jan 2005 11:03:47 -0000	2.199
@@ -155,7 +155,7 @@
 		/* 58 */
 		OPCODE(o72_getTimer),
 		OPCODE(o72_setTimer),
-		OPCODE(o72_unknown5A),
+		OPCODE(o72_getSoundElapsedTimeOfSound),
 		OPCODE(o6_wordArrayDec),
 		/* 5C */
 		OPCODE(o6_if),
@@ -714,13 +714,10 @@
 	}
 }
 
-void ScummEngine_v72he::o72_unknown5A() {
-	// Seems to get length of sound already played
+void ScummEngine_v72he::o72_getSoundElapsedTimeOfSound() {
 	int snd = pop();
-	int r = _mixer->getSoundElapsedTime(_sound->_musicChannelHandle);
-
-	push(r * 10);
-	debug(1,"o72_unknown5A stub (%d)", snd);
+	push(_mixer->getSoundElapsedTimeOfSoundID(snd) * 10);
+	debug(1,"o72_getSoundElapsedTimeOfSound (%d)", snd);
 }
 
 void ScummEngine_v72he::o72_startScript() {

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.71
retrieving revision 2.72
diff -u -d -r2.71 -r2.72
--- script_v80he.cpp	30 Jan 2005 05:00:20 -0000	2.71
+++ script_v80he.cpp	30 Jan 2005 11:03:47 -0000	2.72
@@ -153,7 +153,7 @@
 		/* 58 */
 		OPCODE(o72_getTimer),
 		OPCODE(o72_setTimer),
-		OPCODE(o72_unknown5A),
+		OPCODE(o72_getSoundElapsedTimeOfSound),
 		OPCODE(o6_wordArrayDec),
 		/* 5C */
 		OPCODE(o6_if),

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.120
retrieving revision 2.121
diff -u -d -r2.120 -r2.121
--- script_v90he.cpp	30 Jan 2005 07:00:50 -0000	2.120
+++ script_v90he.cpp	30 Jan 2005 11:03:48 -0000	2.121
@@ -153,7 +153,7 @@
 		/* 58 */
 		OPCODE(o72_getTimer),
 		OPCODE(o72_setTimer),
-		OPCODE(o72_unknown5A),
+		OPCODE(o72_getSoundElapsedTimeOfSound),
 		OPCODE(o6_wordArrayDec),
 		/* 5C */
 		OPCODE(o6_if),

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.417
retrieving revision 1.418
diff -u -d -r1.417 -r1.418
--- sound.cpp	30 Jan 2005 09:11:38 -0000	1.417
+++ sound.cpp	30 Jan 2005 11:03:48 -0000	1.418
@@ -164,7 +164,6 @@
 	int size = -1;
 	int rate;
 	byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
-	bool music = false;
 	
 	if (_vm->_heversion >= 70 && soundID > _vm->_numSounds) {
 		debug(0, "playSound #%d", soundID);
@@ -199,16 +198,15 @@
 		if (skip > tracks - 1)
 			skip = 0;
 
-		musicFile.seek(+28, SEEK_CUR);
-		if (musicFile.readUint32LE() == TO_LE_32(MKID('SGEN'))) {
+		if (_vm->_heversion >= 80) {
+			// Skip to offsets
+			musicFile.seek(+40, SEEK_CUR);
+
 			// Skip to correct music header
 			skip *= 21;
-
-			// Skip to offsets
-			musicFile.seek(+8, SEEK_CUR);
 		} else {
-			// Rewind
-			musicFile.seek(-28, SEEK_CUR);
+			// Skip to offsets
+			musicFile.seek(+4, SEEK_CUR);
 
 			// Skip to correct music header
 			skip *= 25;
@@ -229,12 +227,10 @@
 		musicFile.read(ptr, size);
 		musicFile.close();
 
+		_vm->_mixer->stopID(_currentMusic);
 		_currentMusic = soundID;
-		music = true;
 		if (_vm->_heversion == 70) {
-			// Allocate a sound buffer, copy the data into it, and play
-			_vm->_mixer->stopHandle(_musicChannelHandle);
-			_vm->_mixer->playRaw(&_musicChannelHandle, ptr, size, 11025, flags, soundID);
+			_vm->_mixer->playRaw(NULL, ptr, size, 11025, flags, soundID);
 			return;
 		}
 	} else {
@@ -299,18 +295,12 @@
 		}
 
 		// TODO: Set sound channel based on heChannel
-		if (heFlags & 1)
-			flags |= SoundMixer::FLAG_LOOP;
+		//       Set sound looping based on heFlags
 
 		// Allocate a sound buffer, copy the data into it, and play
 		sound = (char *)malloc(size);
 		memcpy(sound, ptr + heOffset + 8, size);
-
-		if (music == true) {
-			_vm->_mixer->stopHandle(_musicChannelHandle);
-			_vm->_mixer->playRaw(&_musicChannelHandle, sound, size, rate, flags, soundID);
-		} else
-			_vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
+		_vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
 	}
 	else if (READ_UINT32(ptr) == MKID('MRAW')) {
 		// pcm music in 3DO humongous games
@@ -325,9 +315,9 @@
 		// Allocate a sound buffer, copy the data into it, and play
 		sound = (char *)malloc(size);
 		memcpy(sound, ptr + 8, size);
+		_vm->_mixer->stopID(_currentMusic);
 		_currentMusic = soundID;
-		_vm->_mixer->stopHandle(_musicChannelHandle);
-		_vm->_mixer->playRaw(&_musicChannelHandle, sound, size, rate, flags, soundID);
+		_vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
 	}	
 	// Support for sampled sound effects in Monkey Island 1 and 2
 	else if (READ_UINT32(ptr) == MKID('SBL ')) {
@@ -673,7 +663,7 @@
 			_sfxFile->seek(offset + 32, SEEK_SET);
 
 			if (_sfxFile->readUint32LE() == TO_LE_32(MKID('SBNG'))) {
-				warning("startTalkSound: Skipped SBNG block");
+				debug(2, "startTalkSound: Skipped SBNG block");
 				// Skip the SBNG, so we end up at the SDAT chunk
 				extra = _sfxFile->readUint32BE();
 				_sfxFile->seek(extra - 4, SEEK_CUR);
@@ -821,8 +811,8 @@
 			// getSoundStatus(), with a -1, will return the
 			// ID number of the first active music it finds.
 			if (_vm->_heversion >= 70 || _currentMusic)
-				return (_musicChannelHandle.isActive());
-			else if (_vm->_imuse)
+				sound = _currentMusic;
+			if (_vm->_imuse)
 				return (_vm->_imuse->getSoundStatus(sound));
 		}
 	}

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- sound.h	24 Jan 2005 10:07:17 -0000	1.80
+++ sound.h	30 Jan 2005 11:03:49 -0000	1.81
@@ -85,7 +85,6 @@
 	int16 _currentMusic;
 public:
 	PlayingSoundHandle _talkChannelHandle;	// Handle of mixer channel actor is talking on
-	PlayingSoundHandle _musicChannelHandle;	// Handle of mixer channel music is on
 
 	bool _soundsPaused;
 	byte _sfxMode;





More information about the Scummvm-git-logs mailing list