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.

132 lines
3.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef C_TF_WEAPON_BUILDER_H
  8. #define C_TF_WEAPON_BUILDER_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tf_weaponbase.h"
  13. #include "c_baseobject.h"
  14. #define CTFWeaponBuilder C_TFWeaponBuilder
  15. #define CTFWeaponSapper C_TFWeaponSapper
  16. //=============================================================================
  17. // Purpose: Client version of CWeaponBuiler
  18. //=============================================================================
  19. class C_TFWeaponBuilder : public C_TFWeaponBase
  20. {
  21. DECLARE_CLASS( C_TFWeaponBuilder, C_TFWeaponBase );
  22. public:
  23. DECLARE_CLIENTCLASS();
  24. DECLARE_PREDICTABLE();
  25. C_TFWeaponBuilder();
  26. ~C_TFWeaponBuilder();
  27. virtual void Redraw();
  28. virtual void SecondaryAttack();
  29. virtual bool IsPlacingObject( void );
  30. virtual const char *GetCurrentSelectionObjectName( void );
  31. virtual const char *GetViewModel( int iViewModel ) const;
  32. virtual const char *GetWorldModel( void ) const;
  33. virtual bool Deploy( void );
  34. virtual void PostDataUpdate( DataUpdateType_t type );
  35. C_BaseObject *GetPlacementModel( void ) { return m_hObjectBeingBuilt.Get(); }
  36. virtual void UpdateAttachmentModels( void );
  37. virtual int GetSlot( void ) const;
  38. virtual int GetPosition( void ) const;
  39. void SetupObjectSelectionSprite( void );
  40. virtual CHudTexture const *GetSpriteActive( void ) const;
  41. virtual CHudTexture const *GetSpriteInactive( void ) const;
  42. virtual const char *GetPrintName( void ) const;
  43. virtual int GetSubType( void );
  44. virtual bool CanBeSelected( void );
  45. virtual bool VisibleInWeaponSelection( void );
  46. virtual bool HasAmmo( void );
  47. virtual int GetWeaponID( void ) const { return TF_WEAPON_BUILDER; }
  48. int GetType( void ) { return m_iObjectType; }
  49. bool CanBuildObjectType( int iObjectType );
  50. virtual Activity GetDrawActivity( void );
  51. virtual CStudioHdr *OnNewModel( void );
  52. virtual float InternalGetEffectBarRechargeTime( void ) { return 15.0; }
  53. virtual int GetEffectBarAmmo( void ) { return TF_AMMO_GRENADES2; }
  54. float GetProgress( void ) { return GetEffectBarProgress(); }
  55. const char* GetEffectLabelText( void ) { return "#TF_Sapper"; }
  56. virtual bool EffectMeterShouldFlash( void );
  57. public:
  58. // Builder Data
  59. int m_iBuildState;
  60. unsigned int m_iObjectType;
  61. unsigned int m_iObjectMode;
  62. float m_flStartTime;
  63. float m_flTotalTime;
  64. CHudTexture *m_pSelectionTextureActive;
  65. CHudTexture *m_pSelectionTextureInactive;
  66. // Our placement model
  67. CHandle<C_BaseObject> m_hObjectBeingBuilt;
  68. int m_iValidBuildPoseParam;
  69. // Wheatly Data
  70. float m_flWheatleyTalkingUntil;
  71. private:
  72. C_TFWeaponBuilder( const C_TFWeaponBuilder & );
  73. bool m_aBuildableObjectTypes[OBJ_LAST];
  74. };
  75. //-----------------------------------------------------------------------------
  76. // Purpose:
  77. //-----------------------------------------------------------------------------
  78. class C_TFWeaponSapper : public C_TFWeaponBuilder, public ITFChargeUpWeapon
  79. {
  80. DECLARE_CLASS( C_TFWeaponSapper, C_TFWeaponBuilder );
  81. public:
  82. DECLARE_NETWORKCLASS();
  83. //DECLARE_PREDICTABLE();
  84. // ITFChargeUpWeapon
  85. virtual bool CanCharge( void ) { return GetChargeMaxTime() > 0; }
  86. virtual float GetChargeBeginTime( void ) { return m_flChargeBeginTime; }
  87. virtual float GetChargeMaxTime( void ) { float flChargeTime = 0; CALL_ATTRIB_HOOK_FLOAT( flChargeTime, sapper_deploy_time ); return flChargeTime; };
  88. virtual const char *GetViewModel( int iViewModel ) const;
  89. virtual const char *GetWorldModel( void ) const;
  90. bool IsWheatleyTalking( void ) { return gpGlobals->curtime <= m_flWheatleyTalkingUntil; }
  91. CNetworkVar( float, m_flChargeBeginTime );
  92. };
  93. #endif // C_TF_WEAPON_BUILDER_H