Counter Strike : Global Offensive Source Code
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.

83 lines
2.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "cbase.h"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. // -------------------------------------------------------------------------------- //
  12. // An entity used to test traceline
  13. // -------------------------------------------------------------------------------- //
  14. class CTestTraceline : public CPointEntity
  15. {
  16. public:
  17. DECLARE_CLASS( CTestTraceline, CPointEntity );
  18. void Spawn( void );
  19. int UpdateTransmitState();
  20. DECLARE_SERVERCLASS();
  21. DECLARE_DATADESC();
  22. private:
  23. void Spin( void );
  24. };
  25. // This table encodes the CBaseEntity data.
  26. IMPLEMENT_SERVERCLASS_ST_NOBASE(CTestTraceline, DT_TestTraceline)
  27. SendPropInt (SENDINFO(m_clrRender), 32, SPROP_UNSIGNED, SendProxy_Color32ToInt32 ),
  28. SendPropVector (SENDINFO(m_vecOrigin), 19, 0, MIN_COORD_INTEGER, MAX_COORD_INTEGER),
  29. SendPropFloat (SENDINFO_VECTORELEM(m_angRotation, 0), 19, 0, MIN_COORD_INTEGER, MAX_COORD_INTEGER),
  30. SendPropFloat (SENDINFO_VECTORELEM(m_angRotation, 1), 19, 0, MIN_COORD_INTEGER, MAX_COORD_INTEGER),
  31. SendPropFloat (SENDINFO_VECTORELEM(m_angRotation, 2), 19, 0, MIN_COORD_INTEGER, MAX_COORD_INTEGER),
  32. SendPropEHandle (SENDINFO_NAME(m_hMoveParent, moveparent)),
  33. END_SEND_TABLE()
  34. LINK_ENTITY_TO_CLASS( test_traceline, CTestTraceline );
  35. BEGIN_DATADESC( CTestTraceline )
  36. // Function Pointers
  37. DEFINE_FUNCTION( Spin ),
  38. END_DATADESC()
  39. void CTestTraceline::Spawn( void )
  40. {
  41. SetRenderColor( 255, 255, 255 );
  42. SetRenderAlpha( 255 );
  43. SetNextThink( gpGlobals->curtime );
  44. SetThink( &CTestTraceline::Spin );
  45. }
  46. void CTestTraceline::Spin( void )
  47. {
  48. static ConVar traceline_spin( "traceline_spin","1" );
  49. if (traceline_spin.GetInt())
  50. {
  51. float s = sin( gpGlobals->curtime );
  52. QAngle angles = GetLocalAngles();
  53. angles[0] = 180.0 * 0.5 * (s * s * s + 1.0f) + 90;
  54. angles[1] = gpGlobals->curtime * 10;
  55. SetLocalAngles( angles );
  56. }
  57. SetNextThink( gpGlobals->curtime );
  58. }
  59. int CTestTraceline::UpdateTransmitState()
  60. {
  61. return SetTransmitState( FL_EDICT_ALWAYS );
  62. }