mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-27 06:43:03 +00:00
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:
parent
0942905731
commit
c83c4192ea
2 changed files with 16 additions and 0 deletions
|
@ -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 );
|
||||||
|
|
|
@ -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 );
|
||||||
|
|
Loading…
Reference in a new issue