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.

132 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_PORTALBASE_H
  7. #define WEAPON_PORTALBASE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "basecombatweapon_shared.h"
  12. #include "portal_weapon_parse.h"
  13. #if defined( CLIENT_DLL )
  14. #define CWeaponPortalBase C_WeaponPortalBase
  15. void UTIL_ClipPunchAngleOffset( QAngle &in, const QAngle &punch, const QAngle &clip );
  16. #endif
  17. class CPortal_Player;
  18. // These are the names of the ammo types that go in the CAmmoDefs and that the
  19. // weapon script files reference.
  20. // Given an ammo type (like from a weapon's GetPrimaryAmmoType()), this compares it
  21. // against the ammo name you specify.
  22. // MIKETODO: this should use indexing instead of searching and strcmp()'ing all the time.
  23. bool IsAmmoType( int iAmmoType, const char *pAmmoName );
  24. typedef enum
  25. {
  26. WEAPON_NONE = 0,
  27. //Melee
  28. WEAPON_CROWBAR,
  29. //Special
  30. WEAPON_PORTALGUN,
  31. WEAPON_PHYSCANNON,
  32. //Pistols
  33. WEAPON_PISTOL,
  34. WEAPON_357,
  35. //Machineguns
  36. WEAPON_SMG,
  37. WEAPON_AR2,
  38. //Grenades
  39. WEAPON_FRAG,
  40. WEAPON_BUGBAIT,
  41. //Other
  42. WEAPON_SHOTGUN,
  43. WEAPON_CROSSBOW,
  44. WEAPON_RPG,
  45. WEAPON_MAX, // number of weapons weapon index
  46. } PortalWeaponID;
  47. class CWeaponPortalBase : public CBaseCombatWeapon
  48. {
  49. public:
  50. DECLARE_CLASS( CWeaponPortalBase, CBaseCombatWeapon );
  51. DECLARE_NETWORKCLASS();
  52. DECLARE_PREDICTABLE();
  53. CWeaponPortalBase();
  54. #ifdef GAME_DLL
  55. DECLARE_DATADESC();
  56. void SendReloadSoundEvent( void );
  57. void Materialize( void );
  58. #endif
  59. // All predicted weapons need to implement and return true
  60. virtual bool IsPredicted() const;
  61. CBasePlayer* GetPlayerOwner() const;
  62. CPortal_Player* GetPortalPlayerOwner() const;
  63. // Get specific Portal weapon ID (ie: WEAPON_PORTALGUN, etc)
  64. virtual PortalWeaponID GetWeaponID( void ) const { return WEAPON_NONE; }
  65. void WeaponSound( WeaponSound_t sound_type, float soundtime = 0.0f );
  66. CPortalSWeaponInfo const &GetPortalWpnData() const;
  67. virtual void FireBullets( const FireBulletsInfo_t &info );
  68. public:
  69. #if defined( CLIENT_DLL )
  70. virtual int DrawModel( int flags );
  71. virtual bool ShouldDraw( void );
  72. virtual bool ShouldDrawCrosshair( void ) { return true; }
  73. virtual bool ShouldPredict();
  74. virtual void OnDataChanged( DataUpdateType_t type );
  75. virtual void DrawCrosshair();
  76. virtual void DoAnimationEvents( CStudioHdr *pStudio );
  77. virtual void GetRenderBounds( Vector& theMins, Vector& theMaxs );
  78. virtual bool OnFireEvent( C_BaseViewModel *pViewModel, const Vector& origin, const QAngle& angles, int event, const char *options );
  79. #else
  80. virtual void Spawn();
  81. #endif
  82. float m_flPrevAnimTime;
  83. float m_flNextResetCheckTime;
  84. Vector GetOriginalSpawnOrigin( void ) { return m_vOriginalSpawnOrigin; }
  85. QAngle GetOriginalSpawnAngles( void ) { return m_vOriginalSpawnAngles; }
  86. private:
  87. CWeaponPortalBase( const CWeaponPortalBase & );
  88. Vector m_vOriginalSpawnOrigin;
  89. QAngle m_vOriginalSpawnAngles;
  90. };
  91. #endif // WEAPON_PORTALBASE_H