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.

96 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Send generic impact messages to the client for visualization
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #include "cbase.h"
  14. #include "basetempentity.h"
  15. // memdbgon must be the last include file in a .cpp file!!!
  16. #include "tier0/memdbgon.h"
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Dispatches Gunshot decal tempentity
  19. //-----------------------------------------------------------------------------
  20. class CTEImpact : public CBaseTempEntity
  21. {
  22. public:
  23. DECLARE_CLASS( CTEImpact, CBaseTempEntity );
  24. DECLARE_SERVERCLASS();
  25. CTEImpact( const char *name );
  26. virtual ~CTEImpact();
  27. void Precache( void );
  28. void Test( const Vector& current_origin, const Vector& current_normal );
  29. public:
  30. CNetworkVector( m_vecOrigin );
  31. CNetworkVector( m_vecNormal ); //NOTENOTE: In a multi-play setup we'll probably want non-oriented effects for bandwidth
  32. CNetworkVar( int, m_iType );
  33. };
  34. //-----------------------------------------------------------------------------
  35. // Purpose:
  36. // Input : *name -
  37. // Output :
  38. //-----------------------------------------------------------------------------
  39. CTEImpact::CTEImpact( const char *name ) : CBaseTempEntity( name )
  40. {
  41. m_vecOrigin.Init();
  42. m_vecNormal.Init();
  43. }
  44. //-----------------------------------------------------------------------------
  45. // Purpose:
  46. //-----------------------------------------------------------------------------
  47. CTEImpact::~CTEImpact( void )
  48. {
  49. }
  50. //-----------------------------------------------------------------------------
  51. // Purpose:
  52. //-----------------------------------------------------------------------------
  53. void CTEImpact::Precache( void )
  54. {
  55. }
  56. //-----------------------------------------------------------------------------
  57. // Purpose:
  58. // Input : *current_origin -
  59. // *current_angles -
  60. //-----------------------------------------------------------------------------
  61. void CTEImpact::Test( const Vector& current_origin, const Vector& current_normal )
  62. {
  63. }
  64. //Server class implementation
  65. IMPLEMENT_SERVERCLASS_ST( CTEImpact, DT_TEImpact)
  66. SendPropVector( SENDINFO( m_vecOrigin ), -1, SPROP_COORD ),
  67. SendPropVector( SENDINFO( m_vecNormal ), -1, SPROP_COORD ),
  68. SendPropInt( SENDINFO( m_iType ), 32, SPROP_UNSIGNED ),
  69. END_SEND_TABLE()
  70. // Singleton to fire TEImpact objects
  71. static CTEImpact g_TEImpact( "Impact" );
  72. //-----------------------------------------------------------------------------
  73. // Purpose:
  74. // Input : msg_dest -
  75. // delay -
  76. // *origin -
  77. // *recipient -
  78. //-----------------------------------------------------------------------------
  79. void TE_Impact( IRecipientFilter& filter, float delay )
  80. {
  81. g_TEImpact.Create( filter, delay );
  82. }