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.

126 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_TFCBASE_H
  7. #define WEAPON_TFCBASE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tfc_playeranimstate.h"
  12. #include "tfc_weapon_parse.h"
  13. #if defined( CLIENT_DLL )
  14. #define CWeaponTFCBase C_WeaponTFCBase
  15. #endif
  16. class CTFCPlayer;
  17. // Given an ammo type (like from a weapon's GetPrimaryAmmoType()), this compares it
  18. // against the ammo name you specify.
  19. // MIKETODO: this should use indexing instead of searching and strcmp()'ing all the time.
  20. bool IsAmmoType( int iAmmoType, const char *pAmmoName );
  21. typedef enum
  22. {
  23. WEAPON_NONE = 0,
  24. // Melee
  25. WEAPON_CROWBAR,
  26. WEAPON_SPANNER, // Engineer's wrench.
  27. WEAPON_KNIFE,
  28. WEAPON_MEDIKIT,
  29. // Vector weapons
  30. WEAPON_MINIGUN,
  31. // Shotguns
  32. WEAPON_SHOTGUN,
  33. WEAPON_SUPER_SHOTGUN,
  34. WEAPON_NAILGUN,
  35. WEAPON_SUPER_NAILGUN,
  36. WEAPON_MAX, // number of weapons weapon index
  37. } TFCWeaponID;
  38. //Class Heirarchy for tfc weapons
  39. /*
  40. CWeaponTFCBase
  41. |
  42. |--> CTFCCrowbar
  43. | |
  44. | |--> CTFCKnife
  45. | |--> CTFCMedikit
  46. | |--> CTFCSpanner
  47. | |--> CTFCMedikit
  48. |
  49. |--> CTFCMinigun
  50. |
  51. |--> CTFCShotgun
  52. | |
  53. | |--> CTFCSuperShotgun
  54. |
  55. |--> CTFCNailgun
  56. | |
  57. | |--> CTFCSuperNailgun
  58. */
  59. class CWeaponTFCBase : public CBaseCombatWeapon
  60. {
  61. public:
  62. DECLARE_CLASS( CWeaponTFCBase, CBaseCombatWeapon );
  63. DECLARE_NETWORKCLASS();
  64. DECLARE_PREDICTABLE();
  65. CWeaponTFCBase();
  66. virtual void Precache();
  67. virtual bool IsPredicted() const;
  68. CTFCPlayer* GetPlayerOwner() const;
  69. // Get TFC-specific weapon data.
  70. CTFCWeaponInfo const &GetTFCWpnData() const;
  71. // Get specific TFC weapon ID (ie: WEAPON_AK47, etc)
  72. virtual TFCWeaponID GetWeaponID( void ) const;
  73. // return true if this weapon is an instance of the given weapon type (ie: "IsA" WEAPON_GLOCK)
  74. bool IsA( TFCWeaponID id ) const;
  75. // return true if this weapon has a silencer equipped
  76. virtual bool IsSilenced( void ) const;
  77. #ifdef CLIENT_DLL
  78. #else
  79. DECLARE_DATADESC();
  80. virtual void Spawn();
  81. virtual bool DefaultReload( int iClipSize1, int iClipSize2, int iActivity );
  82. void SendReloadSoundEvent();
  83. virtual Vector GetSoundEmissionOrigin() const;
  84. #endif
  85. private:
  86. CWeaponTFCBase( const CWeaponTFCBase & );
  87. };
  88. #endif // WEAPON_TFCBASE_H