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.

63 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Create a muzzle flash temp ent
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "basetempentity.h"
  9. #include "coordsize.h"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. class CTETFBlood : public CBaseTempEntity
  13. {
  14. public:
  15. DECLARE_CLASS( CTETFBlood, CBaseTempEntity );
  16. DECLARE_SERVERCLASS();
  17. CTETFBlood( const char *name );
  18. virtual void Test( const Vector& current_origin, const QAngle& current_angles ) {}
  19. public:
  20. Vector m_vecOrigin;
  21. Vector m_vecNormal;
  22. int m_nEntIndex;
  23. };
  24. // Singleton to fire TEMuzzleFlash objects
  25. static CTETFBlood g_TETFBlood( "TFBlood" );
  26. //-----------------------------------------------------------------------------
  27. // Purpose:
  28. // Input : *name -
  29. //-----------------------------------------------------------------------------
  30. CTETFBlood::CTETFBlood( const char *name ) :
  31. CBaseTempEntity( name )
  32. {
  33. m_vecOrigin.Init();
  34. m_vecNormal.Init();
  35. m_nEntIndex = 0;
  36. }
  37. IMPLEMENT_SERVERCLASS_ST( CTETFBlood, DT_TETFBlood )
  38. SendPropFloat( SENDINFO_NOCHECK( m_vecOrigin[0] ), -1, SPROP_COORD_MP_INTEGRAL ),
  39. SendPropFloat( SENDINFO_NOCHECK( m_vecOrigin[1] ), -1, SPROP_COORD_MP_INTEGRAL ),
  40. SendPropFloat( SENDINFO_NOCHECK( m_vecOrigin[2] ), -1, SPROP_COORD_MP_INTEGRAL ),
  41. SendPropVector( SENDINFO_NOCHECK( m_vecNormal ), 6, 0, -1.0f, 1.0f ),
  42. SendPropInt( SENDINFO_NAME( m_nEntIndex, entindex ), MAX_EDICT_BITS, SPROP_UNSIGNED ),
  43. END_SEND_TABLE()
  44. void TE_TFBlood( IRecipientFilter& filter, float delay,
  45. const Vector &origin, const Vector &normal, int nEntIndex )
  46. {
  47. g_TETFBlood.m_vecOrigin = origin;
  48. g_TETFBlood.m_vecNormal = normal;
  49. g_TETFBlood.m_nEntIndex = nEntIndex;
  50. // Send it over the wire
  51. g_TETFBlood.Create( filter, delay );
  52. }