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.

131 lines
4.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef SINGLEPLAY_GAMERULES_H
  7. #define SINGLEPLAY_GAMERULES_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "gamerules.h"
  12. #ifdef CLIENT_DLL
  13. #define CSingleplayRules C_SingleplayRules
  14. #endif
  15. //=========================================================
  16. // CSingleplayRules - rules for the single player Half-Life
  17. // game.
  18. //=========================================================
  19. class CSingleplayRules : public CGameRules
  20. {
  21. public:
  22. DECLARE_CLASS( CSingleplayRules, CGameRules );
  23. // Functions to verify the single/multiplayer status of a game
  24. virtual bool IsMultiplayer( void );
  25. // Damage query implementations.
  26. virtual bool Damage_IsTimeBased( int iDmgType ); // Damage types that are time-based.
  27. virtual bool Damage_ShouldGibCorpse( int iDmgType ); // Damage types that gib the corpse.
  28. virtual bool Damage_ShowOnHUD( int iDmgType ); // Damage types that have client HUD art.
  29. virtual bool Damage_NoPhysicsForce( int iDmgType ); // Damage types that don't have to supply a physics force & position.
  30. virtual bool Damage_ShouldNotBleed( int iDmgType ); // Damage types that don't make the player bleed.
  31. // TEMP: These will go away once DamageTypes become enums.
  32. virtual int Damage_GetTimeBased( void );
  33. virtual int Damage_GetShouldGibCorpse( void );
  34. virtual int Damage_GetShowOnHud( void );
  35. virtual int Damage_GetNoPhysicsForce( void );
  36. virtual int Damage_GetShouldNotBleed( void );
  37. #ifdef CLIENT_DLL
  38. #else
  39. CSingleplayRules();
  40. virtual ~CSingleplayRules() {}
  41. // GR_Think
  42. virtual void Think( void );
  43. virtual bool IsAllowedToSpawn( CBaseEntity *pEntity );
  44. virtual bool FAllowFlashlight( void ) { return TRUE; };
  45. virtual bool FShouldSwitchWeapon( CBasePlayer *pPlayer, CBaseCombatWeapon *pWeapon );
  46. virtual CBaseCombatWeapon *GetNextBestWeapon( CBaseCombatCharacter *pPlayer, CBaseCombatWeapon *pCurrentWeapon );
  47. bool SwitchToNextBestWeapon( CBaseCombatCharacter *pPlayer, CBaseCombatWeapon *pCurrentWeapon );
  48. // Functions to verify the single/multiplayer status of a game
  49. virtual bool IsDeathmatch( void );
  50. virtual bool IsCoOp( void );
  51. // Client connection/disconnection
  52. virtual bool ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen );
  53. virtual void InitHUD( CBasePlayer *pl ); // the client dll is ready for updating
  54. virtual void ClientDisconnected( edict_t *pClient );
  55. // Client damage rules
  56. virtual float FlPlayerFallDamage( CBasePlayer *pPlayer );
  57. virtual bool AllowDamage( CBaseEntity *pVictim, const CTakeDamageInfo &info );
  58. // Client spawn/respawn control
  59. virtual void PlayerSpawn( CBasePlayer *pPlayer );
  60. virtual bool FPlayerCanRespawn( CBasePlayer *pPlayer );
  61. virtual float FlPlayerSpawnTime( CBasePlayer *pPlayer );
  62. virtual bool AllowAutoTargetCrosshair( void );
  63. virtual int GetAutoAimMode();
  64. // Client kills/scoring
  65. virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled );
  66. virtual void PlayerKilled( CBasePlayer *pVictim, const CTakeDamageInfo &info );
  67. virtual void DeathNotice( CBasePlayer *pVictim, const CTakeDamageInfo &info );
  68. // Weapon spawn/respawn control
  69. virtual int WeaponShouldRespawn( CBaseCombatWeapon *pWeapon );
  70. virtual float FlWeaponRespawnTime( CBaseCombatWeapon *pWeapon );
  71. virtual float FlWeaponTryRespawn( CBaseCombatWeapon *pWeapon );
  72. virtual Vector VecWeaponRespawnSpot( CBaseCombatWeapon *pWeapon );
  73. // Item retrieval
  74. virtual bool CanHaveItem( CBasePlayer *pPlayer, CItem *pItem );
  75. virtual void PlayerGotItem( CBasePlayer *pPlayer, CItem *pItem );
  76. // Item spawn/respawn control
  77. virtual int ItemShouldRespawn( CItem *pItem );
  78. virtual float FlItemRespawnTime( CItem *pItem );
  79. virtual Vector VecItemRespawnSpot( CItem *pItem );
  80. virtual QAngle VecItemRespawnAngles( CItem *pItem );
  81. // Ammo retrieval
  82. virtual void PlayerGotAmmo( CBaseCombatCharacter *pPlayer, char *szName, int iCount );
  83. // Healthcharger respawn control
  84. virtual float FlHealthChargerRechargeTime( void );
  85. // What happens to a dead player's weapons
  86. virtual int DeadPlayerWeapons( CBasePlayer *pPlayer );
  87. // What happens to a dead player's ammo
  88. virtual int DeadPlayerAmmo( CBasePlayer *pPlayer );
  89. // NPCs
  90. virtual bool FAllowNPCs( void );
  91. // Teamplay stuff
  92. virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget );
  93. virtual bool PlayerCanHearChat( CBasePlayer *pListener, CBasePlayer *pSpeaker, bool bTeamOnly );
  94. #endif
  95. };
  96. #endif // SINGLEPLAY_GAMERULES_H