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.

85 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_SDKBASE_H
  7. #define WEAPON_SDKBASE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "sdk_playeranimstate.h"
  12. #include "sdk_weapon_parse.h"
  13. #if defined( CLIENT_DLL )
  14. #define CWeaponSDKBase C_WeaponSDKBase
  15. #endif
  16. class CSDKPlayer;
  17. // These are the names of the ammo types that the weapon script files reference.
  18. #define AMMO_BULLETS "AMMO_BULLETS"
  19. #define AMMO_ROCKETS "AMMO_ROCKETS"
  20. #define AMMO_GRENADE "AMMO_GRENADE"
  21. //--------------------------------------------------------------------------------------------------------
  22. //
  23. // Weapon IDs for all SDK Game weapons
  24. //
  25. typedef enum
  26. {
  27. WEAPON_NONE = 0,
  28. WEAPON_MP5,
  29. WEAPON_SHOTGUN,
  30. WEAPON_GRENADE,
  31. WEAPON_MAX, // number of weapons weapon index
  32. } SDKWeaponID;
  33. typedef enum
  34. {
  35. Primary_Mode = 0,
  36. Secondary_Mode,
  37. } SDKWeaponMode;
  38. const char *WeaponIDToAlias( int id );
  39. class CWeaponSDKBase : public CBaseCombatWeapon
  40. {
  41. public:
  42. DECLARE_CLASS( CWeaponSDKBase, CBaseCombatWeapon );
  43. DECLARE_NETWORKCLASS();
  44. DECLARE_PREDICTABLE();
  45. CWeaponSDKBase();
  46. #ifdef GAME_DLL
  47. DECLARE_DATADESC();
  48. #endif
  49. // All predicted weapons need to implement and return true
  50. virtual bool IsPredicted() const { return true; }
  51. virtual SDKWeaponID GetWeaponID( void ) const { return WEAPON_NONE; }
  52. // Get SDK weapon specific weapon data.
  53. CSDKWeaponInfo const &GetSDKWpnData() const;
  54. // Get a pointer to the player that owns this weapon
  55. CSDKPlayer* GetPlayerOwner() const;
  56. // override to play custom empty sounds
  57. virtual bool PlayEmptySound();
  58. #ifdef GAME_DLL
  59. virtual void SendReloadEvents();
  60. #endif
  61. private:
  62. CWeaponSDKBase( const CWeaponSDKBase & );
  63. };
  64. #endif // WEAPON_SDKBASE_H