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.

82 lines
2.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "fx_trail.h"
  8. // NOTE: This has to be the last file included!
  9. #include "tier0/memdbgon.h"
  10. C_ParticleTrail::C_ParticleTrail( void )
  11. {
  12. }
  13. C_ParticleTrail::~C_ParticleTrail( void )
  14. {
  15. if ( m_pParticleMgr )
  16. {
  17. m_pParticleMgr->RemoveEffect( &m_ParticleEffect );
  18. }
  19. }
  20. //-----------------------------------------------------------------------------
  21. // Purpose: Gets the attachment point to spawn at
  22. //-----------------------------------------------------------------------------
  23. void C_ParticleTrail::GetAimEntOrigin( IClientEntity *pAttachedTo, Vector *pAbsOrigin, QAngle *pAbsAngles )
  24. {
  25. C_BaseEntity *pEnt = pAttachedTo->GetBaseEntity();
  26. if ( pEnt && (m_nAttachment > 0) )
  27. {
  28. pEnt->GetAttachment( m_nAttachment, *pAbsOrigin, *pAbsAngles );
  29. return;
  30. }
  31. BaseClass::GetAimEntOrigin( pAttachedTo, pAbsOrigin, pAbsAngles );
  32. }
  33. //-----------------------------------------------------------------------------
  34. // Purpose: Turn on the emission of particles
  35. //-----------------------------------------------------------------------------
  36. void C_ParticleTrail::SetEmit( bool bEmit )
  37. {
  38. m_bEmit = bEmit;
  39. }
  40. //-----------------------------------------------------------------------------
  41. // Purpose: Set the spawn rate of the effect
  42. //-----------------------------------------------------------------------------
  43. void C_ParticleTrail::SetSpawnRate( float rate )
  44. {
  45. m_SpawnRate = rate;
  46. m_ParticleSpawn.Init( rate );
  47. }
  48. //-----------------------------------------------------------------------------
  49. // Purpose: First sent down from the server
  50. //-----------------------------------------------------------------------------
  51. void C_ParticleTrail::OnDataChanged(DataUpdateType_t updateType)
  52. {
  53. C_BaseEntity::OnDataChanged(updateType);
  54. if ( updateType == DATA_UPDATE_CREATED )
  55. {
  56. Start( ParticleMgr(), NULL );
  57. }
  58. }
  59. //-----------------------------------------------------------------------------
  60. // Purpose:
  61. //-----------------------------------------------------------------------------
  62. void C_ParticleTrail::Start( CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs )
  63. {
  64. if( pParticleMgr->AddEffect( &m_ParticleEffect, this ) == false )
  65. return;
  66. m_pParticleMgr = pParticleMgr;
  67. }