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.

150 lines
3.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef BASEGRENADE_SHARED_H
  8. #define BASEGRENADE_SHARED_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #if defined( CLIENT_DLL )
  13. #define CBaseGrenade C_BaseGrenade
  14. #include "c_basecombatcharacter.h"
  15. #include "glow_outline_effect.h"
  16. #else
  17. #include "basecombatcharacter.h"
  18. #include "player_pickup.h"
  19. #endif
  20. #include "cs_shareddefs.h"
  21. #define BASEGRENADE_EXPLOSION_VOLUME 1024
  22. class CTakeDamageInfo;
  23. #if !defined( CLIENT_DLL )
  24. class CBaseGrenade : public CBaseAnimating, public CDefaultPlayerPickupVPhysics
  25. #else
  26. class CBaseGrenade : public CBaseAnimating
  27. #endif
  28. {
  29. DECLARE_CLASS( CBaseGrenade, CBaseAnimating );
  30. public:
  31. CBaseGrenade(void);
  32. ~CBaseGrenade(void);
  33. DECLARE_PREDICTABLE();
  34. DECLARE_NETWORKCLASS();
  35. #if !defined( CLIENT_DLL )
  36. DECLARE_DATADESC();
  37. #endif
  38. virtual void Precache( void );
  39. virtual void Explode( trace_t *pTrace, int bitsDamageType );
  40. void Smoke( void );
  41. void BounceTouch( CBaseEntity *pOther );
  42. void SlideTouch( CBaseEntity *pOther );
  43. void ExplodeTouch( CBaseEntity *pOther );
  44. void DangerSoundThink( void );
  45. void PreDetonate( void );
  46. virtual void Detonate( void );
  47. void DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
  48. void TumbleThink( void );
  49. virtual Vector GetBlastForce() { return vec3_origin; }
  50. virtual void BounceSound( void );
  51. virtual int BloodColor( void ) { return DONT_BLEED; }
  52. virtual void Event_Killed( const CTakeDamageInfo &info );
  53. virtual float GetShakeAmplitude( void ) { return 25.0; }
  54. virtual float GetShakeRadius( void ) { return 750.0; }
  55. virtual const char *GetParticleSystemName( int pointContents, surfacedata_t *pdata = NULL ) { return NULL; }
  56. virtual GrenadeType_t GetGrenadeType( void ) { return GRENADE_TYPE_EXPLOSIVE; }
  57. // Damage accessors.
  58. virtual float GetDamage()
  59. {
  60. return m_flDamage;
  61. }
  62. virtual float GetDamageRadius()
  63. {
  64. return m_DmgRadius;
  65. }
  66. virtual void SetDamage(float flDamage)
  67. {
  68. m_flDamage = flDamage;
  69. }
  70. virtual void SetDamageRadius(float flDamageRadius)
  71. {
  72. m_DmgRadius = flDamageRadius;
  73. }
  74. // Bounce sound accessors.
  75. void SetBounceSound( const char *pszBounceSound )
  76. {
  77. m_iszBounceSound = MAKE_STRING( pszBounceSound );
  78. }
  79. CBaseCombatCharacter *GetThrower( void );
  80. void SetThrower( CBaseCombatCharacter *pThrower );
  81. CBaseEntity *GetOriginalThrower() { return m_hOriginalThrower; }
  82. #if !defined( CLIENT_DLL )
  83. // Allow +USE pickup
  84. int ObjectCaps()
  85. {
  86. return (BaseClass::ObjectCaps() | FCAP_IMPULSE_USE | FCAP_USE_IN_RADIUS);
  87. }
  88. void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
  89. #endif
  90. public:
  91. IMPLEMENT_NETWORK_VAR_FOR_DERIVED( m_vecVelocity );
  92. IMPLEMENT_NETWORK_VAR_FOR_DERIVED( m_fFlags );
  93. bool m_bHasWarnedAI; // whether or not this grenade has issued its DANGER sound to the world sound list yet.
  94. CNetworkVar( bool, m_bIsLive ); // Is this grenade live, or can it be picked up?
  95. CNetworkVar( float, m_DmgRadius ); // How far do I do damage?
  96. CNetworkVar( float, m_flNextAttack );
  97. float m_flDetonateTime; // Time at which to detonate.
  98. float m_flWarnAITime; // Time at which to warn the AI
  99. #if defined( CLIENT_DLL )
  100. CGlowObject m_GlowObject;
  101. #endif
  102. protected:
  103. CNetworkVar( float, m_flDamage ); // Damage to inflict.
  104. string_t m_iszBounceSound; // The sound to make on bouncing. If not NULL, overrides the BounceSound() function.
  105. private:
  106. CNetworkHandle( CBaseEntity, m_hThrower ); // Who threw this grenade
  107. EHANDLE m_hOriginalThrower; // Who was the original thrower of this grenade
  108. CBaseGrenade( const CBaseGrenade & ); // not defined, not accessible
  109. };
  110. #endif // BASEGRENADE_SHARED_H