Skip to content

Commit

Permalink
Weapon sounds now work on dedicated servers
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Ashton <[email protected]>
  • Loading branch information
voxelizedworld and misyltoad committed Feb 12, 2021
1 parent 55dbd80 commit 37fbba2
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions mp/src/game/shared/sdk/sdk_fx_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,21 @@
void FX_WeaponSound ( int iPlayerIndex,
WeaponSound_t sound_type,
const Vector &vOrigin,
CSDKWeaponInfo *pWeaponInfo ) {};
CSDKWeaponInfo *pWeaponInfo )
{
// make sure we got something
if (iPlayerIndex == -1)
return;

// If we have some sounds from the weapon classname.txt file, play a random one of them
const char *shootsound = pWeaponInfo->aShootSounds[sound_type];
if (!shootsound || !shootsound[0])
return;

CBroadcastRecipientFilter filter;
filter.RemoveRecipient(UTIL_PlayerByIndex(iPlayerIndex));
CBaseEntity::EmitSound(filter, iPlayerIndex, shootsound, &vOrigin);
}

#endif

Expand Down Expand Up @@ -168,17 +182,16 @@ void FX_FireBullets(

WeaponSound_t sound_type = SINGLE;

#ifdef CLIENT_DLL
if ( bDoEffects)
{
#ifdef CLIENT_DLL
if (pPlayer)
pPlayer->m_flMuzzleFlashYaw = random->RandomFloat(0, 360);
//ProjectedLightEffectManager( iPlayerIndex ).TriggerMuzzleFlash();
#endif

FX_WeaponSound( iPlayerIndex, sound_type, vOrigin, pWeaponInfo );
}
#endif

FX_WeaponSound(iPlayerIndex, sound_type, vOrigin, pWeaponInfo);

// Fire bullets, calculate impacts & effects

Expand Down

0 comments on commit 37fbba2

Please sign in to comment.