Team Fortress 2 Source Code as on 22/4/2020
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.

112 lines
2.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: TF Nail Grenade.
  4. //
  5. //=============================================================================//
  6. #ifndef TF_WEAPON_GRENADE_NAIL_H
  7. #define TF_WEAPON_GRENADE_NAIL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase_grenade.h"
  12. #include "tf_weaponbase_grenadeproj.h"
  13. // Client specific.
  14. #ifdef CLIENT_DLL
  15. #define CTFGrenadeNail C_TFGrenadeNail
  16. #endif
  17. //=============================================================================
  18. //
  19. // TF Nail Grenade
  20. //
  21. class CTFGrenadeNail : public CTFWeaponBaseGrenade
  22. {
  23. public:
  24. DECLARE_CLASS( CTFGrenadeNail, CTFWeaponBaseGrenade );
  25. DECLARE_NETWORKCLASS();
  26. DECLARE_PREDICTABLE();
  27. // DECLARE_ACTTABLE();
  28. CTFGrenadeNail() {}
  29. // Unique identifier.
  30. virtual int GetWeaponID( void ) const { return TF_WEAPON_GRENADE_NAIL; }
  31. // Server specific.
  32. #ifdef GAME_DLL
  33. DECLARE_DATADESC();
  34. virtual CTFWeaponBaseGrenadeProj *EmitGrenade( Vector vecSrc, QAngle vecAngles, Vector vecVel, AngularImpulse angImpulse, CBasePlayer *pPlayer, float flTime, int iflags = 0 );
  35. #endif
  36. public:
  37. CTFGrenadeNail( const CTFGrenadeNail & ) {}
  38. };
  39. //=============================================================================
  40. //
  41. // TF Nail Grenade Projectile (Server specific.)
  42. //
  43. #ifdef GAME_DLL
  44. class CNailGrenadeController : public IMotionEvent
  45. {
  46. DECLARE_SIMPLE_DATADESC();
  47. public:
  48. virtual simresult_e Simulate( IPhysicsMotionController *pController, IPhysicsObject *pObject, float deltaTime, Vector &linear, AngularImpulse &angular );
  49. public:
  50. void SetDesiredPosAndOrientation( Vector pos, QAngle orientation );
  51. private:
  52. Vector m_vecDesiredPosition;
  53. QAngle m_angDesiredOrientation;
  54. bool m_bReachedPos;
  55. bool m_bReachedOrientation;
  56. };
  57. class CTFGrenadeNailProjectile : public CTFWeaponBaseGrenadeProj
  58. {
  59. public:
  60. ~CTFGrenadeNailProjectile();
  61. DECLARE_CLASS( CTFGrenadeNailProjectile, CTFWeaponBaseGrenadeProj );
  62. DECLARE_DATADESC();
  63. // Unique identifier.
  64. virtual int GetWeaponID( void ) const { return TF_WEAPON_GRENADE_NAIL; }
  65. // Creation.
  66. static CTFGrenadeNailProjectile *Create( const Vector &position, const QAngle &angles, const Vector &velocity,
  67. const AngularImpulse &angVelocity, CBaseCombatCharacter *pOwner, const CTFWeaponInfo &weaponInfo, float timer, int iFlags = 0 );
  68. // Overrides.
  69. virtual void Spawn();
  70. virtual void Precache();
  71. virtual void BounceSound( void );
  72. virtual void Detonate();
  73. virtual int OnTakeDamage( const CTakeDamageInfo &info );
  74. void StartEmittingNails( void );
  75. void EmitNails( void );
  76. CNailGrenadeController m_GrenadeController;
  77. IPhysicsMotionController *m_pMotionController;
  78. public:
  79. bool m_bActivated;
  80. float m_flNailAngle;
  81. int m_iNumNailBurstsLeft;
  82. };
  83. #endif // GAME_DLL
  84. #endif // TF_WEAPON_GRENADE_NAIL_H