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.

76 lines
1.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef FX_BLOOD_H
  7. #define FX_BLOOD_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier0/memdbgon.h"
  12. class CBloodSprayEmitter : public CSimpleEmitter
  13. {
  14. public:
  15. CBloodSprayEmitter( const char *pDebugName ) : CSimpleEmitter( pDebugName ) {}
  16. static CBloodSprayEmitter *Create( const char *pDebugName )
  17. {
  18. return new CBloodSprayEmitter( pDebugName );
  19. }
  20. inline void SetGravity( float flGravity )
  21. {
  22. m_flGravity = flGravity;
  23. }
  24. virtual float UpdateRoll( SimpleParticle *pParticle, float timeDelta )
  25. {
  26. pParticle->m_flRoll += pParticle->m_flRollDelta * timeDelta;
  27. pParticle->m_flRollDelta += pParticle->m_flRollDelta * ( timeDelta * -4.0f );
  28. //Cap the minimum roll
  29. /*
  30. if ( fabs( pParticle->m_flRollDelta ) < 0.5f )
  31. {
  32. pParticle->m_flRollDelta = ( pParticle->m_flRollDelta > 0.0f ) ? 0.5f : -0.5f;
  33. }
  34. */
  35. return pParticle->m_flRoll;
  36. }
  37. virtual void UpdateVelocity( SimpleParticle *pParticle, float timeDelta )
  38. {
  39. if ( !( pParticle->m_iFlags & SIMPLE_PARTICLE_FLAG_NO_VEL_DECAY ) )
  40. {
  41. //Decelerate
  42. static float dtime;
  43. static float decay;
  44. if ( dtime != timeDelta )
  45. {
  46. decay = ExponentialDecay( 0.1, 0.4f, dtime );
  47. dtime = timeDelta;
  48. }
  49. pParticle->m_vecVelocity *= decay;
  50. pParticle->m_vecVelocity[2] -= ( m_flGravity * timeDelta );
  51. }
  52. }
  53. private:
  54. float m_flGravity;
  55. CBloodSprayEmitter( const CBloodSprayEmitter & );
  56. };
  57. #include "tier0/memdbgoff.h"
  58. #endif // FX_BLOOD_H