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.

104 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: The TF Game rules object
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #ifndef TFC_GAMERULES_H
  10. #define TFC_GAMERULES_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "teamplay_gamerules.h"
  15. #include "convar.h"
  16. #include "gamevars_shared.h"
  17. #ifdef CLIENT_DLL
  18. #include "c_baseplayer.h"
  19. #else
  20. #include "player.h"
  21. #endif
  22. #ifdef CLIENT_DLL
  23. #define CTFCGameRules C_TFCGameRules
  24. #define CTFCGameRulesProxy C_TFCGameRulesProxy
  25. #else
  26. extern BOOL no_cease_fire_text;
  27. extern BOOL cease_fire;
  28. #endif
  29. class CTFCGameRulesProxy : public CGameRulesProxy
  30. {
  31. public:
  32. DECLARE_CLASS( CTFCGameRulesProxy, CGameRulesProxy );
  33. DECLARE_NETWORKCLASS();
  34. };
  35. class CTFCGameRules : public CTeamplayRules
  36. {
  37. public:
  38. DECLARE_CLASS( CTFCGameRules, CTeamplayRules );
  39. CTFCGameRules();
  40. virtual bool ShouldCollide( int collisionGroup0, int collisionGroup1 );
  41. void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrcIn, float flRadius, int iClassIgnore, bool bIgnoreWorld );
  42. #ifdef CLIENT_DLL
  43. DECLARE_CLIENTCLASS_NOBASE(); // This makes datatables able to access our private vars.
  44. #else
  45. DECLARE_SERVERCLASS_NOBASE(); // This makes datatables able to access our private vars.
  46. virtual ~CTFCGameRules();
  47. virtual bool ClientCommand( CBaseEntity *pEdict, const CCommand &args );
  48. virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrcIn, float flRadius, int iClassIgnore );
  49. virtual void Think();
  50. virtual const char *GetChatPrefix( bool bTeamOnly, CBasePlayer *pPlayer );
  51. bool IsInPreMatch() const;
  52. float GetPreMatchEndTime() const; // Returns the time at which the prematch will be over.
  53. void TFCGoToIntermission();
  54. private:
  55. #endif
  56. public:
  57. bool CTF_Map;
  58. };
  59. //-----------------------------------------------------------------------------
  60. // Gets us at the team fortress game rules
  61. //-----------------------------------------------------------------------------
  62. inline CTFCGameRules* TFCGameRules()
  63. {
  64. return static_cast<CTFCGameRules*>(g_pGameRules);
  65. }
  66. extern ConVar mp_fadetoblack;
  67. #endif // TFC_GAMERULES_H