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.

59 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Base code for any melee based weapon
  4. //
  5. //=====================================================================================//
  6. #ifndef SDK_WEAPON_MELEE_H
  7. #define SDK_WEAPON_MELEE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #if defined( CLIENT_DLL )
  12. #define CWeaponSDKMelee C_WeaponSDKMelee
  13. #endif
  14. //=========================================================
  15. // CBaseHLBludgeonWeapon
  16. //=========================================================
  17. class CWeaponSDKMelee : public CWeaponSDKBase
  18. {
  19. DECLARE_CLASS( CWeaponSDKMelee, CWeaponSDKBase );
  20. public:
  21. CWeaponSDKMelee();
  22. DECLARE_NETWORKCLASS();
  23. DECLARE_PREDICTABLE();
  24. virtual void Spawn( void );
  25. virtual void Precache( void );
  26. //Attack functions
  27. virtual void PrimaryAttack( void );
  28. virtual void SecondaryAttack( void );
  29. virtual void ItemPostFrame( void );
  30. //Functions to select animation sequences
  31. virtual Activity GetPrimaryAttackActivity( void ) { return ACT_VM_HITCENTER; }
  32. virtual Activity GetSecondaryAttackActivity( void ) { return ACT_VM_HITCENTER2; }
  33. virtual float GetRange( void ) { return 32.0f; }
  34. virtual float GetDamageForActivity( Activity hitActivity ) { return GetSDKWpnData().m_iDamage; }
  35. CWeaponSDKMelee( const CWeaponSDKMelee & );
  36. protected:
  37. virtual void ImpactEffect( trace_t &trace );
  38. private:
  39. bool ImpactWater( const Vector &start, const Vector &end );
  40. void Swing( int bIsSecondary );
  41. void Hit( trace_t &traceHit, Activity nHitActivity );
  42. Activity ChooseIntersectionPointAndActivity( trace_t &hitTrace, const Vector &mins, const Vector &maxs, CSDKPlayer *pOwner );
  43. };
  44. #endif // SDK_WEAPON_MELEE_H