[Scummvm-cvs-logs] CVS: scummvm/scumm imuse_digi.cpp,1.85,1.86 script_v8.cpp,2.208,2.209 sound.cpp,1.298,1.299 sound.h,1.59,1.60 string.cpp,1.173,1.174

Max Horn fingolfin at users.sourceforge.net
Fri Dec 26 05:14:02 CET 2003


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

Modified Files:
	imuse_digi.cpp script_v8.cpp sound.cpp sound.h string.cpp 
Log Message:
when introducing a constant used throughout multiple files, best assign a *name* to it, else you're digging your own grave on the long run :-)

Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- imuse_digi.cpp	26 Dec 2003 12:15:22 -0000	1.85
+++ imuse_digi.cpp	26 Dec 2003 13:13:56 -0000	1.86
@@ -773,11 +773,12 @@
 	for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 		if (!_channel[l].used && !_channel[l].handle.isActive()) {
 			byte *ptr, *s_ptr;
-			if ((sound == 10000) && (_voiceBundleData)) {
+			if ((sound == kTalkSoundID) && (_voiceBundleData)) {
 				s_ptr = ptr = _voiceBundleData;
-			} else if ((sound == 10000) && (_voiceVocData)) {
+			} else if ((sound == kTalkSoundID) && (_voiceVocData)) {
 				//
-			} else if (sound != 10000) {
+				s_ptr = ptr = 0;
+			} else if (sound != kTalkSoundID) {
 				ptr = _scumm->getResourceAddress(rtSound, sound);
 				s_ptr = ptr;
 				if (ptr == NULL) {
@@ -805,7 +806,7 @@
 			int32 size = 0;
 			int t;
 
-			if ((sound == 10000) && (_voiceVocData)) {
+			if ((sound == kTalkSoundID) && (_voiceVocData)) {
 				_channel[l].mixerSize = _voiceVocRate * 2;
 				_channel[l].size = _voiceVocSize * 2;
 				_channel[l].bits = 8;
@@ -897,7 +898,7 @@
 						break;
 				}
 
-				if ((sound == 10000) && (_voiceBundleData)) {
+				if ((sound == kTalkSoundID) && (_voiceBundleData)) {
 					if (_scumm->_actorToPrintStrFor != 0xFF && _scumm->_actorToPrintStrFor != 0) {
 						Actor *a = _scumm->derefActor(_scumm->_actorToPrintStrFor, "playBundleSound");
 						_channel[l].freq = (_channel[l].freq * a->talkFrequency) / 256;
@@ -1429,7 +1430,7 @@
 }
 
 void IMuseDigital::playBundleSound(const char *sound) {
-	byte *ptr = 0, *orig_ptr = 0;
+	byte *ptr = 0;
 	bool result;
 
 	if (!_scumm->_mixer->isReady())
@@ -1469,9 +1470,9 @@
 	}
 
 	if (ptr) {
-		stopSound(10000);
+		stopSound(kTalkSoundID);
 		setBundleVoice(ptr);
-		startSound(10000);
+		startSound(kTalkSoundID);
 		free(ptr);
 	}
 }

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.208
retrieving revision 2.209
diff -u -d -r2.208 -r2.209
--- script_v8.cpp	26 Dec 2003 12:15:23 -0000	2.208
+++ script_v8.cpp	26 Dec 2003 13:13:56 -0000	2.209
@@ -1079,8 +1079,8 @@
 		// setChannelPan() won't do anything.)
 
 		if (_actorToPrintStrFor == a->number) {
-			if (_sound->isSoundRunning(10000))
-				_imuseDigital->parseScriptCmds(12, 0x700, 10000, a->talkPan, 0, 0, 0, 0);
+			if (_sound->isSoundRunning(kTalkSoundID))
+				_imuseDigital->parseScriptCmds(12, 0x700, kTalkSoundID, a->talkPan, 0, 0, 0, 0);
 		}
 
 		break;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.298
retrieving revision 1.299
diff -u -d -r1.298 -r1.299
--- sound.cpp	26 Dec 2003 12:15:23 -0000	1.298
+++ sound.cpp	26 Dec 2003 13:13:56 -0000	1.299
@@ -407,7 +407,7 @@
 		act = _scumm->VAR(_scumm->VAR_TALK_ACTOR);
 
 		if (_scumm->_imuseDigital) {
-			finished = !isSoundRunning(10000);
+			finished = !isSoundRunning(kTalkSoundID);
 		} else {
 			finished = !_talkChannelHandle.isActive();
 		}
@@ -565,7 +565,7 @@
 void Sound::stopTalkSound() {
 	if (_sfxMode & 2) {
 		if (_scumm->_imuseDigital) {
-			_scumm->_imuseDigital->stopSound(10000);
+			_scumm->_imuseDigital->stopSound(kTalkSoundID);
 		} else {
 			_scumm->_mixer->stopHandle(_talkChannelHandle);
 		}
@@ -822,7 +822,7 @@
 
 	if (_scumm->_imuseDigital) {
 		_scumm->_imuseDigital->setVocVoice(data, size, rate);
-		_scumm->_imuseDigital->startSound(10000);
+		_scumm->_imuseDigital->startSound(kTalkSoundID);
 		free(data);
 	} else {
 		_scumm->_mixer->playRaw(handle, data, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, id);

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- sound.h	25 Dec 2003 15:09:23 -0000	1.59
+++ sound.h	26 Dec 2003 13:13:56 -0000	1.60
@@ -32,6 +32,10 @@
 
 struct MP3OffsetTable;
 
+enum {
+	kTalkSoundID = 10000
+};
+
 class Sound {
 protected:
 	int16 _soundQuePos, _soundQue[0x100];

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -d -r1.173 -r1.174
--- string.cpp	26 Dec 2003 12:15:23 -0000	1.173
+++ string.cpp	26 Dec 2003 13:13:56 -0000	1.174
@@ -164,9 +164,9 @@
 		return;
 
 	if ((_gameId == GID_CMI || _gameId == GID_DIG) && (_imuseDigital)
-				&& _sound->isSoundRunning(10000)) {
+				&& _sound->isSoundRunning(kTalkSoundID)) {
 		// Keep the 'speech' flag in _sound->_sfxMode set as long as the
-		// sound 10000 is playing.
+		// sound kTalkSoundID is playing.
 		_sound->_sfxMode |= 2;
 	}
 





More information about the Scummvm-git-logs mailing list