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.

144 lines
5.2 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #if !defined( TEMPENT_H )
  9. #define TEMPENT_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "c_baseentity.h"
  14. #include "c_baseanimating.h"
  15. #include "c_sprite.h"
  16. // Temporary entity array
  17. #define TENTPRIORITY_LOW 0
  18. #define TENTPRIORITY_HIGH 1
  19. // TEMPENTITY flags
  20. #define FTENT_NONE 0x00000000
  21. #define FTENT_SINEWAVE 0x00000001
  22. #define FTENT_GRAVITY 0x00000002
  23. #define FTENT_ROTATE 0x00000004
  24. #define FTENT_SLOWGRAVITY 0x00000008
  25. #define FTENT_SMOKETRAIL 0x00000010
  26. #define FTENT_COLLIDEWORLD 0x00000020
  27. #define FTENT_FLICKER 0x00000040
  28. #define FTENT_FADEOUT 0x00000080
  29. #define FTENT_SPRANIMATE 0x00000100
  30. #define FTENT_HITSOUND 0x00000200
  31. #define FTENT_SPIRAL 0x00000400
  32. #define FTENT_SPRCYCLE 0x00000800
  33. #define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes
  34. #define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw
  35. #define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything
  36. #define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner)
  37. #define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed
  38. #define FTENT_SMOKEGROWANDFADE 0x00020000 // rapid grow and fade. Very specific for gunsmoke
  39. #define FTENT_ATTACHTOTARGET 0x00040000 // attach to whatever we hit, and stay there until die time is up
  40. #define FTENT_NOMODEL 0x00080000 // Doesn't have a model, never try to draw ( it just triggers other things )
  41. #define FTENT_CLIENTCUSTOM 0x00100000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things )
  42. #define FTENT_WINDBLOWN 0x00200000 // This is set when the temp entity is blown by the wind
  43. #define FTENT_NEVERDIE 0x00400000 // Don't die as long as die != 0
  44. #define FTENT_BEOCCLUDED 0x00800000 // Don't draw if my specified normal's facing away from the view
  45. #define FTENT_CHANGERENDERONCOLLIDE 0x01000000 //when we collide with something, change our rendergroup to RENDER_GROUP_OTHER
  46. #define FTENT_COLLISIONGROUP 0x02000000 // if set, use the C_BaseEntity::GetCollisionGroup when doing collide trace
  47. #define FTENT_ALIGNTOMOTION 0x04000000 // Change angles to always point in the direction of motion
  48. #define FTENT_CLIENTSIDEPARTICLES 0x08000000 // The object has a clientside particle system.
  49. #define FTENT_USEFASTCOLLISIONS 0x10000000 // Use fast collisions (cl_fasttempentcollision).
  50. class C_LocalTempEntity;
  51. typedef int (*pfnDrawHelper)( C_LocalTempEntity *entity, int flags );
  52. //-----------------------------------------------------------------------------
  53. // Purpose: Should this derive from some other class
  54. //-----------------------------------------------------------------------------
  55. class C_LocalTempEntity : public C_BaseAnimating, public C_SpriteRenderer
  56. {
  57. public:
  58. DECLARE_CLASS( C_LocalTempEntity, C_BaseAnimating );
  59. C_LocalTempEntity();
  60. virtual void Prepare( model_t *pmodel, float time );
  61. virtual bool IsActive( void );
  62. virtual bool Frame( float frametime, int framenumber );
  63. // C_BaseAnimating , etc. override
  64. virtual int DrawModel( int flags, const RenderableInstance_t &instance );
  65. // Sets the velocity
  66. void SetVelocity( const Vector &vecVelocity );
  67. const Vector &GetVelocity() const { return m_vecTempEntVelocity; }
  68. // Set the acceleration
  69. void SetAcceleration( const Vector &vecAccel );
  70. const Vector &GetAcceleration() const { return m_vecTempEntAcceleration; }
  71. void SetDrawHelper( pfnDrawHelper helper ) { m_pfnDrawHelper = helper; }
  72. void OnRemoveTempEntity();
  73. void SetImpactEffect( const char *pszImpactEffect ) { m_pszImpactEffect = pszImpactEffect; }
  74. void AddParticleEffect( const char *pszParticleEffect );
  75. void SetParticleEffect( const char *pszParticleEffect ) { m_pszParticleEffect = pszParticleEffect; }
  76. protected:
  77. pfnDrawHelper m_pfnDrawHelper;
  78. public:
  79. int flags;
  80. float die;
  81. float m_flFrameMax;
  82. float x;
  83. float y;
  84. float fadeSpeed;
  85. float bounceFactor;
  86. int hitSound;
  87. int priority;
  88. // if attached, this is the index of the client to stick to
  89. // if COLLIDEALL, this is the index of the client to ignore
  90. // TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex!
  91. short clientIndex;
  92. // if attached, client origin + tentOffset = tent origin.
  93. Vector tentOffset;
  94. // Used by temp entities.
  95. QAngle m_vecTempEntAngVelocity;
  96. int tempent_renderamt;
  97. Vector m_vecNormal;
  98. float m_flSpriteScale;
  99. int m_nFlickerFrame;
  100. //
  101. float m_flFrameRate;
  102. float m_flFrame;
  103. const char *m_pszImpactEffect;
  104. const char *m_pszParticleEffect;
  105. bool m_bParticleCollision;
  106. int m_iLastCollisionFrame;
  107. Vector m_vLastCollisionOrigin;
  108. private:
  109. C_LocalTempEntity( const C_LocalTempEntity & );
  110. Vector m_vecTempEntVelocity;
  111. Vector m_vecPrevLocalOrigin;
  112. Vector m_vecTempEntAcceleration;
  113. // Draw tempent as a studio model
  114. int DrawStudioModel( int flags );
  115. };
  116. #endif // TEMPENTITY_H