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.

150 lines
5.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef VEHICLE_JEEP_EPISODIC_H
  7. #define VEHICLE_JEEP_EPISODIC_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vehicle_jeep.h"
  12. #include "ai_basenpc.h"
  13. #include "hl2_vehicle_radar.h"
  14. class CParticleSystem;
  15. class CVehicleCargoTrigger;
  16. class CSprite;
  17. #define NUM_WHEEL_EFFECTS 2
  18. #define NUM_HAZARD_LIGHTS 4
  19. //=============================================================================
  20. // Episodic jeep
  21. class CPropJeepEpisodic : public CPropJeep
  22. {
  23. DECLARE_CLASS( CPropJeepEpisodic, CPropJeep );
  24. DECLARE_SERVERCLASS();
  25. public:
  26. CPropJeepEpisodic( void );
  27. virtual void Spawn( void );
  28. virtual void Activate( void );
  29. virtual void Think( void );
  30. virtual void UpdateOnRemove( void );
  31. virtual void NPC_FinishedEnterVehicle( CAI_BaseNPC *pPassenger, bool bCompanion );
  32. virtual void NPC_FinishedExitVehicle( CAI_BaseNPC *pPassenger, bool bCompanion );
  33. virtual bool NPC_CanEnterVehicle( CAI_BaseNPC *pPassenger, bool bCompanion );
  34. virtual bool NPC_CanExitVehicle( CAI_BaseNPC *pPassenger, bool bCompanion );
  35. virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
  36. virtual void Precache( void );
  37. virtual void EnterVehicle( CBaseCombatCharacter *pPassenger );
  38. virtual void ExitVehicle( int nRole );
  39. virtual bool AllowBlockedExit( CBaseCombatCharacter *pPassenger, int nRole );
  40. // Passengers take no damage except what we pass them
  41. virtual bool PassengerShouldReceiveDamage( CTakeDamageInfo &info )
  42. {
  43. if ( GetServerVehicle() && GetServerVehicle()->IsPassengerExiting() )
  44. return false;
  45. return ( info.GetDamageType() & DMG_VEHICLE ) != 0;
  46. }
  47. virtual int ObjectCaps( void ) { return (BaseClass::ObjectCaps() | FCAP_NOTIFY_ON_TRANSITION); }
  48. void SpawnRadarPanel();
  49. void DestroyRadarPanel();
  50. int NumRadarContacts() { return m_iNumRadarContacts; }
  51. void AddPropToCargoHold( CPhysicsProp *pProp );
  52. virtual CBaseEntity *OnFailedPhysGunPickup( Vector vPhysgunPos );
  53. virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased );
  54. virtual int DrawDebugTextOverlays( void );
  55. DECLARE_DATADESC();
  56. protected:
  57. void HazardBlinkThink( void );
  58. void CreateHazardLights( void );
  59. void DestroyHazardLights( void );
  60. void UpdateCargoEntry( void );
  61. void ReleasePropFromCargoHold( void );
  62. void CreateCargoTrigger( void );
  63. virtual float GetUprightTime( void ) { return 1.0f; }
  64. virtual float GetUprightStrength( void );
  65. virtual bool ShouldPuntUseLaunchForces( PhysGunForce_t reason ) { return ( reason == PHYSGUN_FORCE_PUNTED ); }
  66. virtual void HandleWater( void );
  67. virtual AngularImpulse PhysGunLaunchAngularImpulse( void );
  68. virtual Vector PhysGunLaunchVelocity( const Vector &forward, float flMass );
  69. bool PassengerInTransition( void );
  70. void SetBusterHopperVisibility(bool visible);
  71. private:
  72. void UpdateWheelDust( void );
  73. void UpdateRadar( bool forceUpdate = false );
  74. void InputLockEntrance( inputdata_t &data );
  75. void InputUnlockEntrance( inputdata_t &data );
  76. void InputLockExit( inputdata_t &data );
  77. void InputUnlockExit( inputdata_t &data );
  78. void InputEnableRadar( inputdata_t &data );
  79. void InputDisableRadar( inputdata_t &data );
  80. void InputEnableRadarDetectEnemies( inputdata_t &data );
  81. void InputAddBusterToCargo( inputdata_t &data );
  82. void InputSetCargoVisibility( inputdata_t &data );
  83. void InputOutsideTransition( inputdata_t &data );
  84. void InputDisablePhysGun( inputdata_t &data );
  85. void InputEnablePhysGun( inputdata_t &data );
  86. void InputCreateLinkController( inputdata_t &data );
  87. void InputDestroyLinkController( inputdata_t &data );
  88. void CreateAvoidanceZone( void );
  89. bool m_bEntranceLocked;
  90. bool m_bExitLocked;
  91. bool m_bAddingCargo;
  92. bool m_bBlink;
  93. float m_flCargoStartTime; // Time when the cargo was first added to the vehicle (used for animating into hold)
  94. float m_flNextAvoidBroadcastTime; // Next time we'll warn entity to move out of us
  95. COutputEvent m_OnCompanionEnteredVehicle; // Passenger has completed entering the vehicle
  96. COutputEvent m_OnCompanionExitedVehicle; // Passenger has completed exited the vehicle
  97. COutputEvent m_OnHostileEnteredVehicle; // Passenger has completed entering the vehicle
  98. COutputEvent m_OnHostileExitedVehicle; // Passenger has completed exited the vehicle
  99. CHandle< CParticleSystem > m_hWheelDust[NUM_WHEEL_EFFECTS];
  100. CHandle< CParticleSystem > m_hWheelWater[NUM_WHEEL_EFFECTS];
  101. CHandle< CVehicleCargoTrigger > m_hCargoTrigger;
  102. CHandle< CPhysicsProp > m_hCargoProp;
  103. CHandle< CSprite > m_hHazardLights[NUM_HAZARD_LIGHTS];
  104. float m_flNextWaterSound;
  105. bool m_bRadarEnabled;
  106. bool m_bRadarDetectsEnemies;
  107. float m_flNextRadarUpdateTime;
  108. EHANDLE m_hRadarScreen;
  109. EHANDLE m_hLinkControllerFront;
  110. EHANDLE m_hLinkControllerRear;
  111. bool m_bBusterHopperVisible; // is the hopper assembly visible on the vehicle? please do not set this directly - use the accessor funct.
  112. CNetworkVar( int, m_iNumRadarContacts );
  113. CNetworkArray( Vector, m_vecRadarContactPos, RADAR_MAX_CONTACTS );
  114. CNetworkArray( int, m_iRadarContactType, RADAR_MAX_CONTACTS );
  115. };
  116. #endif // VEHICLE_JEEP_EPISODIC_H