Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Game-specific impact effect hooks
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "fx_impact.h"
  8. //-----------------------------------------------------------------------------
  9. // Purpose: Handle weapon impacts
  10. //-----------------------------------------------------------------------------
  11. void ImpactCallback( const CEffectData &data )
  12. {
  13. trace_t tr;
  14. Vector vecOrigin, vecStart, vecShotDir;
  15. int iMaterial, iDamageType, iHitbox;
  16. short nSurfaceProp;
  17. C_BaseEntity *pEntity = ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox );
  18. if ( !pEntity )
  19. return;
  20. // If we hit, perform our custom effects and play the sound
  21. if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr ) )
  22. {
  23. // Check for custom effects based on the Decal index
  24. PerformCustomEffects( vecOrigin, tr, vecShotDir, iMaterial, 1.0 );
  25. }
  26. PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp );
  27. }
  28. DECLARE_CLIENT_EFFECT( "Impact", ImpactCallback );