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.

82 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Weapon that throws things from the hand
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #ifndef WEAPON_BRICKBAT_H
  10. #define WEAPON_BRICKBAT_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "basehlcombatweapon.h"
  15. enum BrickbatAmmo_t
  16. {
  17. BRICKBAT_ROCK = 0,
  18. BRICKBAT_BOTTLE,
  19. NUM_BRICKBAT_AMMO_TYPES
  20. };
  21. class CGrenade_Brickbat;
  22. class CWeaponBrickbat : public CBaseHLCombatWeapon
  23. {
  24. public:
  25. DECLARE_CLASS( CWeaponBrickbat, CBaseHLCombatWeapon );
  26. DECLARE_SERVERCLASS();
  27. public:
  28. int m_iCurrentAmmoType;
  29. void Precache( void );
  30. void Spawn( void );
  31. bool Deploy( void );
  32. virtual const char *GetViewModel( int viewmodelindex =0 );
  33. virtual const char *GetWorldModel( void );
  34. void DrawAmmo( void );
  35. virtual int WeaponRangeAttack1Condition( float flDot, float flDist );
  36. virtual bool WeaponLOSCondition(const Vector &ownerPos, const Vector &targetPos, bool bSetConditions);
  37. void SetPickupTouch( void );
  38. void BrickbatTouch( CBaseEntity *pOther ); // default weapon touch
  39. void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr );
  40. int CapabilitiesGet( void ) { return bits_CAP_WEAPON_RANGE_ATTACK1; }
  41. bool ObjectInWay( void );
  42. void ThrowBrickbat( Vector vecSrc, Vector vecVelocity, float damage);
  43. void ItemPostFrame( void );
  44. void PrimaryAttack( void );
  45. void SecondaryAttack( void );
  46. void Throw( void );
  47. void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
  48. DECLARE_DATADESC();
  49. DECLARE_ACTTABLE();
  50. CWeaponBrickbat(void);
  51. private:
  52. bool m_bNeedDraw;
  53. bool m_bNeedThrow;
  54. int m_iThrowBits; // Save the current throw bits state
  55. float m_fNextThrowCheck; // When to check throw ability next
  56. Vector m_vecTossVelocity;
  57. int m_nAmmoCount[NUM_BRICKBAT_AMMO_TYPES]; // How much ammo of each type do I own?
  58. };
  59. #endif //WEAPON_BRICKBAT_H