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.

79 lines
2.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Game rules for Portal.
  4. //
  5. //=============================================================================//
  6. #ifndef PORTAL_GAMERULES_H
  7. #define PORTAL_GAMERULES_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "gamerules.h"
  12. #include "hl2_gamerules.h"
  13. #define DISABLE_DEBUG_HISTORY 1
  14. #ifdef CLIENT_DLL
  15. #define CPortalGameRules C_PortalGameRules
  16. #define CPortalGameRulesProxy C_PortalGameRulesProxy
  17. #endif
  18. class CPortalGameRulesProxy : public CGameRulesProxy
  19. {
  20. public:
  21. DECLARE_CLASS( CPortalGameRulesProxy, CGameRulesProxy );
  22. DECLARE_NETWORKCLASS();
  23. };
  24. class CPortalGameRules : public CHalfLife2
  25. {
  26. public:
  27. DECLARE_CLASS( CPortalGameRules, CHalfLife2 );
  28. CPortalGameRules();
  29. virtual ~CPortalGameRules() {}
  30. #ifdef CLIENT_DLL
  31. virtual bool IsBonusChallengeTimeBased( void );
  32. virtual bool IsChallengeMode();
  33. #endif
  34. virtual bool ShouldCollide( int collisionGroup0, int collisionGroup1 );
  35. private:
  36. #ifdef CLIENT_DLL
  37. DECLARE_CLIENTCLASS_NOBASE(); // This makes datatables able to access our private vars.
  38. #else
  39. DECLARE_SERVERCLASS_NOBASE(); // This makes datatables able to access our private vars.
  40. public:
  41. virtual const char * GetGameDescription( void );
  42. virtual bool AllowDamage( CBaseEntity *pVictim, const CTakeDamageInfo &info );
  43. virtual void RegisterScriptFunctions( void );
  44. virtual bool ShouldBurningPropsEmitLight() { return false; }
  45. virtual float FlPlayerFallDamage( CBasePlayer *pPlayer ) { return 0.0f; } //no fall damage in portal
  46. virtual bool ClientCommand( CBaseEntity *pEdict, const CCommand &args );
  47. virtual bool IsSavingAllowed( void );
  48. #endif
  49. };
  50. //-----------------------------------------------------------------------------
  51. // Gets us at the Portal game rules
  52. //-----------------------------------------------------------------------------
  53. inline CPortalGameRules* PortalGameRules()
  54. {
  55. return dynamic_cast<CPortalGameRules*>(g_pGameRules);
  56. }
  57. #endif // PORTAL_GAMERULES_H