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.

69 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef FX_IMPACT_H
  7. #define FX_IMPACT_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "c_te_effect_dispatch.h"
  12. #include "istudiorender.h"
  13. // Parse the impact data from the server's data block
  14. C_BaseEntity *ParseImpactData( const CEffectData &data, Vector *vecOrigin, Vector *vecStart, Vector *vecShotDir, short &nSurfaceProp, int &iMaterial, int &iDamageType, int &iHitbox );
  15. // Get the decal name to use based on an impact with the specified entity, surface material, and damage type
  16. char const *GetImpactDecal( C_BaseEntity *pEntity, int iMaterial, int iDamageType );
  17. // Basic decal handling
  18. // Returns true if it hit something
  19. enum
  20. {
  21. IMPACT_NODECAL = 0x1,
  22. IMPACT_REPORT_RAGDOLL_IMPACTS = 0x2,
  23. };
  24. bool Impact( Vector &vecOrigin, Vector &vecStart, int iMaterial, int iDamageType, int iHitbox, C_BaseEntity *pEntity, trace_t &tr, int nFlags = 0, int maxLODToDecal = ADDDECAL_TO_ALL_LODS );
  25. // Flags for PerformCustomEffects
  26. enum
  27. {
  28. FLAGS_CUSTIOM_EFFECTS_NOFLECKS = 0x1,
  29. };
  30. // Do spiffy things according to the material hit
  31. void PerformCustomEffects( const Vector &vecOrigin, trace_t &tr, const Vector &shotDir, int iMaterial, int iScale, int nFlags = 0 );
  32. // Play the correct impact sound according to the material hit
  33. void PlayImpactSound( C_BaseEntity *pServerEntity, trace_t &tr, Vector &vecServerOrigin, int nServerSurfaceProp );
  34. // This can be used to hook impact sounds and play them at a later time.
  35. // Shotguns do this so it doesn't play 10 identical sounds in the same spot.
  36. typedef void (*ImpactSoundRouteFn)( const char *pSoundName, const Vector &vEndPos );
  37. void SetImpactSoundRoute( ImpactSoundRouteFn fn );
  38. //-----------------------------------------------------------------------------
  39. // Purpose: Enumerator class for ragdolls being affected by bullet forces
  40. //-----------------------------------------------------------------------------
  41. class CRagdollEnumerator : public IPartitionEnumerator
  42. {
  43. public:
  44. // Forced constructor
  45. CRagdollEnumerator( Ray_t& shot, int iDamageType );
  46. // Actual work code
  47. virtual IterationRetval_t EnumElement( IHandleEntity *pHandleEntity );
  48. bool Hit( void ) const { return m_bHit; }
  49. private:
  50. Ray_t m_rayShot;
  51. int m_iDamageType;
  52. bool m_bHit;
  53. };
  54. #endif // FX_IMPACT_H