[Scummvm-cvs-logs] CVS: scummvm script_v2.cpp,1.50,1.51 scumm.h,1.134,1.135 sound.cpp,1.52,1.53

James Brown ender at users.sourceforge.net
Mon Apr 22 01:33:07 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv29051

Modified Files:
	script_v2.cpp scumm.h sound.cpp 
Log Message:
Add voice channel tracking to stop script race in BumpusVille VR.



Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** script_v2.cpp	21 Apr 2002 21:33:47 -0000	1.50
--- script_v2.cpp	22 Apr 2002 08:16:10 -0000	1.51
***************
*** 1653,1656 ****
--- 1653,1657 ----
  	if (snd)
  		snd = isSoundRunning(snd);
+ 	
  	push(snd);
  }
***************
*** 2329,2332 ****
--- 2330,2335 ----
  		}
  	case 169:
+ 		//printf("waiting for message: %d\n", _vars[VAR_HAVE_MSG]);
+ 		
  		if (_vars[VAR_HAVE_MSG])
  			break;
***************
*** 2343,2346 ****
--- 2346,2350 ----
  		return;
  	case 171:
+ 		printf("wait for sentence");
  		if (_sentenceNum) {
  			if (sentence[_sentenceNum - 1].unk &&

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.134
retrieving revision 1.135
diff -C2 -d -r1.134 -r1.135
*** scumm.h	21 Apr 2002 21:58:21 -0000	1.134
--- scumm.h	22 Apr 2002 08:16:10 -0000	1.135
***************
*** 1003,1010 ****
  	void talkSound(uint32 a, uint32 b, int mode);
  	void processSfxQueues();
! 	void startTalkSound(uint32 a, uint32 b, int mode);
  	void stopTalkSound();
  	bool isMouthSyncOff(uint pos);
! 	void startSfxSound(void *file, int size);
  	void *openSfxFile();
  	void addSoundToQueue(int sound);
--- 1003,1010 ----
  	void talkSound(uint32 a, uint32 b, int mode);
  	void processSfxQueues();
! 	int startTalkSound(uint32 a, uint32 b, int mode);
  	void stopTalkSound();
  	bool isMouthSyncOff(uint pos);
! 	int startSfxSound(void *file, int size);
  	void *openSfxFile();
  	void addSoundToQueue(int sound);
***************
*** 1017,1024 ****
  	bool isSfxFinished();
  	void playBundleSound(char *sound);
! 	void playSfxSound(void *sound, uint32 size, uint rate);
   	void playSfxSound_MP3(void *sound, uint32 size);
  	void stopSfxSound();
  
  	bool _useTalkAnims;
  	uint16 _defaultTalkDelay;
--- 1017,1025 ----
  	bool isSfxFinished();
  	void playBundleSound(char *sound);
! 	int playSfxSound(void *sound, uint32 size, uint rate);
   	void playSfxSound_MP3(void *sound, uint32 size);
  	void stopSfxSound();
  
+ 	int _talkChannel;	/* Mixer channel actor is talking on */
  	bool _useTalkAnims;
  	uint16 _defaultTalkDelay;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** sound.cpp	21 Apr 2002 21:58:18 -0000	1.52
--- sound.cpp	22 Apr 2002 08:16:13 -0000	1.53
***************
*** 129,139 ****
  
  	if (_talk_sound_mode != 0) {
! 		startTalkSound(_talk_sound_a, _talk_sound_b, _talk_sound_mode);
  		_talk_sound_mode = 0;
  	}
  
! 	if (_sfxMode == 2) {
  		act = _vars[VAR_TALK_ACTOR];
! 		finished = isSfxFinished();
  
  		if (act != 0 && (uint) act < 0x80 && !string[0].no_talk_anim) {
--- 129,148 ----
  
  	if (_talk_sound_mode != 0) {
! 		if (_talk_sound_mode == 2)
! 			_talkChannel = startTalkSound(_talk_sound_a, _talk_sound_b, _talk_sound_mode);
! 		else
! 			startTalkSound(_talk_sound_a, _talk_sound_b, _talk_sound_mode);
  		_talk_sound_mode = 0;
  	}
  
! 	if (_vars[VAR_TALK_ACTOR]) { //_sfxMode == 2) {
  		act = _vars[VAR_TALK_ACTOR];
! 		if (_talkChannel < 0)
! 			finished = false;
! 		else if (this->_mixer->_channels[_talkChannel] == NULL)
! 			finished = true;
! 		else
! 			finished = false;
! 		
  
  		if (act != 0 && (uint) act < 0x80 && !string[0].no_talk_anim) {
***************
*** 149,157 ****
  			}
  		}
! 		if (finished && _talkDelay == 0) {
  			stopTalk();
  			_sfxMode = 0;
  		}
! 	} else if (_sfxMode == 1) {
  		if (isSfxFinished()) {
  			_sfxMode = 0;
--- 158,170 ----
  			}
  		}
! 		
! 		if (finished  && _talkDelay == 0) {
  			stopTalk();
  			_sfxMode = 0;
+ 			_talkChannel = -1;
  		}
! 	}
! 		
! 	if (_sfxMode == 1) {
  		if (isSfxFinished()) {
  			_sfxMode = 0;
***************
*** 168,172 ****
  #endif
  
! void Scumm::startTalkSound(uint32 offset, uint32 b, int mode)
  {
  	int num = 0, i;
--- 181,185 ----
  #endif
  
! int Scumm::startTalkSound(uint32 offset, uint32 b, int mode)
  {
  	int num = 0, i;
***************
*** 176,180 ****
  	if (!_sfxFile) {
  		warning("startTalkSound: SFX file is not open");
! 		return;
  	}
  
--- 189,193 ----
  	if (!_sfxFile) {
  		warning("startTalkSound: SFX file is not open");
! 		return -1;
  	}
  
***************
*** 221,225 ****
  	_mouthSyncMode = true;
  
! 	startSfxSound(_sfxFile, size);
  }
  
--- 234,238 ----
  	_mouthSyncMode = true;
  
! 	return startSfxSound(_sfxFile, size);
  }
  
***************
*** 410,414 ****
  };
  
! void Scumm::startSfxSound(void *file, int file_size)
  {
  	char ident[8];
--- 423,427 ----
  };
  
! int Scumm::startSfxSound(void *file, int file_size)
  {
  	char ident[8];
***************
*** 442,446 ****
  	invalid:;
  		warning("startSfxSound: invalid header");
! 		return;
  	}
  
--- 455,459 ----
  	invalid:;
  		warning("startSfxSound: invalid header");
! 		return -1;
  	}
  
***************
*** 448,452 ****
  	if (block_type != 1) {
  		warning("startSfxSound: Expecting block_type == 1, got %d", block_type);
! 		return;
  	}
  
--- 461,465 ----
  	if (block_type != 1) {
  		warning("startSfxSound: Expecting block_type == 1, got %d", block_type);
! 		return -1;
  	}
  
***************
*** 459,463 ****
  	if (comp != 0) {
  		warning("startSfxSound: Unsupported compression type %d", comp);
! 		return;
  	}
  
--- 472,476 ----
  	if (comp != 0) {
  		warning("startSfxSound: Unsupported compression type %d", comp);
! 		return -1;
  	}
  
***************
*** 465,469 ****
  	if (data == NULL) {
  		error("startSfxSound: out of memory");
! 		return;
  	}
  
--- 478,482 ----
  	if (data == NULL) {
  		error("startSfxSound: out of memory");
! 		return -1;
  	}
  
***************
*** 471,475 ****
  		/* no need to free the memory since error will shut down */
  		error("startSfxSound: cannot read %d bytes", size);
! 		return;
  	}
  	for (i = 0; i < size; i++) {
--- 484,488 ----
  		/* no need to free the memory since error will shut down */
  		error("startSfxSound: cannot read %d bytes", size);
! 		return -1;
  	}
  	for (i = 0; i < size; i++) {
***************
*** 480,484 ****
  		data[i] ^= 0x80;
  	}
! 	playSfxSound(data, size, 1000000 / (256 - rate));
  }
  
--- 493,497 ----
  		data[i] ^= 0x80;
  	}
! 	return playSfxSound(data, size, 1000000 / (256 - rate));
  }
  
***************
*** 585,593 ****
  }
  
! void Scumm::playSfxSound(void *sound, uint32 size, uint rate)
  {
  	if (_soundsPaused)
! 		return;
! 	_mixer->play_raw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE);
  }
  
--- 598,606 ----
  }
  
! int Scumm::playSfxSound(void *sound, uint32 size, uint rate)
  {
  	if (_soundsPaused)
! 		return -1;
! 	return _mixer->play_raw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE);
  }
  





More information about the Scummvm-git-logs mailing list