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.

106 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #include "cbase.h"
  14. #include "te_particlesystem.h"
  15. // memdbgon must be the last include file in a .cpp file!!!
  16. #include "tier0/memdbgon.h"
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Dispatches line
  19. //-----------------------------------------------------------------------------
  20. class CTEShowLine : public CTEParticleSystem
  21. {
  22. public:
  23. DECLARE_CLASS( CTEShowLine, CTEParticleSystem );
  24. DECLARE_SERVERCLASS();
  25. CTEShowLine( const char *name );
  26. virtual ~CTEShowLine( void );
  27. virtual void Test( const Vector& current_origin, const QAngle& current_angles );
  28. public:
  29. CNetworkVector( m_vecEnd );
  30. };
  31. //-----------------------------------------------------------------------------
  32. // Purpose:
  33. // Input : *name -
  34. //-----------------------------------------------------------------------------
  35. CTEShowLine::CTEShowLine( const char *name ) :
  36. BaseClass( name )
  37. {
  38. m_vecEnd.Init();
  39. }
  40. //-----------------------------------------------------------------------------
  41. // Purpose:
  42. //-----------------------------------------------------------------------------
  43. CTEShowLine::~CTEShowLine( void )
  44. {
  45. }
  46. //-----------------------------------------------------------------------------
  47. // Purpose:
  48. // Input : *current_origin -
  49. // *current_angles -
  50. //-----------------------------------------------------------------------------
  51. void CTEShowLine::Test( const Vector& current_origin, const QAngle& current_angles )
  52. {
  53. // Fill in data
  54. m_vecOrigin = current_origin;
  55. Vector forward, right;
  56. m_vecOrigin.GetForModify()[2] += 24;
  57. AngleVectors( current_angles, &forward, &right, NULL );
  58. forward[2] = 0.0;
  59. VectorNormalize( forward );
  60. VectorMA( m_vecOrigin, 100.0, forward, m_vecEnd.GetForModify() );
  61. m_vecOrigin = m_vecEnd + right * -128;
  62. m_vecEnd += right * 128;
  63. CBroadcastRecipientFilter filter;
  64. Create( filter, 0.0 );
  65. }
  66. IMPLEMENT_SERVERCLASS_ST( CTEShowLine, DT_TEShowLine)
  67. SendPropVector( SENDINFO(m_vecEnd), -1, SPROP_COORD),
  68. END_SEND_TABLE()
  69. // Singleton to fire TEShowLine objects
  70. static CTEShowLine g_TEShowLine( "Show Line" );
  71. //-----------------------------------------------------------------------------
  72. // Purpose:
  73. // Input : msg_dest -
  74. // delay -
  75. // *origin -
  76. // *recipient -
  77. // *start -
  78. // *end -
  79. //-----------------------------------------------------------------------------
  80. void TE_ShowLine( IRecipientFilter& filter, float delay,
  81. const Vector* start, const Vector* end )
  82. {
  83. g_TEShowLine.m_vecOrigin = *start;
  84. g_TEShowLine.m_vecEnd = *end;
  85. // Send it over the wire
  86. g_TEShowLine.Create( filter, delay );
  87. }