Counter Strike : Global Offensive Source Code
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.

139 lines
6.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef ISERVERVEHICLE_H
  8. #define ISERVERVEHICLE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "IVehicle.h"
  13. #include "vphysics/vehicles.h"
  14. class CBaseEntity;
  15. class CBasePlayer;
  16. class CBaseCombatCharacter;
  17. class CNPC_VehicleDriver;
  18. enum VehicleSeatQuery_e;
  19. // This is used by the player to access vehicles. It's an interface so the
  20. // vehicles are not restricted in what they can derive from.
  21. abstract_class IServerVehicle : public IVehicle
  22. {
  23. public:
  24. // Get the entity associated with the vehicle.
  25. virtual CBaseEntity* GetVehicleEnt() = 0;
  26. // Get and set the current driver. Use PassengerRole_t enum in shareddefs.h for adding passengers
  27. virtual void SetPassenger( int nRole, CBaseCombatCharacter *pPassenger ) = 0;
  28. // Is the player visible while in the vehicle? (this is a constant the vehicle)
  29. virtual bool IsPassengerVisible( int nRole = VEHICLE_ROLE_DRIVER ) = 0;
  30. // Can a given passenger take damage?
  31. virtual bool IsPassengerDamagable( int nRole = VEHICLE_ROLE_DRIVER ) = 0;
  32. virtual bool PassengerShouldReceiveDamage( CTakeDamageInfo &info ) = 0;
  33. // Is the vehicle upright?
  34. virtual bool IsVehicleUpright( void ) = 0;
  35. // Whether or not we're in a transitional phase
  36. virtual bool IsPassengerEntering( void ) = 0;
  37. virtual bool IsPassengerExiting( void ) = 0;
  38. // Get a position in *world space* inside the vehicle for the player to start at
  39. virtual void GetPassengerSeatPoint( int nRole, Vector *pPoint, QAngle *pAngles ) = 0;
  40. virtual void HandlePassengerEntry( CBaseCombatCharacter *pPassenger, bool bAllowEntryOutsideZone = false ) = 0;
  41. virtual bool HandlePassengerExit( CBaseCombatCharacter *pPassenger ) = 0;
  42. // Get a point in *world space* to leave the vehicle from (may be in solid)
  43. virtual bool GetPassengerExitPoint( int nRole, Vector *pPoint, QAngle *pAngles ) = 0;
  44. virtual int GetEntryAnimForPoint( const Vector &vecPoint ) = 0;
  45. virtual int GetExitAnimToUse( Vector &vecEyeExitEndpoint, bool &bAllPointsBlocked ) = 0;
  46. virtual void HandleEntryExitFinish( bool bExitAnimOn, bool bResetAnim ) = 0;
  47. virtual Class_T ClassifyPassenger( CBaseCombatCharacter *pPassenger, Class_T defaultClassification ) = 0;
  48. virtual float PassengerDamageModifier( const CTakeDamageInfo &info ) = 0;
  49. // Get me the parameters for this vehicle
  50. virtual const vehicleparams_t *GetVehicleParams( void ) = 0;
  51. // If I'm a physics vehicle, get the controller
  52. virtual IPhysicsVehicleController *GetVehicleController() = 0;
  53. virtual int NPC_GetAvailableSeat( CBaseCombatCharacter *pPassenger, string_t strRoleName, VehicleSeatQuery_e nQueryType ) = 0;
  54. virtual bool NPC_AddPassenger( CBaseCombatCharacter *pPassenger, string_t strRoleName, int nSeat ) = 0;
  55. virtual bool NPC_RemovePassenger( CBaseCombatCharacter *pPassenger ) = 0;
  56. virtual bool NPC_GetPassengerSeatPosition( CBaseCombatCharacter *pPassenger, Vector *vecResultPos, QAngle *vecResultAngle ) = 0;
  57. virtual bool NPC_GetPassengerSeatPositionLocal( CBaseCombatCharacter *pPassenger, Vector *vecResultPos, QAngle *vecResultAngle ) = 0;
  58. virtual int NPC_GetPassengerSeatAttachment( CBaseCombatCharacter *pPassenger ) = 0;
  59. virtual bool NPC_HasAvailableSeat( string_t strRoleName ) = 0;
  60. virtual const PassengerSeatAnims_t *NPC_GetPassengerSeatAnims( CBaseCombatCharacter *pPassenger, PassengerSeatAnimType_t nType ) = 0;
  61. virtual CBaseCombatCharacter *NPC_GetPassengerInSeat( int nRoleID, int nSeatID ) = 0;
  62. virtual void RestorePassengerInfo( void ) = 0;
  63. // NPC Driving
  64. virtual bool NPC_CanDrive( void ) = 0;
  65. virtual void NPC_SetDriver( CNPC_VehicleDriver *pDriver ) = 0;
  66. virtual void NPC_DriveVehicle( void ) = 0;
  67. virtual void NPC_ThrottleCenter( void ) = 0;
  68. virtual void NPC_ThrottleReverse( void ) = 0;
  69. virtual void NPC_ThrottleForward( void ) = 0;
  70. virtual void NPC_Brake( void ) = 0;
  71. virtual void NPC_TurnLeft( float flDegrees ) = 0;
  72. virtual void NPC_TurnRight( float flDegrees ) = 0;
  73. virtual void NPC_TurnCenter( void ) = 0;
  74. virtual void NPC_PrimaryFire( void ) = 0;
  75. virtual void NPC_SecondaryFire( void ) = 0;
  76. virtual bool NPC_HasPrimaryWeapon( void ) = 0;
  77. virtual bool NPC_HasSecondaryWeapon( void ) = 0;
  78. virtual void NPC_AimPrimaryWeapon( Vector vecTarget ) = 0;
  79. virtual void NPC_AimSecondaryWeapon( Vector vecTarget ) = 0;
  80. // Weapon handling
  81. virtual void Weapon_PrimaryRanges( float *flMinRange, float *flMaxRange ) = 0;
  82. virtual void Weapon_SecondaryRanges( float *flMinRange, float *flMaxRange ) = 0;
  83. virtual float Weapon_PrimaryCanFireAt( void ) = 0; // Return the time at which this vehicle's primary weapon can fire again
  84. virtual float Weapon_SecondaryCanFireAt( void ) = 0; // Return the time at which this vehicle's secondary weapon can fire again
  85. // debugging, script file flushed
  86. virtual void ReloadScript() = 0;
  87. };
  88. // This is an interface to derive from if your class contains an IServerVehicle
  89. // handler (i.e. something derived CBaseServerVehicle.
  90. abstract_class IDrivableVehicle
  91. {
  92. public:
  93. virtual CBaseEntity *GetDriver( void ) = 0;
  94. // Process movement
  95. virtual void ItemPostFrame( CBasePlayer *pPlayer ) = 0;
  96. virtual void SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move ) = 0;
  97. virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMoveData ) = 0;
  98. virtual void FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move ) = 0;
  99. // Entering / Exiting
  100. virtual bool CanEnterVehicle( CBaseEntity *pEntity ) = 0;
  101. virtual bool CanExitVehicle( CBaseEntity *pEntity ) = 0;
  102. virtual void SetVehicleEntryAnim( bool bOn ) = 0;
  103. virtual void SetVehicleExitAnim( bool bOn, Vector vecEyeExitEndpoint ) = 0;
  104. virtual void EnterVehicle( CBaseCombatCharacter *pPassenger ) = 0;
  105. virtual void PreExitVehicle( CBaseCombatCharacter *pPassenger, int nRole ) = 0;
  106. virtual void ExitVehicle( int nRole ) = 0;
  107. virtual bool AllowBlockedExit( CBaseCombatCharacter *pPassenger, int nRole ) = 0;
  108. virtual bool AllowMidairExit( CBaseCombatCharacter *pPassenger, int nRole ) = 0;
  109. virtual string_t GetVehicleScriptName() = 0;
  110. virtual bool PassengerShouldReceiveDamage( CTakeDamageInfo &info ) = 0;
  111. };
  112. #endif // IVEHICLE_H