diff --git a/mp/src/game/client/sdk/c_te_firebullets.cpp b/mp/src/game/client/sdk/c_te_firebullets.cpp index 846be238c..30c43ffa2 100644 --- a/mp/src/game/client/sdk/c_te_firebullets.cpp +++ b/mp/src/game/client/sdk/c_te_firebullets.cpp @@ -43,7 +43,9 @@ void C_TEFireBullets::PostDataUpdate( DataUpdateType_t updateType ) m_iWeaponID, m_iMode, m_iSeed, - m_flSpread ); + m_flSpread, + false + ); } diff --git a/mp/src/game/shared/sdk/sdk_fx_shared.cpp b/mp/src/game/shared/sdk/sdk_fx_shared.cpp index 9c34e3f29..e269e39f9 100644 --- a/mp/src/game/shared/sdk/sdk_fx_shared.cpp +++ b/mp/src/game/shared/sdk/sdk_fx_shared.cpp @@ -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 @@ -116,7 +130,8 @@ void FX_FireBullets( int iWeaponID, int iMode, int iSeed, - float flSpread + float flSpread, + bool bShouldPlaySound ) { Assert(vOrigin.IsValid()); @@ -157,8 +172,6 @@ void FX_FireBullets( iSeed, flSpread ); - - bDoEffects = false; // no effects on server #endif iSeed++; @@ -176,7 +189,8 @@ void FX_FireBullets( //ProjectedLightEffectManager( iPlayerIndex ).TriggerMuzzleFlash(); #endif - FX_WeaponSound( iPlayerIndex, sound_type, vOrigin, pWeaponInfo ); + if (bShouldPlaySound) + FX_WeaponSound(iPlayerIndex, sound_type, vOrigin, pWeaponInfo); } diff --git a/mp/src/game/shared/sdk/sdk_fx_shared.h b/mp/src/game/shared/sdk/sdk_fx_shared.h index 243790993..8499fdb35 100644 --- a/mp/src/game/shared/sdk/sdk_fx_shared.h +++ b/mp/src/game/shared/sdk/sdk_fx_shared.h @@ -20,7 +20,8 @@ void FX_FireBullets( int iWeaponID, int iMode, int iSeed, - float flSpread + float flSpread, + bool bShouldPlaySound ); diff --git a/mp/src/game/shared/sdk/weapon_sdkbase.cpp b/mp/src/game/shared/sdk/weapon_sdkbase.cpp index 4ce5e0c42..49cb0337e 100644 --- a/mp/src/game/shared/sdk/weapon_sdkbase.cpp +++ b/mp/src/game/shared/sdk/weapon_sdkbase.cpp @@ -326,7 +326,8 @@ void CWeaponSDKBase::FinishAttack (CSDKPlayer *pPlayer) GetWeaponID(), 0, //Tony; fire mode - this is unused at the moment, left over from CSS when SDK* was created in the first place. CBaseEntity::GetPredictionRandomSeed() & 255, - flSpread + flSpread, + true ); //Add our view kick in