Skip to content

Commit

Permalink
Merge pull request #289 from fortressforever/fixes/weapon-local-sounds
Browse files Browse the repository at this point in the history
Fix local weapon sounds (like deploy sounds) playing twice on high ping
  • Loading branch information
squeek502 committed Jul 3, 2016
2 parents 815ab2b + f1a27ea commit cf60dba
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions game_shared/ff/ff_weapon_base.cpp
Expand Up @@ -179,6 +179,7 @@ void CFFWeaponBase::WeaponSound(WeaponSound_t sound_type, float soundtime /* = 0
//----------------------------------------------------------------------------
void CFFWeaponBase::WeaponSoundLocal( WeaponSound_t sound_type, float soundtime )
{
#ifdef CLIENT_DLL
// If we have some sounds from the weapon classname.txt file, play a random one of them
const char *shootsound = GetWpnData().aShootSounds[ sound_type ];
if( !shootsound || !shootsound[0] )
Expand All @@ -191,8 +192,7 @@ void CFFWeaponBase::WeaponSoundLocal( WeaponSound_t sound_type, float soundtime

CSingleUserRecipientFilter filter( GetPlayerOwner() );

#ifdef CLIENT_DLL
if( GetPlayerOwner() == C_FFPlayer::GetLocalFFPlayer() )
if( GetPlayerOwner() == C_FFPlayer::GetLocalFFPlayerOrObserverTarget() )
{
// Not sure why we're checking tempents... but we did it above^^
if( !te->CanPredict() )
Expand All @@ -203,9 +203,7 @@ void CFFWeaponBase::WeaponSoundLocal( WeaponSound_t sound_type, float soundtime

EmitSound( filter, GetPlayerOwner()->entindex(), shootsound, NULL, soundtime );
}
#else
EmitSound( filter, GetPlayerOwner()->entindex(), shootsound, NULL, soundtime );
#endif
#endif
}

//----------------------------------------------------------------------------
Expand Down

1 comment on commit cf60dba

@DexterHaslem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

Please sign in to comment.