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.

191 lines
5.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: PDA Weapon
  4. //
  5. //=============================================================================
  6. #ifndef TF_WEAPON_PDA_H
  7. #define TF_WEAPON_PDA_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_shareddefs.h"
  12. #include "tf_weaponbase.h"
  13. #ifdef CLIENT_DLL
  14. #include "tf_hud_base_build_menu.h"
  15. #endif
  16. // Client specific.
  17. #if defined( CLIENT_DLL )
  18. #define CTFWeaponPDA C_TFWeaponPDA
  19. #define CTFWeaponPDA_Engineer_Build C_TFWeaponPDA_Engineer_Build
  20. #define CTFWeaponPDA_Engineer_Destroy C_TFWeaponPDA_Engineer_Destroy
  21. #define CTFWeaponPDA_Spy C_TFWeaponPDA_Spy
  22. #define CTFWeaponPDA_Spy_Build C_TFWeaponPDA_Spy_Build
  23. #define CTFWeaponPDAExpansion_Dispenser C_TFWeaponPDAExpansion_Dispenser
  24. #define CTFWeaponPDAExpansion_Teleporter C_TFWeaponPDAExpansion_Teleporter
  25. #endif
  26. class CTFWeaponPDA : public CTFWeaponBase
  27. {
  28. public:
  29. DECLARE_CLASS( CTFWeaponPDA, CTFWeaponBase );
  30. DECLARE_NETWORKCLASS();
  31. DECLARE_PREDICTABLE();
  32. #if !defined( CLIENT_DLL )
  33. DECLARE_DATADESC();
  34. #endif
  35. CTFWeaponPDA();
  36. virtual void Spawn();
  37. #if !defined( CLIENT_DLL )
  38. virtual void Precache();
  39. virtual void GetControlPanelInfo( int nPanelIndex, const char *&pPanelName );
  40. #else
  41. virtual float CalcViewmodelBob( void );
  42. virtual CHudBaseBuildMenu *GetBuildMenu() const { return NULL; }
  43. #endif
  44. virtual bool ShouldShowControlPanels( void );
  45. virtual void PrimaryAttack();
  46. virtual void SecondaryAttack();
  47. virtual int GetWeaponID( void ) const { return TF_WEAPON_PDA; }
  48. virtual bool ShouldDrawCrosshair( void ) { return false; }
  49. virtual bool HasPrimaryAmmo() { return true; }
  50. virtual bool CanBeSelected() { return true; }
  51. #ifdef CLIENT_DLL
  52. virtual void OnDataChanged( DataUpdateType_t type ) OVERRIDE;
  53. virtual void UpdateOnRemove() OVERRIDE;
  54. #endif
  55. virtual const char *GetPanelName() { return "pda_panel"; }
  56. public:
  57. CTFWeaponInfo *m_pWeaponInfo;
  58. private:
  59. #ifdef CLIENT_DLL
  60. void HideBuildMenu() const;
  61. #endif
  62. CTFWeaponPDA( const CTFWeaponPDA & ) {}
  63. };
  64. class CTFWeaponPDA_Engineer_Build : public CTFWeaponPDA
  65. {
  66. public:
  67. DECLARE_CLASS( CTFWeaponPDA_Engineer_Build, CTFWeaponPDA );
  68. DECLARE_NETWORKCLASS();
  69. DECLARE_PREDICTABLE();
  70. virtual const char *GetPanelName() { return ""; }
  71. virtual int GetWeaponID( void ) const { return TF_WEAPON_PDA_ENGINEER_BUILD; }
  72. #ifdef CLIENT_DLL
  73. virtual CHudBaseBuildMenu *GetBuildMenu() const OVERRIDE;
  74. #endif
  75. };
  76. #ifdef CLIENT_DLL
  77. extern ConVar tf_build_menu_controller_mode;
  78. #endif
  79. class CTFWeaponPDA_Engineer_Destroy : public CTFWeaponPDA
  80. {
  81. public:
  82. DECLARE_CLASS( CTFWeaponPDA_Engineer_Destroy, CTFWeaponPDA );
  83. DECLARE_NETWORKCLASS();
  84. DECLARE_PREDICTABLE();
  85. virtual const char *GetPanelName() { return ""; }
  86. virtual int GetWeaponID( void ) const { return TF_WEAPON_PDA_ENGINEER_DESTROY; }
  87. #ifdef CLIENT_DLL
  88. virtual CHudBaseBuildMenu *GetBuildMenu() const OVERRIDE;
  89. #endif
  90. virtual bool VisibleInWeaponSelection( void );
  91. };
  92. class CTFWeaponPDA_Spy : public CTFWeaponPDA
  93. {
  94. public:
  95. DECLARE_CLASS( CTFWeaponPDA_Spy, CTFWeaponPDA );
  96. DECLARE_NETWORKCLASS();
  97. DECLARE_PREDICTABLE();
  98. virtual const char *GetPanelName() { return ""; }
  99. virtual int GetWeaponID( void ) const { return TF_WEAPON_PDA_SPY; }
  100. #ifdef CLIENT_DLL
  101. virtual CHudBaseBuildMenu *GetBuildMenu() const OVERRIDE;
  102. virtual bool Deploy( void );
  103. #endif
  104. virtual bool CanBeSelected( void ) OVERRIDE;
  105. virtual bool VisibleInWeaponSelection( void ) OVERRIDE;
  106. virtual void ItemPreFrame( void ); // called each frame by the player PreThink
  107. virtual void ItemBusyFrame( void ); // called each frame by the player PostThink
  108. virtual void ItemHolsterFrame( void ); // called each frame by the player PreThink, if the weapon is holstered
  109. void CheckDisguiseTimer( void );
  110. void ProcessDisguiseImpulse( void );
  111. };
  112. // ********************************************************************************************
  113. // PDA Expansion Slots
  114. class CTFWeaponPDAExpansion_Dispenser : public CTFWearable
  115. {
  116. DECLARE_CLASS( CTFWeaponPDAExpansion_Dispenser, CTFWearable );
  117. public:
  118. DECLARE_NETWORKCLASS();
  119. DECLARE_DATADESC();
  120. virtual void Equip( CBasePlayer *pOwner );
  121. virtual void UnEquip( CBasePlayer *pOwner );
  122. };
  123. class CTFWeaponPDAExpansion_Teleporter : public CTFWearable
  124. {
  125. DECLARE_CLASS( CTFWeaponPDAExpansion_Teleporter, CTFWearable );
  126. public:
  127. DECLARE_NETWORKCLASS();
  128. DECLARE_DATADESC();
  129. virtual void Equip( CBasePlayer *pOwner );
  130. virtual void UnEquip( CBasePlayer *pOwner );
  131. };
  132. #ifdef STAGING_ONLY
  133. //-----------------------------------------------------------------------------
  134. //
  135. //-----------------------------------------------------------------------------
  136. class CTFWeaponPDA_Spy_Build : public CTFWeaponPDA
  137. {
  138. public:
  139. DECLARE_CLASS( CTFWeaponPDA_Spy_Build, CTFWeaponPDA );
  140. DECLARE_NETWORKCLASS();
  141. DECLARE_PREDICTABLE();
  142. virtual bool CanDeploy( void ) OVERRIDE;
  143. virtual const char *GetPanelName() { return ""; }
  144. virtual int GetWeaponID( void ) const { return TF_WEAPON_PDA_SPY_BUILD; }
  145. virtual bool VisibleInWeaponSelection( void ) OVERRIDE;
  146. #ifdef CLIENT_DLL
  147. virtual CHudBaseBuildMenu *GetBuildMenu() const OVERRIDE;
  148. #endif
  149. float GetProgress( void );
  150. int GetCount( void );
  151. const char* GetEffectLabelText( void ) { return "#TF_Traps"; }
  152. };
  153. #endif
  154. #endif // TF_WEAPON_PDA_H