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.

65 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: The class from which all bludgeon melee
  4. // weapons are derived.
  5. //
  6. // $Workfile: $
  7. // $Date: $
  8. // $NoKeywords: $
  9. //=============================================================================//
  10. #include "weapon_hl2mpbasehlmpcombatweapon.h"
  11. #ifndef BASEBLUDGEONWEAPON_H
  12. #define BASEBLUDGEONWEAPON_H
  13. #ifdef _WIN32
  14. #pragma once
  15. #endif
  16. #if defined( CLIENT_DLL )
  17. #define CBaseHL2MPBludgeonWeapon C_BaseHL2MPBludgeonWeapon
  18. #endif
  19. //=========================================================
  20. // CBaseHLBludgeonWeapon
  21. //=========================================================
  22. class CBaseHL2MPBludgeonWeapon : public CBaseHL2MPCombatWeapon
  23. {
  24. DECLARE_CLASS( CBaseHL2MPBludgeonWeapon, CBaseHL2MPCombatWeapon );
  25. public:
  26. CBaseHL2MPBludgeonWeapon();
  27. DECLARE_NETWORKCLASS();
  28. DECLARE_PREDICTABLE();
  29. virtual void Spawn( void );
  30. virtual void Precache( void );
  31. //Attack functions
  32. virtual void PrimaryAttack( void );
  33. virtual void SecondaryAttack( void );
  34. virtual void ItemPostFrame( void );
  35. //Functions to select animation sequences
  36. virtual Activity GetPrimaryAttackActivity( void ) { return ACT_VM_HITCENTER; }
  37. virtual Activity GetSecondaryAttackActivity( void ) { return ACT_VM_HITCENTER2; }
  38. virtual float GetFireRate( void ) { return 0.2f; }
  39. virtual float GetRange( void ) { return 32.0f; }
  40. virtual float GetDamageForActivity( Activity hitActivity ) { return 1.0f; }
  41. CBaseHL2MPBludgeonWeapon( const CBaseHL2MPBludgeonWeapon & );
  42. protected:
  43. virtual void ImpactEffect( trace_t &trace );
  44. private:
  45. bool ImpactWater( const Vector &start, const Vector &end );
  46. void Swing( int bIsSecondary );
  47. void Hit( trace_t &traceHit, Activity nHitActivity );
  48. Activity ChooseIntersectionPointAndActivity( trace_t &hitTrace, const Vector &mins, const Vector &maxs, CBasePlayer *pOwner );
  49. };
  50. #endif