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.

143 lines
3.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TF_WEAPON_SWORD_H
  7. #define TF_WEAPON_SWORD_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase_melee.h"
  12. #ifdef GAME_DLL
  13. #include "GameEventListener.h"
  14. #else
  15. #include "tf_viewmodel.h"
  16. #include "bone_setup.h"
  17. #include "tf_wearable_item_demoshield.h"
  18. #endif
  19. #ifdef CLIENT_DLL
  20. #define CTFSword C_TFSword
  21. #define CTFKatana C_TFKatana
  22. #endif
  23. //=============================================================================
  24. //
  25. // Decapitation melee weapon base class.
  26. //
  27. #ifdef GAME_DLL
  28. class CTFDecapitationMeleeWeaponBase : public CTFWeaponBaseMelee, public CGameEventListener
  29. #else
  30. class CTFDecapitationMeleeWeaponBase : public CTFWeaponBaseMelee
  31. #endif
  32. {
  33. public:
  34. DECLARE_CLASS( CTFDecapitationMeleeWeaponBase, CTFWeaponBaseMelee );
  35. CTFDecapitationMeleeWeaponBase();
  36. virtual void Precache( void );
  37. virtual int GetWeaponID( void ) const { return TF_WEAPON_SWORD; }
  38. virtual int GetCustomDamageType() const { return TF_DMG_CUSTOM_DECAPITATION; }
  39. virtual float GetMeleeDamage( CBaseEntity *pTarget, int* piDamageType, int* piCustomDamage );
  40. virtual Activity TranslateViewmodelHandActivityInternal( Activity actBase );
  41. virtual bool CanDecapitate( void );
  42. virtual void SetupGameEventListeners( void );
  43. virtual void OnDecapitation( CTFPlayer *pDeadPlayer ) {}
  44. #ifdef GAME_DLL
  45. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
  46. virtual void FireGameEvent( IGameEvent *event );
  47. #endif
  48. #ifdef CLIENT_DLL
  49. virtual void UpdateAttachmentModels( void );
  50. virtual int DrawOverriddenViewmodel( C_BaseViewModel *pViewmodel, int flags );
  51. #endif // CLIENT_DLL
  52. protected:
  53. bool m_bHolstering;
  54. private:
  55. #ifdef CLIENT_DLL
  56. EHANDLE m_hShield;
  57. #endif // CLIENT_DLL
  58. };
  59. //=============================================================================
  60. //
  61. // Sword class. (Consumes heads for speed/health bonus.)
  62. //
  63. class CTFSword : public CTFDecapitationMeleeWeaponBase
  64. {
  65. public:
  66. DECLARE_CLASS( CTFSword, CTFDecapitationMeleeWeaponBase );
  67. DECLARE_NETWORKCLASS();
  68. DECLARE_PREDICTABLE();
  69. CTFSword() {}
  70. virtual ~CTFSword() {}
  71. virtual void WeaponReset( void );
  72. virtual float GetSwordSpeedMod( void );
  73. virtual int GetSwordHealthMod();
  74. virtual int GetSwingRange( void );
  75. virtual void OnDecapitation( CTFPlayer *pDeadPlayer );
  76. virtual bool Deploy( void );
  77. float GetProgress( void ) { return 0.f; }
  78. int GetCount( void );
  79. const char* GetEffectLabelText( void ) { return "#TF_BERZERK"; }
  80. #ifdef CLIENT_DLL
  81. virtual void WeaponIdle( void );
  82. #endif
  83. private:
  84. CTFSword( const CTFSword& ) {}
  85. #ifdef CLIENT_DLL
  86. float m_flNextIdleWavRoll;
  87. int m_iPrevWavDecap;
  88. #endif
  89. };
  90. //=============================================================================
  91. //
  92. // Sword class. (On head-take causes short-term soldier buff effects.)
  93. //
  94. class CTFKatana : public CTFDecapitationMeleeWeaponBase
  95. {
  96. public:
  97. DECLARE_CLASS( CTFKatana, CTFDecapitationMeleeWeaponBase );
  98. DECLARE_NETWORKCLASS();
  99. DECLARE_PREDICTABLE();
  100. CTFKatana();
  101. virtual ~CTFKatana() {}
  102. virtual bool Deploy( void );
  103. virtual float GetMeleeDamage( CBaseEntity *pTarget, int* piDamageType, int* piCustomDamage );
  104. virtual void OnDecapitation( CTFPlayer *pDeadPlayer );
  105. virtual int GetActivityWeaponRole() const OVERRIDE;
  106. protected:
  107. virtual int GetSkinOverride() const;
  108. private:
  109. CNetworkVar( bool, m_bIsBloody );
  110. };
  111. #endif // TF_WEAPON_SWORD_H