StartSoundShader() event: special-case for soundName "", refs #494

Some level scripts in d3xp (erebus4, erebus4, phobos2) use
  $entity.startSoundShader( "", SND_CHANNEL_BODY );
(or whatever channel) to stop the sound currently playing there.
With s_playDefaultSound 1 that results in a beep..
Added a special case to that event implementation to call StopSound()
instead when the soundName is "" (or NULL)
This commit is contained in:
Daniel Gibson 2022-10-31 03:16:16 +01:00
parent 0942905731
commit c83c4192ea
2 changed files with 16 additions and 0 deletions

View file

@ -4171,6 +4171,14 @@ idEntity::Event_StartSoundShader
================ ================
*/ */
void idEntity::Event_StartSoundShader( const char *soundName, int channel ) { void idEntity::Event_StartSoundShader( const char *soundName, int channel ) {
// DG: at least some map scripts in d3xp seem to use $ent.startSoundShader( "", SND_CHANNEL_whatever );
// to stop a playing sound. special-casing this to avoid playing beep sound (if s_playDefaultSound 1)
if ( soundName == NULL || soundName[0] == '\0' ) {
StopSound( (s_channelType)channel, false );
idThread::ReturnFloat( 0.0f );
return;
}
int length; int length;
StartSoundShader( declManager->FindSound( soundName ), (s_channelType)channel, 0, false, &length ); StartSoundShader( declManager->FindSound( soundName ), (s_channelType)channel, 0, false, &length );

View file

@ -4062,6 +4062,14 @@ idEntity::Event_StartSoundShader
================ ================
*/ */
void idEntity::Event_StartSoundShader( const char *soundName, int channel ) { void idEntity::Event_StartSoundShader( const char *soundName, int channel ) {
// DG: at least some map scripts in d3xp seem to use $ent.startSoundShader( "", SND_CHANNEL_whatever );
// to stop a playing sound. special-casing this to avoid playing beep sound (if s_playDefaultSound 1)
if ( soundName == NULL || soundName[0] == '\0' ) {
StopSound( (s_channelType)channel, false );
idThread::ReturnFloat( 0.0f );
return;
}
int length; int length;
StartSoundShader( declManager->FindSound( soundName ), (s_channelType)channel, 0, false, &length ); StartSoundShader( declManager->FindSound( soundName ), (s_channelType)channel, 0, false, &length );