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.

101 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. // copied from portal2 code; original code came with client-predicted counterpart,
  8. // but implementing predictable triggers in tf2 wasn't trivial so this is just the
  9. // server component. it works but causes prediction errors.
  10. #ifndef TRIGGER_CATAPULT_H
  11. #define TRIGGER_CATAPULT_H
  12. #ifdef _WIN32
  13. #pragma once
  14. #endif
  15. #include "triggers.h"
  16. class CTriggerCatapult : public CBaseTrigger
  17. {
  18. DECLARE_CLASS( CTriggerCatapult, CBaseTrigger );
  19. DECLARE_DATADESC();
  20. //DECLARE_SERVERCLASS();
  21. public:
  22. CTriggerCatapult( void );
  23. virtual void Spawn( void );
  24. virtual void StartTouch( CBaseEntity *pOther );
  25. virtual void EndTouch( CBaseEntity *pOther );
  26. virtual int DrawDebugTextOverlays(void);
  27. virtual void DrawDebugGeometryOverlays( void );
  28. void LaunchThink( void );
  29. void PlayerPassesTriggerFiltersThink( void );
  30. static const char *s_szPlayerPassesTriggerFiltersThinkContext;
  31. private:
  32. void InputSetPlayerSpeed( inputdata_t &in );
  33. void InputSetPhysicsSpeed( inputdata_t &in );
  34. void InputSetLaunchTarget( inputdata_t &in );
  35. void InputSetExactVelocityChoiceType( inputdata_t &in );
  36. void LaunchByTarget( CBaseEntity *pVictim, CBaseEntity *pTarget );
  37. Vector CalculateLaunchVector( CBaseEntity *pVictim, CBaseEntity *pTarget );
  38. Vector CalculateLaunchVectorPreserve( Vector vecInitialVelocity, CBaseEntity *pVictim, CBaseEntity *pTarget, bool bForcePlayer = false );
  39. void LaunchByDirection( CBaseEntity *pVictim );
  40. void OnLaunchedVictim( CBaseEntity *pVictim );
  41. float m_flRefireDelay[MAX_PLAYERS + 1];
  42. float m_flPlayerVelocity;
  43. float m_flPhysicsVelocity;
  44. QAngle m_vecLaunchAngles;
  45. string_t m_strLaunchTarget;
  46. int m_ExactVelocityChoice;
  47. bool m_bUseExactVelocity;
  48. bool m_bUseThresholdCheck;
  49. float m_flLowerThreshold;
  50. float m_flUpperThreshold;
  51. float m_flEntryAngleTolerance;
  52. EHANDLE m_hLaunchTarget;
  53. bool m_bOnlyVelocityCheck;
  54. bool m_bApplyAngularImpulse;
  55. bool m_bPlayersPassTriggerFilters;
  56. float m_flAirControlSupressionTime;
  57. bool m_bDirectionSuppressAirControl;
  58. //CNetworkArray( float, m_flRefireDelay, MAX_PLAYERS + 1 ); // 0 for physics object the rest for each player userid
  59. //CNetworkVar( float, m_flPlayerVelocity );
  60. //CNetworkVar( float, m_flPhysicsVelocity );
  61. //CNetworkQAngle( m_vecLaunchAngles );
  62. ////CNetworkVar( string_t, m_strLaunchTarget );
  63. //string_t m_strLaunchTarget;
  64. //CNetworkVar( int, m_ExactVelocityChoice );
  65. //CNetworkVar( bool, m_bUseExactVelocity );
  66. //CNetworkVar( bool, m_bUseThresholdCheck );
  67. //CNetworkVar( float, m_flLowerThreshold );
  68. //CNetworkVar( float, m_flUpperThreshold );
  69. //CNetworkVar( float, m_flEntryAngleTolerance );
  70. //CNetworkHandle( CBaseEntity, m_hLaunchTarget );
  71. //CNetworkVar( bool, m_bOnlyVelocityCheck );
  72. //CNetworkVar( bool, m_bApplyAngularImpulse );
  73. //CNetworkVar( bool, m_bPlayersPassTriggerFilters );
  74. //CNetworkVar( float, m_flAirControlSupressionTime ); // After catapult, stop air control for this long (or default of quarter second if this value is negative)
  75. //CNetworkVar( bool, m_bDirectionSuppressAirControl ); // Do we want to use air control suppression for directional catapults.
  76. COutputEvent m_OnCatapulted;
  77. CUtlVector< EHANDLE > m_hAbortedLaunchees;
  78. };
  79. #endif // TRIGGER_CATAPULT_H