mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-09 19:41:36 +00:00
Fix client-side entities playing some sounds incorrectly
This commit is contained in:
parent
aea94b32cb
commit
324be193c9
1 changed files with 20 additions and 2 deletions
|
@ -1138,7 +1138,16 @@ void CBaseEntity::EmitSound( const char *soundname, float soundtime /*= 0.0f*/,
|
|||
params.m_pflSoundDuration = duration;
|
||||
params.m_bWarnOnDirectWaveReference = true;
|
||||
|
||||
EmitSound( filter, entindex(), params );
|
||||
int iEntIndex = entindex();
|
||||
#if defined( CLIENT_DLL )
|
||||
if ( iEntIndex == -1 )
|
||||
{
|
||||
// If we're a clientside entity, we need to use the soundsourceindex instead of the entindex
|
||||
iEntIndex = GetSoundSourceIndex();
|
||||
}
|
||||
#endif
|
||||
|
||||
EmitSound( filter, iEntIndex, params );
|
||||
}
|
||||
|
||||
#if !defined ( CLIENT_DLL )
|
||||
|
@ -1177,7 +1186,16 @@ void CBaseEntity::EmitSound( const char *soundname, HSOUNDSCRIPTHANDLE& handle,
|
|||
params.m_pflSoundDuration = duration;
|
||||
params.m_bWarnOnDirectWaveReference = true;
|
||||
|
||||
EmitSound( filter, entindex(), params, handle );
|
||||
int iEntIndex = entindex();
|
||||
#if defined( CLIENT_DLL )
|
||||
if ( iEntIndex == -1 )
|
||||
{
|
||||
// If we're a clientside entity, we need to use the soundsourceindex instead of the entindex
|
||||
iEntIndex = GetSoundSourceIndex();
|
||||
}
|
||||
#endif
|
||||
|
||||
EmitSound( filter, iEntIndex, params, handle );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue