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.

113 lines
3.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TF_WEARABLE_H
  7. #define TF_WEARABLE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "econ_wearable.h"
  12. #include "props_shared.h"
  13. #include "GameEventListener.h"
  14. #if defined( CLIENT_DLL )
  15. #define CTFWearable C_TFWearable
  16. #define CTFWearableVM C_TFWearableVM
  17. #endif
  18. #if defined( CLIENT_DLL )
  19. class CTFWearable : public CEconWearable, public CGameEventListener
  20. #else
  21. class CTFWearable : public CEconWearable
  22. #endif
  23. {
  24. DECLARE_CLASS( CTFWearable, CEconWearable );
  25. public:
  26. DECLARE_NETWORKCLASS();
  27. DECLARE_DATADESC();
  28. CTFWearable();
  29. virtual void Equip( CBasePlayer* pOwner );
  30. virtual void UnEquip( CBasePlayer* pOwner );
  31. virtual bool CanEquip( CBaseEntity *pOther );
  32. void SetDisguiseWearable( bool bState ) { m_bDisguiseWearable = bState; }
  33. bool IsDisguiseWearable( void ) const { return m_bDisguiseWearable; }
  34. void SetWeaponAssociatedWith( CBaseEntity *pWeapon ) { m_hWeaponAssociatedWith = pWeapon; }
  35. CBaseEntity* GetWeaponAssociatedWith( void ) const { return m_hWeaponAssociatedWith.Get(); }
  36. virtual bool UpdateBodygroups( CBaseCombatCharacter* pOwner, int iState );
  37. virtual void ReapplyProvision( void );
  38. #if defined( GAME_DLL )
  39. void Break( void );
  40. virtual int CalculateVisibleClassFor( CBaseCombatCharacter *pPlayer );
  41. virtual int UpdateTransmitState();
  42. virtual int ShouldTransmit( const CCheckTransmitInfo *pInfo );
  43. int GetKillStreak ( ) { return m_iKillStreak; }
  44. void SetKillStreak ( int value ) { m_iKillStreak = value; };
  45. #endif
  46. #if defined( CLIENT_DLL )
  47. virtual int InternalDrawModel( int flags );
  48. virtual bool ShouldDraw();
  49. virtual bool ShouldDrawWhenPlayerIsDead() { return ( GetWeaponAssociatedWith() == NULL ); }
  50. virtual bool ShouldDrawParticleSystems( void ); // can't be const because it potentially mutates m_eParticleSystemVisibility state
  51. virtual int GetWorldModelIndex( void );
  52. virtual void ValidateModelIndex( void );
  53. virtual void OnDataChanged( DataUpdateType_t updateType );
  54. virtual void FireGameEvent( IGameEvent *event );
  55. #endif
  56. virtual int GetSkin( void );
  57. void AddHiddenBodyGroup( const char* bodygroup );
  58. protected:
  59. virtual void InternalSetPlayerDisplayModel( void );
  60. private:
  61. CNetworkVar( bool, m_bDisguiseWearable );
  62. CNetworkHandle( CBaseEntity, m_hWeaponAssociatedWith );
  63. CUtlVector< const char* > m_HiddenBodyGroups;
  64. #ifdef GAME_DLL
  65. int m_iKillStreak;
  66. #endif // GAME_DLL
  67. #if defined( CLIENT_DLL )
  68. enum eParticleSystemVisibility
  69. {
  70. kParticleSystemVisibility_Undetermined,
  71. kParticleSystemVisibility_Shown,
  72. kParticleSystemVisibility_Hidden,
  73. };
  74. eParticleSystemVisibility m_eParticleSystemVisibility;
  75. short m_nWorldModelIndex;
  76. #endif
  77. };
  78. class CTFWearableVM : public CTFWearable
  79. {
  80. DECLARE_CLASS( CTFWearableVM, CTFWearable );
  81. public:
  82. DECLARE_NETWORKCLASS();
  83. virtual bool IsViewModelWearable( void ) { return true; }
  84. #if defined( CLIENT_DLL )
  85. virtual ShadowType_t ShadowCastType( void );
  86. #endif
  87. };
  88. #endif // TF_WEARABLE_H