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.

102 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TF_DROPPED_WEAPON_H
  8. #define TF_DROPPED_WEAPON_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #ifdef CLIENT_DLL
  13. #define CTFDroppedWeapon C_TFDroppedWeapon
  14. #endif // CLIENT_DLL
  15. #ifdef GAME_DLL
  16. class CTFPlayer;
  17. #endif // GAME_DLL
  18. DECLARE_AUTO_LIST( IDroppedWeaponAutoList );
  19. class CTFDroppedWeapon : public CBaseAnimating, public IDroppedWeaponAutoList
  20. {
  21. public:
  22. DECLARE_CLASS( CTFDroppedWeapon, CBaseAnimating );
  23. DECLARE_NETWORKCLASS();
  24. CTFDroppedWeapon();
  25. ~CTFDroppedWeapon();
  26. virtual void Spawn() OVERRIDE;
  27. #ifdef CLIENT_DLL
  28. virtual void OnPreDataChanged( DataUpdateType_t updateType ) OVERRIDE;
  29. virtual void OnDataChanged( DataUpdateType_t updateType ) OVERRIDE;
  30. virtual void ClientThink() OVERRIDE;
  31. // target id
  32. virtual bool IsVisibleToTargetID( void ) const OVERRIDE;
  33. // Draw Attachment models
  34. virtual bool OnInternalDrawModel( ClientModelRenderInfo_t *pInfo );
  35. virtual IMaterial *GetEconWeaponMaterialOverride( int iTeam ) OVERRIDE;
  36. virtual void ModifyEmitSoundParams( EmitSound_t &params ) OVERRIDE;
  37. #endif // CLIENT_DLL
  38. #ifdef GAME_DLL
  39. static CTFDroppedWeapon *Create( CTFPlayer *pLastOwner, const Vector &vecOrigin, const QAngle &vecAngles, const char *pszModelName, const CEconItemView *pItem );
  40. void InitDroppedWeapon( CTFPlayer *pPlayer, CTFWeaponBase *pWeapon, bool bSwap, bool bIsSuicide = false );
  41. void InitPickedUpWeapon( CTFPlayer *pPlayer, CTFWeaponBase *pWeapon );
  42. void ChargeLevelDegradeThink();
  43. #endif // GAME_DLL
  44. CEconItemView *GetItem() { return &m_Item; }
  45. const CEconItemView *GetItem() const { return &m_Item; }
  46. float GetChargeLevel( void ){ return m_flChargeLevel; }
  47. private:
  48. CNetworkVarEmbedded( CEconItemView, m_Item );
  49. CNetworkVar( float, m_flChargeLevel );
  50. #ifdef GAME_DLL
  51. CHandle< CTFPlayer > m_hPlayer;
  52. // preserve weapon ammo in the clip
  53. void SetItem( const CEconItemView *pItem );
  54. // preserve ammo count
  55. int m_nClip;
  56. int m_nAmmo;
  57. int m_nDetonated;
  58. float m_flEnergy;
  59. float m_flEffectBarRegenTime;
  60. float m_flNextPrimaryAttack;
  61. float m_flNextSecondaryAttack;
  62. #endif // GAME_DLL
  63. #ifdef CLIENT_DLL
  64. void SetupParticleEffect();
  65. HPARTICLEFFECT m_effect;
  66. CHandle< C_BaseAnimating > m_worldmodelStatTrakAddon;
  67. void UpdateGlowEffect( void );
  68. void DestroyGlowEffect( void );
  69. CGlowObject *m_pGlowEffect;
  70. bool m_bShouldGlowForLocalPlayer;
  71. CUtlVector<AttachedModelData_t> m_vecAttachedModels;
  72. float m_flOldChargeLevel;
  73. #endif // CLIENT_DLL
  74. };
  75. #endif // TF_DROPPED_WEAPON_H