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.

93 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_HL2MPBASE_H
  7. #define WEAPON_HL2MPBASE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "hl2mp_player_shared.h"
  12. #include "basecombatweapon_shared.h"
  13. #include "hl2mp_weapon_parse.h"
  14. #if defined( CLIENT_DLL )
  15. #define CWeaponHL2MPBase C_WeaponHL2MPBase
  16. void UTIL_ClipPunchAngleOffset( QAngle &in, const QAngle &punch, const QAngle &clip );
  17. #endif
  18. class CHL2MP_Player;
  19. // These are the names of the ammo types that go in the CAmmoDefs and that the
  20. // weapon script files reference.
  21. // Given an ammo type (like from a weapon's GetPrimaryAmmoType()), this compares it
  22. // against the ammo name you specify.
  23. // MIKETODO: this should use indexing instead of searching and strcmp()'ing all the time.
  24. bool IsAmmoType( int iAmmoType, const char *pAmmoName );
  25. class CWeaponHL2MPBase : public CBaseCombatWeapon
  26. {
  27. public:
  28. DECLARE_CLASS( CWeaponHL2MPBase, CBaseCombatWeapon );
  29. DECLARE_NETWORKCLASS();
  30. DECLARE_PREDICTABLE();
  31. CWeaponHL2MPBase();
  32. #ifdef GAME_DLL
  33. DECLARE_DATADESC();
  34. void SendReloadSoundEvent( void );
  35. void Materialize( void );
  36. virtual int ObjectCaps( void );
  37. #endif
  38. // All predicted weapons need to implement and return true
  39. virtual bool IsPredicted() const;
  40. CBasePlayer* GetPlayerOwner() const;
  41. CHL2MP_Player* GetHL2MPPlayerOwner() const;
  42. void WeaponSound( WeaponSound_t sound_type, float soundtime = 0.0f );
  43. CHL2MPSWeaponInfo const &GetHL2MPWpnData() const;
  44. virtual void FireBullets( const FireBulletsInfo_t &info );
  45. virtual void FallInit( void );
  46. public:
  47. #if defined( CLIENT_DLL )
  48. virtual bool ShouldPredict();
  49. virtual void OnDataChanged( DataUpdateType_t type );
  50. virtual bool OnFireEvent( C_BaseViewModel *pViewModel, const Vector& origin, const QAngle& angles, int event, const char *options );
  51. #else
  52. virtual void Spawn();
  53. #endif
  54. float m_flPrevAnimTime;
  55. float m_flNextResetCheckTime;
  56. Vector GetOriginalSpawnOrigin( void ) { return m_vOriginalSpawnOrigin; }
  57. QAngle GetOriginalSpawnAngles( void ) { return m_vOriginalSpawnAngles; }
  58. private:
  59. CWeaponHL2MPBase( const CWeaponHL2MPBase & );
  60. Vector m_vOriginalSpawnOrigin;
  61. QAngle m_vOriginalSpawnAngles;
  62. };
  63. #endif // WEAPON_HL2MPBASE_H