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.

134 lines
4.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef C_PROP_VEHICLE_H
  7. #define C_PROP_VEHICLE_H
  8. #pragma once
  9. #include "iclientvehicle.h"
  10. #include "vehicle_viewblend_shared.h"
  11. class C_PropVehicleDriveable : public C_BaseAnimating, public IClientVehicle
  12. {
  13. DECLARE_CLASS( C_PropVehicleDriveable, C_BaseAnimating );
  14. public:
  15. DECLARE_CLIENTCLASS();
  16. DECLARE_INTERPOLATION();
  17. DECLARE_DATADESC();
  18. C_PropVehicleDriveable();
  19. ~C_PropVehicleDriveable();
  20. // IVehicle overrides.
  21. public:
  22. virtual C_BaseCombatCharacter* GetPassenger( int nRole );
  23. virtual int GetPassengerRole( C_BaseCombatCharacter *pEnt );
  24. virtual bool IsPassengerUsingStandardWeapons( int nRole = VEHICLE_ROLE_DRIVER ) { return false; }
  25. virtual void GetVehicleViewPosition( int nRole, Vector *pOrigin, QAngle *pAngles, float *pFOV = NULL );
  26. virtual void SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move ) {}
  27. virtual void ProcessMovement( C_BasePlayer *pPlayer, CMoveData *pMoveData ) {}
  28. virtual void FinishMove( C_BasePlayer *player, CUserCmd *ucmd, CMoveData *move ) {}
  29. virtual void ItemPostFrame( C_BasePlayer *pPlayer ) {}
  30. // IClientVehicle overrides.
  31. public:
  32. virtual void GetVehicleFOV( float &flFOV ) { flFOV = m_flFOV; }
  33. virtual void DrawHudElements();
  34. virtual void UpdateViewAngles( C_BasePlayer *pLocalPlayer, CUserCmd *pCmd );
  35. virtual void DampenEyePosition( Vector &vecVehicleEyePos, QAngle &vecVehicleEyeAngles );
  36. virtual void GetVehicleClipPlanes( float &flZNear, float &flZFar ) const;
  37. #ifdef HL2_CLIENT_DLL
  38. virtual int GetPrimaryAmmoType() const { return -1; }
  39. virtual int GetPrimaryAmmoCount() const { return -1; }
  40. virtual int GetPrimaryAmmoClip() const { return -1; }
  41. virtual bool PrimaryAmmoUsesClips() const { return false; }
  42. #endif
  43. virtual bool IsPredicted() const { return false; }
  44. virtual int GetJoystickResponseCurve() const;
  45. // C_BaseEntity overrides.
  46. public:
  47. virtual IClientVehicle* GetClientVehicle() { return this; }
  48. virtual C_BaseEntity *GetVehicleEnt() { return this; }
  49. virtual bool IsSelfAnimating() { return false; };
  50. virtual void OnPreDataChanged( DataUpdateType_t updateType );
  51. virtual void OnDataChanged( DataUpdateType_t updateType );
  52. // Should this object cast render-to-texture shadows?
  53. virtual ShadowType_t ShadowCastType();
  54. // Mark the shadow as dirty while the vehicle is being driven
  55. virtual void ClientThink( void );
  56. // C_PropVehicleDriveable
  57. public:
  58. bool IsRunningEnterExitAnim( void ) { return m_bEnterAnimOn || m_bExitAnimOn; }
  59. // NVNT added to check if the vehicle needs to aim
  60. virtual bool HasGun(void){return m_bHasGun;}
  61. protected:
  62. virtual void OnEnteredVehicle( C_BaseCombatCharacter *pPassenger );
  63. // NVNT added to notify haptics system of vehicle exit.
  64. virtual void OnExitedVehicle( C_BaseCombatCharacter *pPassenger );
  65. virtual void RestrictView( float *pYawBounds, float *pPitchBounds, float *pRollBounds, QAngle &vecViewAngles );
  66. virtual void SetVehicleFOV( float flFOV ) { m_flFOV = flFOV; }
  67. protected:
  68. CHandle<C_BasePlayer> m_hPlayer;
  69. int m_nSpeed;
  70. int m_nRPM;
  71. float m_flThrottle;
  72. int m_nBoostTimeLeft;
  73. int m_nHasBoost;
  74. int m_nScannerDisabledWeapons;
  75. int m_nScannerDisabledVehicle;
  76. // timers/flags for flashing icons on hud
  77. int m_iFlashTimer;
  78. bool m_bLockedDim;
  79. bool m_bLockedIcon;
  80. int m_iScannerWepFlashTimer;
  81. bool m_bScannerWepDim;
  82. bool m_bScannerWepIcon;
  83. int m_iScannerVehicleFlashTimer;
  84. bool m_bScannerVehicleDim;
  85. bool m_bScannerVehicleIcon;
  86. float m_flSequenceChangeTime;
  87. bool m_bEnterAnimOn;
  88. bool m_bExitAnimOn;
  89. float m_flFOV;
  90. Vector m_vecGunCrosshair;
  91. CInterpolatedVar<Vector> m_iv_vecGunCrosshair;
  92. Vector m_vecEyeExitEndpoint;
  93. bool m_bHasGun;
  94. bool m_bUnableToFire;
  95. // Used to smooth view entry
  96. CHandle<C_BasePlayer> m_hPrevPlayer;
  97. ViewSmoothingData_t m_ViewSmoothingData;
  98. };
  99. #endif // C_PROP_VEHICLE_H