2015-06-30 12:46:07 +03:00
/*
*
* This program is free software ; you can redistribute it and / or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation ; either version 2 of the License , or ( at
* your option ) any later version .
*
* This program is distributed in the hope that it will be useful , but
* WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*
* In addition , as a special exception , the author gives permission to
* link the code of this program with the Half - Life Game Engine ( " HL
* Engine " ) and Modified Game Libraries ( " MODs " ) developed by Valve,
* L . L . C ( " Valve " ) . You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve . If you modify this file , you may extend this exception
* to your version of the file , but you are not obligated to do so . If
* you do not wish to do so , delete this exception statement from your
* version .
*
*/
# pragma once
# include "game_shared/voice_gamemgr.h"
2017-10-12 17:50:56 +03:00
# include "cmdhandler.h"
2015-07-05 14:05:26 +03:00
2017-10-12 17:50:56 +03:00
const int MAX_RULE_BUFFER = 1024 ;
const int MAX_VOTE_MAPS = 100 ;
const int MAX_VIP_QUEUES = 5 ;
2019-04-23 15:54:51 +03:00
const int MAX_MONEY_THRESHOLD = 999999 ; // allowable money limit in the game that can be drawn on the HUD
2015-08-20 13:35:01 +03:00
2017-10-12 17:50:56 +03:00
const int MAX_MOTD_CHUNK = 60 ;
const int MAX_MOTD_LENGTH = 1536 ; // (MAX_MOTD_CHUNK * 4)
2015-08-20 13:35:01 +03:00
2019-07-30 15:30:34 +03:00
const float ITEM_RESPAWN_TIME = 30.0f ;
const float WEAPON_RESPAWN_TIME = 20.0f ;
const float AMMO_RESPAWN_TIME = 20.0f ;
const float ROUND_RESPAWN_TIME = 20.0f ;
const float ROUND_BEGIN_DELAY = 5.0f ; // delay before beginning new round
const float ITEM_KILL_DELAY = 300.0f ;
const float RADIO_TIMEOUT = 1.5f ;
2015-08-20 13:35:01 +03:00
2017-10-12 17:50:56 +03:00
const int MAX_INTERMISSION_TIME = 120 ; // longest the intermission can last, in seconds
2015-08-20 13:35:01 +03:00
2017-10-12 17:50:56 +03:00
// when we are within this close to running out of entities, items
2015-09-16 23:19:21 +03:00
// marked with the ITEM_FLAG_LIMITINWORLD will delay their respawn
2017-10-12 17:50:56 +03:00
const int ENTITY_INTOLERANCE = 100 ;
2015-08-20 13:35:01 +03:00
enum
{
2017-10-12 17:50:56 +03:00
WINSTATUS_NONE = 0 ,
WINSTATUS_CTS ,
2015-08-20 13:35:01 +03:00
WINSTATUS_TERRORISTS ,
WINSTATUS_DRAW ,
} ;
2017-10-12 17:50:56 +03:00
// Custom enum
// Used for EndRoundMessage() logged messages
2016-04-24 16:52:16 +03:00
enum ScenarioEventEndRound
2015-08-20 13:35:01 +03:00
{
2016-04-24 16:52:16 +03:00
ROUND_NONE ,
ROUND_TARGET_BOMB ,
2015-08-20 13:35:01 +03:00
ROUND_VIP_ESCAPED ,
ROUND_VIP_ASSASSINATED ,
ROUND_TERRORISTS_ESCAPED ,
ROUND_CTS_PREVENT_ESCAPE ,
ROUND_ESCAPING_TERRORISTS_NEUTRALIZED ,
ROUND_BOMB_DEFUSED ,
ROUND_CTS_WIN ,
ROUND_TERRORISTS_WIN ,
ROUND_END_DRAW ,
ROUND_ALL_HOSTAGES_RESCUED ,
ROUND_TARGET_SAVED ,
ROUND_HOSTAGE_NOT_RESCUED ,
ROUND_TERRORISTS_NOT_ESCAPED ,
ROUND_VIP_NOT_ESCAPED ,
ROUND_GAME_COMMENCE ,
2016-12-06 22:21:52 +03:00
ROUND_GAME_RESTART ,
ROUND_GAME_OVER
2015-08-20 13:35:01 +03:00
} ;
2016-06-08 00:41:07 +03:00
enum RewardRules
{
RR_CTS_WIN ,
RR_TERRORISTS_WIN ,
RR_TARGET_BOMB ,
RR_VIP_ESCAPED ,
RR_VIP_ASSASSINATED ,
RR_TERRORISTS_ESCAPED ,
RR_CTS_PREVENT_ESCAPE ,
RR_ESCAPING_TERRORISTS_NEUTRALIZED ,
RR_BOMB_DEFUSED ,
RR_BOMB_PLANTED ,
RR_BOMB_EXPLODED ,
RR_ALL_HOSTAGES_RESCUED ,
RR_TARGET_BOMB_SAVED ,
RR_HOSTAGE_NOT_RESCUED ,
RR_VIP_NOT_ESCAPED ,
RR_LOSER_BONUS_DEFAULT ,
RR_LOSER_BONUS_MIN ,
RR_LOSER_BONUS_MAX ,
RR_LOSER_BONUS_ADD ,
RR_RESCUED_HOSTAGE ,
RR_TOOK_HOSTAGE_ACC ,
RR_TOOK_HOSTAGE ,
RR_END
} ;
2015-08-20 13:35:01 +03:00
// custom enum
enum RewardAccount
{
2017-07-01 23:40:10 +03:00
REWARD_TARGET_BOMB = 3500 ,
REWARD_VIP_ESCAPED = 3500 ,
REWARD_VIP_ASSASSINATED = 3250 ,
REWARD_TERRORISTS_ESCAPED = 3150 ,
REWARD_CTS_PREVENT_ESCAPE = 3500 ,
REWARD_ESCAPING_TERRORISTS_NEUTRALIZED = 3250 ,
REWARD_BOMB_DEFUSED = 3250 ,
REWARD_BOMB_PLANTED = 800 ,
REWARD_BOMB_EXPLODED = 3250 ,
REWARD_CTS_WIN = 3000 ,
REWARD_TERRORISTS_WIN = 3000 ,
REWARD_ALL_HOSTAGES_RESCUED = 2500 ,
2015-08-20 13:35:01 +03:00
// the end round was by the expiration time
2017-07-01 23:40:10 +03:00
REWARD_TARGET_BOMB_SAVED = 3250 ,
REWARD_HOSTAGE_NOT_RESCUED = 3250 ,
REWARD_VIP_NOT_ESCAPED = 3250 ,
2015-08-20 13:35:01 +03:00
// loser bonus
2017-07-01 23:40:10 +03:00
REWARD_LOSER_BONUS_DEFAULT = 1400 ,
REWARD_LOSER_BONUS_MIN = 1500 ,
REWARD_LOSER_BONUS_MAX = 3000 ,
REWARD_LOSER_BONUS_ADD = 500 ,
REWARD_RESCUED_HOSTAGE = 750 ,
REWARD_KILLED_ENEMY = 300 ,
REWARD_KILLED_VIP = 2500 ,
REWARD_VIP_HAVE_SELF_RESCUED = 2500 ,
REWARD_TAKEN_HOSTAGE = 1000 ,
REWARD_TOOK_HOSTAGE_ACC = 100 ,
REWARD_TOOK_HOSTAGE = 150 ,
2015-08-20 13:35:01 +03:00
} ;
// custom enum
enum PaybackForBadThing
{
2017-07-01 23:40:10 +03:00
PAYBACK_FOR_KILLED_TEAMMATES = - 3300 ,
2015-08-20 13:35:01 +03:00
} ;
// custom enum
enum InfoMapBuyParam
{
BUYING_EVERYONE = 0 ,
BUYING_ONLY_CTS ,
BUYING_ONLY_TERRORISTS ,
2015-09-16 23:19:21 +03:00
BUYING_NO_ONE ,
2015-08-20 13:35:01 +03:00
} ;
2015-06-30 12:46:07 +03:00
2016-06-18 17:48:19 +03:00
// weapon respawning return codes
2015-09-16 23:19:21 +03:00
enum
{
GR_NONE = 0 ,
2016-06-18 17:48:19 +03:00
2015-09-16 23:19:21 +03:00
GR_WEAPON_RESPAWN_YES ,
GR_WEAPON_RESPAWN_NO ,
2016-06-18 17:48:19 +03:00
2015-09-16 23:19:21 +03:00
GR_AMMO_RESPAWN_YES ,
GR_AMMO_RESPAWN_NO ,
2016-06-18 17:48:19 +03:00
2015-09-16 23:19:21 +03:00
GR_ITEM_RESPAWN_YES ,
GR_ITEM_RESPAWN_NO ,
2016-06-18 17:48:19 +03:00
2015-09-16 23:19:21 +03:00
GR_PLR_DROP_GUN_ALL ,
GR_PLR_DROP_GUN_ACTIVE ,
GR_PLR_DROP_GUN_NO ,
2016-06-18 17:48:19 +03:00
2015-09-16 23:19:21 +03:00
GR_PLR_DROP_AMMO_ALL ,
GR_PLR_DROP_AMMO_ACTIVE ,
GR_PLR_DROP_AMMO_NO ,
2015-06-30 12:46:07 +03:00
} ;
2016-01-28 05:51:34 +03:00
// custom enum
enum
{
2017-10-12 17:50:56 +03:00
SCENARIO_BLOCK_TIME_EXPRIRED = BIT ( 0 ) , // flag "a"
SCENARIO_BLOCK_NEED_PLAYERS = BIT ( 1 ) , // flag "b"
SCENARIO_BLOCK_VIP_ESCAPE = BIT ( 2 ) , // flag "c"
SCENARIO_BLOCK_PRISON_ESCAPE = BIT ( 3 ) , // flag "d"
SCENARIO_BLOCK_BOMB = BIT ( 4 ) , // flag "e"
SCENARIO_BLOCK_TEAM_EXTERMINATION = BIT ( 5 ) , // flag "f"
SCENARIO_BLOCK_HOSTAGE_RESCUE = BIT ( 6 ) , // flag "g"
2016-01-28 05:51:34 +03:00
} ;
2016-06-18 17:48:19 +03:00
// Player relationship return codes
2015-09-16 23:19:21 +03:00
enum
{
GR_NOTTEAMMATE = 0 ,
GR_TEAMMATE ,
GR_ENEMY ,
GR_ALLY ,
GR_NEUTRAL ,
2015-06-30 12:46:07 +03:00
} ;
class CItem ;
class CGameRules
{
public :
2016-06-14 01:13:13 +03:00
CGameRules ( ) ;
virtual ~ CGameRules ( ) ;
2017-07-01 23:40:10 +03:00
virtual void RefreshSkillData ( ) ; // fill skill data struct with proper values
virtual void Think ( ) = 0 ; // runs every server frame, should handle any timer tasks, periodic events, etc.
2016-06-18 17:48:19 +03:00
virtual BOOL IsAllowedToSpawn ( CBaseEntity * pEntity ) = 0 ; // Can this item spawn (eg monsters don't spawn in deathmatch).
2017-07-01 23:40:10 +03:00
virtual BOOL FAllowFlashlight ( ) = 0 ; // Are players allowed to switch on their flashlight?
virtual BOOL FShouldSwitchWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) = 0 ; // should the player switch to this weapon?
virtual BOOL GetNextBestWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pCurrentWeapon ) = 0 ; // I can't use this weapon anymore, get me the next best one.
2016-06-18 17:48:19 +03:00
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer ( ) = 0 ; // is this a multiplayer game? (either coop or deathmatch)
virtual BOOL IsDeathmatch ( ) = 0 ; // is this a deathmatch game?
2017-07-01 23:40:10 +03:00
virtual BOOL IsTeamplay ( ) { return FALSE ; } // is this deathmatch game being played with team rules?
virtual BOOL IsCoOp ( ) = 0 ; // is this a coop game?
virtual const char * GetGameDescription ( ) ; // this is the game name that gets seen in the server browser
2016-06-18 17:48:19 +03:00
// Client connection/disconnection
virtual BOOL ClientConnected ( edict_t * pEntity , const char * pszName , const char * pszAddress , char * szRejectReason ) = 0 ; // a client just connected to the server (player hasn't spawned yet)
virtual void InitHUD ( CBasePlayer * pl ) = 0 ; // the client dll is ready for updating
2017-07-01 23:40:10 +03:00
virtual void ClientDisconnected ( edict_t * pClient ) = 0 ; // a client just disconnected from the server
virtual void UpdateGameMode ( CBasePlayer * pPlayer ) { } ; // the client needs to be informed of the current game mode
2016-06-18 17:48:19 +03:00
// Client damage rules
2015-06-30 12:46:07 +03:00
virtual float FlPlayerFallDamage ( CBasePlayer * pPlayer ) = 0 ;
2017-07-01 23:40:10 +03:00
virtual BOOL FPlayerCanTakeDamage ( CBasePlayer * pPlayer , CBaseEntity * pAttacker ) { return TRUE ; } // can this player take damage from this attacker?
2016-01-28 07:48:09 +03:00
virtual BOOL ShouldAutoAim ( CBasePlayer * pPlayer , edict_t * target ) { return TRUE ; }
2016-06-18 17:48:19 +03:00
// Client spawn/respawn control
virtual void PlayerSpawn ( CBasePlayer * pPlayer ) = 0 ; // called by CBasePlayer::Spawn just before releasing player into the game
virtual void PlayerThink ( CBasePlayer * pPlayer ) = 0 ; // called by CBasePlayer::PreThink every frame, before physics are run and after keys are accepted
2017-07-01 23:40:10 +03:00
virtual BOOL FPlayerCanRespawn ( CBasePlayer * pPlayer ) = 0 ; // is this player allowed to respawn now?
virtual float FlPlayerSpawnTime ( CBasePlayer * pPlayer ) = 0 ; // When in the future will this player be able to spawn?
virtual edict_t * GetPlayerSpawnSpot ( CBasePlayer * pPlayer ) ; // Place this player on their spawnspot and face them the proper direction.
2016-06-18 17:48:19 +03:00
2016-01-28 07:48:09 +03:00
virtual BOOL AllowAutoTargetCrosshair ( ) { return TRUE ; }
virtual BOOL ClientCommand_DeadOrAlive ( CBasePlayer * pPlayer , const char * pcmd ) { return FALSE ; }
2017-07-01 23:40:10 +03:00
virtual BOOL ClientCommand ( CBasePlayer * pPlayer , const char * pcmd ) { return FALSE ; } // handles the user commands; returns TRUE if command handled properly
2016-06-18 17:48:19 +03:00
virtual void ClientUserInfoChanged ( CBasePlayer * pPlayer , char * infobuffer ) { } ; // the player has changed userinfo; can change it now
// Client kills/scoring
virtual int IPointsForKill ( CBasePlayer * pAttacker , CBasePlayer * pKilled ) = 0 ; // how many points do I award whoever kills this player?
2017-07-01 23:40:10 +03:00
virtual void PlayerKilled ( CBasePlayer * pVictim , entvars_t * pKiller , entvars_t * pInflictor ) = 0 ; // Called each time a player dies
virtual void DeathNotice ( CBasePlayer * pVictim , entvars_t * pKiller , entvars_t * pevInflictor ) = 0 ; // Call this from within a GameRules class to report an obituary.
2016-06-18 17:48:19 +03:00
// Weapon retrieval
virtual BOOL CanHavePlayerItem ( CBasePlayer * pPlayer , CBasePlayerItem * pItem ) ; // The player is touching an CBasePlayerItem, do I give it to him?
virtual void PlayerGotWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) = 0 ; // Called each time a player picks up a weapon from the ground
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn ( CBasePlayerItem * pWeapon ) = 0 ; // should this weapon respawn?
virtual float FlWeaponRespawnTime ( CBasePlayerItem * pWeapon ) = 0 ; // when may this weapon respawn?
virtual float FlWeaponTryRespawn ( CBasePlayerItem * pWeapon ) = 0 ; // can i respawn now, and if not, when should i try again?
virtual Vector VecWeaponRespawnSpot ( CBasePlayerItem * pWeapon ) = 0 ; // where in the world should this weapon respawn?
// Item retrieval
virtual BOOL CanHaveItem ( CBasePlayer * pPlayer , CItem * pItem ) = 0 ; // is this player allowed to take this item?
virtual void PlayerGotItem ( CBasePlayer * pPlayer , CItem * pItem ) = 0 ; // call each time a player picks up an item (battery, healthkit, longjump)
// Item spawn/respawn control
2017-07-01 23:40:10 +03:00
virtual int ItemShouldRespawn ( CItem * pItem ) = 0 ; // Should this item respawn?
virtual float FlItemRespawnTime ( CItem * pItem ) = 0 ; // when may this item respawn?
2016-06-18 17:48:19 +03:00
virtual Vector VecItemRespawnSpot ( CItem * pItem ) = 0 ; // where in the world should this item respawn?
// Ammo retrieval
2017-07-01 23:40:10 +03:00
virtual BOOL CanHaveAmmo ( CBasePlayer * pPlayer , const char * pszAmmoName , int iMaxCarry ) ; // can this player take more of this ammo?
virtual void PlayerGotAmmo ( CBasePlayer * pPlayer , char * szName , int iCount ) = 0 ; // called each time a player picks up some ammo in the world
2016-06-18 17:48:19 +03:00
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn ( CBasePlayerAmmo * pAmmo ) = 0 ; // should this ammo item respawn?
2017-07-01 23:40:10 +03:00
virtual float FlAmmoRespawnTime ( CBasePlayerAmmo * pAmmo ) = 0 ; // when should this ammo item respawn?
virtual Vector VecAmmoRespawnSpot ( CBasePlayerAmmo * pAmmo ) = 0 ; // where in the world should this ammo item respawn?
2016-06-18 17:48:19 +03:00
// Healthcharger respawn control
2017-07-01 23:40:10 +03:00
virtual float FlHealthChargerRechargeTime ( ) = 0 ; // how long until a depleted HealthCharger recharges itself?
2016-06-18 17:48:19 +03:00
virtual float FlHEVChargerRechargeTime ( ) { return 0.0f ; } // how long until a depleted HealthCharger recharges itself?
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons ( CBasePlayer * pPlayer ) = 0 ; // what do I do with a player's weapons when he's killed?
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo ( CBasePlayer * pPlayer ) = 0 ; // Do I drop ammo when the player dies? How much?
// Teamplay stuff
virtual const char * GetTeamID ( CBaseEntity * pEntity ) = 0 ; // what team is this entity on?
2017-07-01 23:40:10 +03:00
virtual int PlayerRelationship ( CBasePlayer * pPlayer , CBaseEntity * pTarget ) = 0 ; // What is the player's relationship with this entity?
2016-01-28 07:48:09 +03:00
virtual int GetTeamIndex ( const char * pTeamName ) { return - 1 ; }
virtual const char * GetIndexedTeamName ( int teamIndex ) { return " " ; }
virtual BOOL IsValidTeam ( const char * pTeamName ) { return TRUE ; }
2015-09-16 23:19:21 +03:00
virtual void ChangePlayerTeam ( CBasePlayer * pPlayer , const char * pTeamName , BOOL bKill , BOOL bGib ) { } ;
2016-01-28 07:48:09 +03:00
virtual const char * SetDefaultPlayerTeam ( CBasePlayer * pPlayer ) { return " " ; }
2016-06-18 17:48:19 +03:00
// Sounds
2016-01-28 07:48:09 +03:00
virtual BOOL PlayTextureSounds ( ) { return TRUE ; }
2016-06-18 17:48:19 +03:00
// Monsters
virtual BOOL FAllowMonsters ( ) = 0 ; // are monsters allowed
// Immediately end a multiplayer game
2016-01-28 07:48:09 +03:00
virtual void EndMultiplayerGame ( ) { } ;
2015-09-30 03:49:22 +03:00
// Stuff that is shared between client and server.
2016-01-28 07:48:09 +03:00
virtual BOOL IsFreezePeriod ( ) { return m_bFreezePeriod ; }
virtual void ServerDeactivate ( ) { } ;
virtual void CheckMapConditions ( ) { } ;
2015-06-30 12:46:07 +03:00
2016-12-06 22:21:52 +03:00
// inline function's
inline bool IsGameOver ( ) const { return m_bGameOver ; }
inline void SetGameOver ( ) { m_bGameOver = true ; }
2017-11-13 01:20:08 +03:00
static float GetItemKillDelay ( ) ;
2019-07-30 15:30:34 +03:00
static float GetRadioTimeout ( ) ;
2016-12-06 22:21:52 +03:00
2015-06-30 12:46:07 +03:00
public :
2017-07-01 23:40:10 +03:00
BOOL m_bFreezePeriod ; // TRUE at beginning of round, set to FALSE when the period expires
2015-06-30 12:46:07 +03:00
BOOL m_bBombDropped ;
2016-06-14 01:13:13 +03:00
// custom
2017-10-19 20:12:02 +03:00
char * m_GameDesc ;
bool m_bGameOver ; // intermission or finale (deprecated name g_fGameOver)
2016-02-04 03:18:26 +03:00
} ;
2015-06-30 12:46:07 +03:00
2016-06-18 17:48:19 +03:00
// CHalfLifeRules - rules for the single player Half-Life game.
2015-06-30 12:46:07 +03:00
class CHalfLifeRules : public CGameRules
{
public :
2016-01-28 07:48:09 +03:00
CHalfLifeRules ( ) ;
2016-06-14 01:13:13 +03:00
virtual ~ CHalfLifeRules ( ) { } ;
2015-08-20 13:35:01 +03:00
2016-01-28 07:48:09 +03:00
virtual void Think ( ) ;
2015-06-30 12:46:07 +03:00
virtual BOOL IsAllowedToSpawn ( CBaseEntity * pEntity ) ;
2016-01-28 07:48:09 +03:00
virtual BOOL FAllowFlashlight ( ) { return TRUE ; }
2016-06-18 17:48:19 +03:00
2015-06-30 12:46:07 +03:00
virtual BOOL FShouldSwitchWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) ;
virtual BOOL GetNextBestWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pCurrentWeapon ) ;
2016-06-18 17:48:19 +03:00
// Functions to verify the single/multiplayer status of a game
2016-01-28 07:48:09 +03:00
virtual BOOL IsMultiplayer ( ) ;
virtual BOOL IsDeathmatch ( ) ;
virtual BOOL IsCoOp ( ) ;
2016-06-18 17:48:19 +03:00
// Client connection/disconnection
2015-06-30 12:46:07 +03:00
virtual BOOL ClientConnected ( edict_t * pEntity , const char * pszName , const char * pszAddress , char szRejectReason [ 128 ] ) ;
2016-06-18 17:48:19 +03:00
virtual void InitHUD ( CBasePlayer * pl ) ; // the client dll is ready for updating
2015-06-30 12:46:07 +03:00
virtual void ClientDisconnected ( edict_t * pClient ) ;
2016-06-18 17:48:19 +03:00
// Client damage rules
2015-06-30 12:46:07 +03:00
virtual float FlPlayerFallDamage ( CBasePlayer * pPlayer ) ;
2016-06-18 17:48:19 +03:00
// Client spawn/respawn control
2015-06-30 12:46:07 +03:00
virtual void PlayerSpawn ( CBasePlayer * pPlayer ) ;
virtual void PlayerThink ( CBasePlayer * pPlayer ) ;
virtual BOOL FPlayerCanRespawn ( CBasePlayer * pPlayer ) ;
virtual float FlPlayerSpawnTime ( CBasePlayer * pPlayer ) ;
virtual edict_t * GetPlayerSpawnSpot ( CBasePlayer * pPlayer ) ;
2016-06-18 17:48:19 +03:00
2016-01-28 07:48:09 +03:00
virtual BOOL AllowAutoTargetCrosshair ( ) ;
2016-06-18 17:48:19 +03:00
// Client kills/scoring
2015-06-30 12:46:07 +03:00
virtual int IPointsForKill ( CBasePlayer * pAttacker , CBasePlayer * pKilled ) ;
virtual void PlayerKilled ( CBasePlayer * pVictim , entvars_t * pKiller , entvars_t * pInflictor ) ;
virtual void DeathNotice ( CBasePlayer * pVictim , entvars_t * pKiller , entvars_t * pInflictor ) ;
2016-06-18 17:48:19 +03:00
// Weapon retrieval
2015-06-30 12:46:07 +03:00
virtual void PlayerGotWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) ;
2016-06-18 17:48:19 +03:00
// Weapon spawn/respawn control
2015-06-30 12:46:07 +03:00
virtual int WeaponShouldRespawn ( CBasePlayerItem * pWeapon ) ;
virtual float FlWeaponRespawnTime ( CBasePlayerItem * pWeapon ) ;
virtual float FlWeaponTryRespawn ( CBasePlayerItem * pWeapon ) ;
virtual Vector VecWeaponRespawnSpot ( CBasePlayerItem * pWeapon ) ;
2016-06-18 17:48:19 +03:00
// Item retrieval
2015-06-30 12:46:07 +03:00
virtual BOOL CanHaveItem ( CBasePlayer * pPlayer , CItem * pItem ) ;
virtual void PlayerGotItem ( CBasePlayer * pPlayer , CItem * pItem ) ;
2016-06-18 17:48:19 +03:00
// Item spawn/respawn control
2015-06-30 12:46:07 +03:00
virtual int ItemShouldRespawn ( CItem * pItem ) ;
virtual float FlItemRespawnTime ( CItem * pItem ) ;
virtual Vector VecItemRespawnSpot ( CItem * pItem ) ;
2016-06-18 17:48:19 +03:00
// Ammo retrieval
2015-06-30 12:46:07 +03:00
virtual void PlayerGotAmmo ( CBasePlayer * pPlayer , char * szName , int iCount ) ;
2016-06-18 17:48:19 +03:00
// Ammo spawn/respawn control
2015-06-30 12:46:07 +03:00
virtual int AmmoShouldRespawn ( CBasePlayerAmmo * pAmmo ) ;
virtual float FlAmmoRespawnTime ( CBasePlayerAmmo * pAmmo ) ;
virtual Vector VecAmmoRespawnSpot ( CBasePlayerAmmo * pAmmo ) ;
2016-06-18 17:48:19 +03:00
// Healthcharger respawn control
2016-01-28 07:48:09 +03:00
virtual float FlHealthChargerRechargeTime ( ) ;
2016-06-18 17:48:19 +03:00
// What happens to a dead player's weapons
2015-06-30 12:46:07 +03:00
virtual int DeadPlayerWeapons ( CBasePlayer * pPlayer ) ;
2016-06-18 17:48:19 +03:00
// What happens to a dead player's ammo
2015-06-30 12:46:07 +03:00
virtual int DeadPlayerAmmo ( CBasePlayer * pPlayer ) ;
2016-06-18 17:48:19 +03:00
// Teamplay stuff
2016-01-28 07:48:09 +03:00
virtual const char * GetTeamID ( CBaseEntity * pEntity ) { return " " ; } ;
2015-06-30 12:46:07 +03:00
virtual int PlayerRelationship ( CBasePlayer * pPlayer , CBaseEntity * pTarget ) ;
2016-06-18 17:48:19 +03:00
// Monsters
2016-01-28 07:48:09 +03:00
virtual BOOL FAllowMonsters ( ) ;
2016-02-04 03:18:26 +03:00
} ;
2015-06-30 12:46:07 +03:00
2016-06-18 17:48:19 +03:00
// CHalfLifeMultiplay - rules for the basic half life multiplayer competition
2015-06-30 12:46:07 +03:00
class CHalfLifeMultiplay : public CGameRules
{
public :
2016-01-28 07:48:09 +03:00
CHalfLifeMultiplay ( ) ;
2016-06-14 01:13:13 +03:00
virtual ~ CHalfLifeMultiplay ( ) { } ;
2016-01-28 07:48:09 +03:00
virtual void RefreshSkillData ( ) ;
virtual void Think ( ) ;
2015-08-20 13:35:01 +03:00
virtual BOOL IsAllowedToSpawn ( CBaseEntity * pEntity ) ;
2016-01-28 07:48:09 +03:00
virtual BOOL FAllowFlashlight ( ) ;
2016-06-18 17:48:19 +03:00
2015-06-30 12:46:07 +03:00
virtual BOOL FShouldSwitchWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) ;
virtual BOOL GetNextBestWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pCurrentWeapon ) ;
2016-06-18 17:48:19 +03:00
2016-01-28 07:48:09 +03:00
virtual BOOL IsMultiplayer ( ) ;
virtual BOOL IsDeathmatch ( ) ;
virtual BOOL IsCoOp ( ) ;
2016-06-18 17:48:19 +03:00
// Client connection/disconnection
// If ClientConnected returns FALSE, the connection is rejected and the user is provided the reason specified in szRejectReason
// Only the client's name and remote address are provided to the dll for verification.
2015-08-20 13:35:01 +03:00
virtual BOOL ClientConnected ( edict_t * pEntity , const char * pszName , const char * pszAddress , char szRejectReason [ 128 ] ) ;
2016-06-18 17:48:19 +03:00
virtual void InitHUD ( CBasePlayer * pl ) ; // the client dll is ready for updating
2015-08-20 13:35:01 +03:00
virtual void ClientDisconnected ( edict_t * pClient ) ;
2017-07-01 23:40:10 +03:00
virtual void UpdateGameMode ( CBasePlayer * pPlayer ) ; // the client needs to be informed of the current game mode
2016-06-18 17:48:19 +03:00
// Client damage rules
2015-08-02 20:45:57 +03:00
virtual float FlPlayerFallDamage ( CBasePlayer * pPlayer ) ;
2015-08-20 13:35:01 +03:00
virtual BOOL FPlayerCanTakeDamage ( CBasePlayer * pPlayer , CBaseEntity * pAttacker ) ;
2016-06-18 17:48:19 +03:00
// Client spawn/respawn control
2015-08-20 13:35:01 +03:00
virtual void PlayerSpawn ( CBasePlayer * pPlayer ) ;
virtual void PlayerThink ( CBasePlayer * pPlayer ) ;
virtual BOOL FPlayerCanRespawn ( CBasePlayer * pPlayer ) ;
virtual float FlPlayerSpawnTime ( CBasePlayer * pPlayer ) ;
virtual edict_t * GetPlayerSpawnSpot ( CBasePlayer * pPlayer ) ;
2016-06-18 17:48:19 +03:00
2016-01-28 07:48:09 +03:00
virtual BOOL AllowAutoTargetCrosshair ( ) ;
2015-08-20 13:35:01 +03:00
virtual BOOL ClientCommand_DeadOrAlive ( CBasePlayer * pPlayer , const char * pcmd ) ;
virtual BOOL ClientCommand ( CBasePlayer * pPlayer , const char * pcmd ) ;
virtual void ClientUserInfoChanged ( CBasePlayer * pPlayer , char * infobuffer ) ;
2016-06-18 17:48:19 +03:00
// Client kills/scoring
2015-08-20 13:35:01 +03:00
virtual int IPointsForKill ( CBasePlayer * pAttacker , CBasePlayer * pKilled ) ;
virtual void PlayerKilled ( CBasePlayer * pVictim , entvars_t * pKiller , entvars_t * pInflictor ) ;
virtual void DeathNotice ( CBasePlayer * pVictim , entvars_t * pKiller , entvars_t * pInflictor ) ;
2016-06-18 17:48:19 +03:00
// Weapon retrieval
virtual BOOL CanHavePlayerItem ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) ; // The player is touching an CBasePlayerItem, do I give it to him?
2015-06-30 12:46:07 +03:00
virtual void PlayerGotWeapon ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) ;
2016-06-18 17:48:19 +03:00
// Weapon spawn/respawn control
2015-06-30 12:46:07 +03:00
virtual int WeaponShouldRespawn ( CBasePlayerItem * pWeapon ) ;
2015-08-20 13:35:01 +03:00
virtual float FlWeaponRespawnTime ( CBasePlayerItem * pWeapon ) ;
virtual float FlWeaponTryRespawn ( CBasePlayerItem * pWeapon ) ;
virtual Vector VecWeaponRespawnSpot ( CBasePlayerItem * pWeapon ) ;
2016-06-18 17:48:19 +03:00
// Item retrieval
2015-06-30 12:46:07 +03:00
virtual BOOL CanHaveItem ( CBasePlayer * pPlayer , CItem * pItem ) ;
virtual void PlayerGotItem ( CBasePlayer * pPlayer , CItem * pItem ) ;
2016-06-18 17:48:19 +03:00
// Item spawn/respawn control
2015-06-30 12:46:07 +03:00
virtual int ItemShouldRespawn ( CItem * pItem ) ;
virtual float FlItemRespawnTime ( CItem * pItem ) ;
virtual Vector VecItemRespawnSpot ( CItem * pItem ) ;
2016-06-18 17:48:19 +03:00
// Ammo retrieval
2015-08-20 13:35:01 +03:00
virtual void PlayerGotAmmo ( CBasePlayer * pPlayer , char * szName , int iCount ) ;
2016-06-18 17:48:19 +03:00
// Ammo spawn/respawn control
2015-06-30 12:46:07 +03:00
virtual int AmmoShouldRespawn ( CBasePlayerAmmo * pAmmo ) ;
virtual float FlAmmoRespawnTime ( CBasePlayerAmmo * pAmmo ) ;
virtual Vector VecAmmoRespawnSpot ( CBasePlayerAmmo * pAmmo ) ;
2016-06-18 17:48:19 +03:00
// Healthcharger respawn control
2016-01-28 07:48:09 +03:00
virtual float FlHealthChargerRechargeTime ( ) ;
virtual float FlHEVChargerRechargeTime ( ) ;
2016-06-18 17:48:19 +03:00
// What happens to a dead player's weapons
2015-08-20 13:35:01 +03:00
virtual int DeadPlayerWeapons ( CBasePlayer * pPlayer ) ;
2016-06-18 17:48:19 +03:00
// What happens to a dead player's ammo
2015-08-20 13:35:01 +03:00
virtual int DeadPlayerAmmo ( CBasePlayer * pPlayer ) ;
2016-06-18 17:48:19 +03:00
// Teamplay stuff
2016-01-28 07:48:09 +03:00
virtual const char * GetTeamID ( CBaseEntity * pEntity ) { return " " ; }
2015-08-20 13:35:01 +03:00
virtual int PlayerRelationship ( CBasePlayer * pPlayer , CBaseEntity * pTarget ) ;
2017-10-12 17:50:56 +03:00
virtual void ChangePlayerTeam ( CBasePlayer * pPlayer , const char * pTeamName , BOOL bKill , BOOL bGib ) ;
2016-06-18 17:48:19 +03:00
2016-02-23 02:13:52 +03:00
virtual BOOL PlayTextureSounds ( ) { return FALSE ; }
2016-06-18 17:48:19 +03:00
// Monsters
2016-01-28 07:48:09 +03:00
virtual BOOL FAllowMonsters ( ) ;
2016-06-18 17:48:19 +03:00
// Immediately end a multiplayer game
2016-02-23 02:13:52 +03:00
virtual void EndMultiplayerGame ( ) { GoToIntermission ( ) ; }
2016-01-28 07:48:09 +03:00
virtual void ServerDeactivate ( ) ;
virtual void CheckMapConditions ( ) ;
2015-09-30 03:49:22 +03:00
// Recreate all the map entities from the map data (preserving their indices),
// then remove everything else except the players.
// Also get rid of all world decals.
2016-01-28 07:48:09 +03:00
virtual void CleanUpMap ( ) ;
virtual void RestartRound ( ) ;
2016-01-19 14:54:31 +03:00
// check if the scenario has been won/lost
2016-01-28 07:48:09 +03:00
virtual void CheckWinConditions ( ) ;
virtual void RemoveGuns ( ) ;
virtual void GiveC4 ( ) ;
virtual void ChangeLevel ( ) ;
virtual void GoToIntermission ( ) ;
2015-06-30 12:46:07 +03:00
2017-07-01 23:40:10 +03:00
# ifdef REGAMEDLL_API
BOOL FShouldSwitchWeapon_OrigFunc ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) ;
BOOL GetNextBestWeapon_OrigFunc ( CBasePlayer * pPlayer , CBasePlayerItem * pCurrentWeapon ) ;
float FlPlayerFallDamage_OrigFunc ( CBasePlayer * pPlayer ) ;
BOOL FPlayerCanTakeDamage_OrigFunc ( CBasePlayer * pPlayer , CBaseEntity * pAttacker ) ;
void PlayerSpawn_OrigFunc ( CBasePlayer * pPlayer ) ;
BOOL FPlayerCanRespawn_OrigFunc ( CBasePlayer * pPlayer ) ;
edict_t * GetPlayerSpawnSpot_OrigFunc ( CBasePlayer * pPlayer ) ;
void ClientUserInfoChanged_OrigFunc ( CBasePlayer * pPlayer , char * infobuffer ) ;
void PlayerKilled_OrigFunc ( CBasePlayer * pVictim , entvars_t * pKiller , entvars_t * pInflictor ) ;
void DeathNotice_OrigFunc ( CBasePlayer * pVictim , entvars_t * pKiller , entvars_t * pInflictor ) ;
BOOL CanHavePlayerItem_OrigFunc ( CBasePlayer * pPlayer , CBasePlayerItem * pWeapon ) ;
int DeadPlayerWeapons_OrigFunc ( CBasePlayer * pPlayer ) ;
void ServerDeactivate_OrigFunc ( ) ;
void CheckMapConditions_OrigFunc ( ) ;
void CleanUpMap_OrigFunc ( ) ;
void RestartRound_OrigFunc ( ) ;
void CheckWinConditions_OrigFunc ( ) ;
void RemoveGuns_OrigFunc ( ) ;
void GiveC4_OrigFunc ( ) ;
void ChangeLevel_OrigFunc ( ) ;
void GoToIntermission_OrigFunc ( ) ;
void BalanceTeams_OrigFunc ( ) ;
2016-05-17 21:01:46 +03:00
# endif
2015-06-30 12:46:07 +03:00
public :
2016-06-02 01:08:22 +03:00
void ServerActivate ( ) ;
void ReadMultiplayCvars ( ) ;
2015-09-30 03:49:22 +03:00
// Checks if it still needs players to start a round, or if it has enough players to start rounds.
// Starts a round and returns true if there are enough players.
2016-04-24 16:52:16 +03:00
bool NeededPlayersCheck ( ) ;
2015-09-30 03:49:22 +03:00
// Setup counts for m_iNumTerrorist, m_iNumCT, m_iNumSpawnableTerrorist, m_iNumSpawnableCT, etc.
2016-06-08 00:41:07 +03:00
VFUNC void InitializePlayerCounts ( int & NumAliveTerrorist , int & NumAliveCT , int & NumDeadTerrorist , int & NumDeadCT ) ;
2015-09-30 03:49:22 +03:00
// Check to see if the round is over for the various game types. Terminates the round
// and returns true if the round should end.
2016-04-24 16:52:16 +03:00
bool PrisonRoundEndCheck ( int NumAliveTerrorist , int NumAliveCT , int NumDeadTerrorist , int NumDeadCT ) ;
bool BombRoundEndCheck ( ) ;
bool HostageRescueRoundEndCheck ( ) ;
bool VIPRoundEndCheck ( ) ;
2015-09-30 03:49:22 +03:00
// Check to see if the teams exterminated each other. Ends the round and returns true if so.
2016-04-24 16:52:16 +03:00
bool TeamExterminationCheck ( int NumAliveTerrorist , int NumAliveCT , int NumDeadTerrorist , int NumDeadCT ) ;
// for internal functions API
2016-12-06 22:21:52 +03:00
void OnRoundFreezeEnd ( ) ;
2017-10-12 17:50:56 +03:00
bool OnRoundEnd ( int winStatus , ScenarioEventEndRound event , float tmDelay ) ;
bool OnRoundEnd_Intercept ( int winStatus , ScenarioEventEndRound event , float tmDelay ) ;
2016-12-06 22:21:52 +03:00
2017-10-12 17:50:56 +03:00
bool RoundOver ( float tmDelay ) ;
bool NeededPlayersCheck ( float tmDelay ) ;
bool RestartRoundCheck ( float tmDelay ) ;
2016-04-24 16:52:16 +03:00
2017-10-12 17:50:56 +03:00
bool VIP_Escaped ( float tmDelay ) ;
bool VIP_Died ( float tmDelay ) ;
bool VIP_NotEscaped ( float tmDelay ) ;
2016-04-24 16:52:16 +03:00
2017-10-12 17:50:56 +03:00
bool Prison_Escaped ( float tmDelay ) ;
bool Prison_PreventEscape ( float tmDelay ) ;
bool Prison_NotEscaped ( float tmDelay ) ;
bool Prison_Neutralized ( float tmDelay ) ;
2016-04-24 16:52:16 +03:00
2017-10-12 17:50:56 +03:00
bool Target_Bombed ( float tmDelay ) ;
bool Target_Saved ( float tmDelay ) ;
bool Target_Defused ( float tmDelay ) ;
2016-04-24 16:52:16 +03:00
// Team extermination
2017-10-12 17:50:56 +03:00
bool Round_Cts ( float tmDelay ) ;
bool Round_Ts ( float tmDelay ) ;
bool Round_Draw ( float tmDelay ) ;
2016-04-24 16:52:16 +03:00
2017-10-12 17:50:56 +03:00
bool Hostage_Rescue ( float tmDelay ) ;
bool Hostage_NotRescued ( float tmDelay ) ;
2015-09-30 03:49:22 +03:00
// Check various conditions to end the map.
2016-01-28 07:48:09 +03:00
bool CheckGameOver ( ) ;
bool CheckTimeLimit ( ) ;
2016-10-05 18:27:50 +03:00
bool CheckFragLimit ( ) ;
2016-01-28 07:48:09 +03:00
bool CheckMaxRounds ( ) ;
bool CheckWinLimit ( ) ;
2015-09-30 03:49:22 +03:00
2016-01-28 07:48:09 +03:00
void CheckFreezePeriodExpired ( ) ;
void CheckRoundTimeExpired ( ) ;
2015-09-30 03:49:22 +03:00
2016-01-28 07:48:09 +03:00
void CheckLevelInitialized ( ) ;
void CheckRestartRound ( ) ;
2015-09-30 03:49:22 +03:00
2016-01-28 07:48:09 +03:00
BOOL IsCareer ( ) ;
2015-08-20 13:35:01 +03:00
void QueueCareerRoundEndMenu ( float tmDelay , int iWinStatus ) ;
void SetCareerMatchLimit ( int minWins , int winDifference ) ;
2016-01-28 07:48:09 +03:00
bool IsInCareerRound ( ) ;
void CareerRestart ( ) ;
2016-06-15 12:26:46 +03:00
bool ShouldSkipShowMenu ( ) const { return m_bSkipShowMenu ; }
void MarkShowMenuSkipped ( ) { m_bSkipShowMenu = false ; }
2016-01-28 07:48:09 +03:00
bool ShouldSkipSpawn ( ) const { return m_bSkipSpawn ; }
void MarkSpawnSkipped ( ) { m_bSkipSpawn = false ; }
2016-02-23 02:13:52 +03:00
void PlayerJoinedTeam ( CBasePlayer * pPlayer ) { }
2016-10-05 18:27:50 +03:00
float GetRoundRemainingTime ( ) const { return m_iRoundTimeSecs - gpGlobals - > time + m_fRoundStartTime ; }
2016-12-10 21:27:53 +03:00
float GetRoundRemainingTimeReal ( ) const ;
2016-10-05 18:27:50 +03:00
float GetTimeLeft ( ) const { return m_flTimeLimit - gpGlobals - > time ; }
2019-06-21 22:57:09 +03:00
float GetRoundElapsedTime ( ) const { return gpGlobals - > time - m_fRoundStartTime ; }
2019-06-21 23:10:59 +03:00
float GetMapElapsedTime ( ) const { return gpGlobals - > time ; }
2016-10-05 18:27:50 +03:00
2015-08-20 13:35:01 +03:00
BOOL TeamFull ( int team_id ) ;
2015-08-02 20:45:57 +03:00
BOOL TeamStacked ( int newTeam_id , int curTeam_id ) ;
2016-01-28 07:48:09 +03:00
bool IsVIPQueueEmpty ( ) ;
2015-08-20 13:35:01 +03:00
bool AddToVIPQueue ( CBasePlayer * toAdd ) ;
2015-09-30 03:49:22 +03:00
// VIP FUNCTIONS
2016-01-28 07:48:09 +03:00
void PickNextVIP ( ) ;
void StackVIPQueue ( ) ;
void ResetCurrentVIP ( ) ;
2015-09-30 03:49:22 +03:00
2016-06-08 00:41:07 +03:00
VFUNC void BalanceTeams ( ) ;
VFUNC void SwapAllPlayers ( ) ;
VFUNC void UpdateTeamScores ( ) ;
2018-05-22 12:29:08 +03:00
VFUNC void EndRoundMessage ( const char * sentence , ScenarioEventEndRound event ) ;
2016-06-08 00:41:07 +03:00
VFUNC void SetAccountRules ( RewardRules rules , int amount ) { m_rgRewardAccountRules [ rules ] = static_cast < RewardAccount > ( amount ) ; }
2016-06-14 01:13:13 +03:00
VFUNC RewardAccount GetAccountRules ( RewardRules rules ) const { return m_rgRewardAccountRules [ rules ] ; }
2016-06-08 00:41:07 +03:00
2017-11-22 20:27:55 +03:00
void DisplayMaps ( CBasePlayer * pPlayer , int iVote ) ;
2016-01-28 07:48:09 +03:00
void ResetAllMapVotes ( ) ;
2017-11-22 20:27:55 +03:00
void ProcessMapVote ( CBasePlayer * pPlayer , int iVote ) ;
2015-09-30 03:49:22 +03:00
// BOMB MAP FUNCTIONS
2016-06-08 00:41:07 +03:00
VFUNC BOOL IsThereABomber ( ) ;
VFUNC BOOL IsThereABomb ( ) ;
2016-06-15 16:10:40 +03:00
VFUNC TeamName SelectDefaultTeam ( ) ;
2015-09-30 03:49:22 +03:00
2016-10-05 18:27:50 +03:00
bool IsMatchStarted ( ) { return ( m_flRestartRoundTime ! = 0.0f | | m_fCareerRoundMenuTime ! = 0.0f | | m_fCareerMatchMenuTime ! = 0.0f ) ; }
2015-08-20 13:35:01 +03:00
void SendMOTDToClient ( edict_t * client ) ;
2016-05-23 01:51:21 +03:00
void TerminateRound ( float tmDelay , int iWinStatus ) ;
float GetRoundRespawnTime ( ) const ;
2017-05-04 01:45:36 +03:00
float GetRoundRestartDelay ( ) const ;
2016-05-01 17:33:54 +03:00
2019-06-21 22:57:09 +03:00
bool IsGameStarted ( ) const { return m_bGameStarted ; }
2016-06-14 18:00:27 +03:00
// has a style of gameplay when aren't any teams
bool IsFreeForAll ( ) const ;
2017-11-11 15:30:31 +03:00
bool CanPlayerBuy ( CBasePlayer * pPlayer ) const ;
2016-03-17 20:44:52 +03:00
2016-06-08 00:41:07 +03:00
VFUNC bool HasRoundTimeExpired ( ) ;
VFUNC bool IsBombPlanted ( ) ;
2016-12-06 22:21:52 +03:00
private :
2015-08-20 13:35:01 +03:00
void MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound ( int iTeam ) ;
2015-06-30 12:46:07 +03:00
public :
2017-08-19 20:13:45 +03:00
static RewardAccount m_rgRewardAccountRules [ RR_END ] ;
2017-11-04 02:16:30 +03:00
static RewardAccount m_rgRewardAccountRules_default [ RR_END ] ;
2016-06-08 00:41:07 +03:00
2015-06-30 12:46:07 +03:00
CVoiceGameMgr m_VoiceGameMgr ;
2016-10-05 18:27:50 +03:00
float m_flRestartRoundTime ; // The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount)
2015-06-30 12:46:07 +03:00
float m_flCheckWinConditions ;
2016-10-05 18:27:50 +03:00
float m_fRoundStartTime ; // Time round has started (deprecated name m_fRoundCount)
2017-07-01 23:40:10 +03:00
int m_iRoundTime ; // (From mp_roundtime) - How many seconds long this round is.
2015-06-30 12:46:07 +03:00
int m_iRoundTimeSecs ;
2015-09-30 03:49:22 +03:00
int m_iIntroRoundTime ; // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is.
2017-07-01 23:40:10 +03:00
float m_fRoundStartTimeReal ; // The global time when the intro round ends and the real one starts
// wrote the original "m_flRoundTime" comment for this variable).
2015-06-30 12:46:07 +03:00
int m_iAccountTerrorist ;
int m_iAccountCT ;
2015-09-30 03:49:22 +03:00
int m_iNumTerrorist ; // The number of terrorists on the team (this is generated at the end of a round)
2017-07-01 23:40:10 +03:00
int m_iNumCT ; // The number of CTs on the team (this is generated at the end of a round)
2015-06-30 12:46:07 +03:00
int m_iNumSpawnableTerrorist ;
int m_iNumSpawnableCT ;
2017-07-01 23:40:10 +03:00
int m_iSpawnPointCount_Terrorist ; // Number of Terrorist spawn points
2015-09-30 03:49:22 +03:00
int m_iSpawnPointCount_CT ; // Number of CT spawn points
2015-06-30 12:46:07 +03:00
int m_iHostagesRescued ;
int m_iHostagesTouched ;
2015-09-30 03:49:22 +03:00
int m_iRoundWinStatus ; // 1 == CT's won last round, 2 == Terrorists did, 3 == Draw, no winner
2015-06-30 12:46:07 +03:00
short m_iNumCTWins ;
short m_iNumTerroristWins ;
2015-09-30 03:49:22 +03:00
bool m_bTargetBombed ; // whether or not the bomb has been bombed
bool m_bBombDefused ; // whether or not the bomb has been defused
2015-06-30 12:46:07 +03:00
bool m_bMapHasBombTarget ;
bool m_bMapHasBombZone ;
bool m_bMapHasBuyZone ;
bool m_bMapHasRescueZone ;
bool m_bMapHasEscapeZone ;
2015-09-30 03:49:22 +03:00
2016-12-06 22:21:52 +03:00
BOOL m_bMapHasVIPSafetyZone ; // TRUE = has VIP safety zone, FALSE = does not have VIP safetyzone
BOOL m_bMapHasCameras ;
2015-06-30 12:46:07 +03:00
int m_iC4Timer ;
2017-07-01 23:40:10 +03:00
int m_iC4Guy ; // The current Terrorist who has the C4.
int m_iLoserBonus ; // the amount of money the losing team gets. This scales up as they lose more rounds in a row
2015-09-30 03:49:22 +03:00
int m_iNumConsecutiveCTLoses ; // the number of rounds the CTs have lost in a row.
2017-07-01 23:40:10 +03:00
int m_iNumConsecutiveTerroristLoses ; // the number of rounds the Terrorists have lost in a row.
2015-09-30 03:49:22 +03:00
2017-07-01 23:40:10 +03:00
float m_fMaxIdlePeriod ; // For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked
2015-09-30 03:49:22 +03:00
2015-06-30 12:46:07 +03:00
int m_iLimitTeams ;
bool m_bLevelInitialized ;
bool m_bRoundTerminating ;
2017-07-01 23:40:10 +03:00
bool m_bCompleteReset ; // Set to TRUE to have the scores reset next time round restarts
2015-06-30 12:46:07 +03:00
float m_flRequiredEscapeRatio ;
int m_iNumEscapers ;
int m_iHaveEscaped ;
bool m_bCTCantBuy ;
2017-07-01 23:40:10 +03:00
bool m_bTCantBuy ; // Who can and can't buy.
2015-06-30 12:46:07 +03:00
float m_flBombRadius ;
int m_iConsecutiveVIP ;
int m_iTotalGunCount ;
int m_iTotalGrenadeCount ;
int m_iTotalArmourCount ;
2015-09-30 03:49:22 +03:00
int m_iUnBalancedRounds ; // keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2
int m_iNumEscapeRounds ; // keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds
2016-02-23 02:13:52 +03:00
int m_iMapVotes [ MAX_VOTE_MAPS ] ;
2015-06-30 12:46:07 +03:00
int m_iLastPick ;
int m_iMaxMapTime ;
int m_iMaxRounds ;
int m_iTotalRoundsPlayed ;
int m_iMaxRoundsWon ;
int m_iStoredSpectValue ;
float m_flForceCameraValue ;
float m_flForceChaseCamValue ;
float m_flFadeToBlackValue ;
CBasePlayer * m_pVIP ;
2016-06-02 01:08:22 +03:00
CBasePlayer * m_pVIPQueue [ MAX_VIP_QUEUES ] ;
2015-08-20 13:35:01 +03:00
2015-06-30 12:46:07 +03:00
protected :
float m_flIntermissionEndTime ;
float m_flIntermissionStartTime ;
BOOL m_iEndIntermissionButtonHit ;
float m_tmNextPeriodicThink ;
2016-12-06 22:21:52 +03:00
bool m_bGameStarted ; // TRUE = the game commencing when there is at least one CT and T, FALSE = scoring will not start until both teams have players (deprecated name m_bFirstConnected)
2015-06-30 12:46:07 +03:00
bool m_bInCareerGame ;
float m_fCareerRoundMenuTime ;
int m_iCareerMatchWins ;
int m_iRoundWinDifference ;
float m_fCareerMatchMenuTime ;
2016-02-04 03:18:26 +03:00
bool m_bSkipSpawn ;
2016-04-24 16:52:16 +03:00
// custom
2017-10-19 20:12:02 +03:00
bool m_bSkipShowMenu ;
bool m_bNeededPlayers ;
float m_flEscapeRatio ;
float m_flTimeLimit ;
float m_flGameStartTime ;
ReGameDLL API: Implemented hookchain's CSGameRules::CanPlayerHearPlayer, CBasePlayer::SwitchTeam, CBasePlayer::CanSwitchTeam, CBasePlayer::ThrowGrenade, CWeaponBox::SetModel, CGrenade::DefuseBombStart, CGrenade::DefuseBombEnd, CGrenade::ExplodeHeGrenade, CGrenade::ExplodeFlashbang, CGrenade::ExplodeSmokeGrenade, CGrenade::ExplodeBomb, ThrowHeGrenade, ThrowFlashbang, ThrowSmokeGrenade, PlantBomb
2018-01-27 19:31:30 +03:00
bool m_bTeamBalanced ;
2016-02-04 03:18:26 +03:00
} ;
2015-06-30 12:46:07 +03:00
typedef struct mapcycle_item_s
{
struct mapcycle_item_s * next ;
2017-10-12 17:50:56 +03:00
char mapname [ MAX_MAPNAME_LENGHT ] ;
2015-06-30 12:46:07 +03:00
int minplayers ;
int maxplayers ;
char rulebuffer [ MAX_RULE_BUFFER ] ;
2015-12-05 22:40:30 +03:00
2015-06-30 12:46:07 +03:00
} mapcycle_item_t ;
typedef struct mapcycle_s
{
struct mapcycle_item_s * items ;
struct mapcycle_item_s * next_item ;
2015-08-20 13:35:01 +03:00
2015-06-30 12:46:07 +03:00
} mapcycle_t ;
2015-09-16 23:19:21 +03:00
class CCStrikeGameMgrHelper : public IVoiceGameMgrHelper
{
public :
virtual bool CanPlayerHearPlayer ( CBasePlayer * pListener , CBasePlayer * pSender ) ;
ReGameDLL API: Implemented hookchain's CSGameRules::CanPlayerHearPlayer, CBasePlayer::SwitchTeam, CBasePlayer::CanSwitchTeam, CBasePlayer::ThrowGrenade, CWeaponBox::SetModel, CGrenade::DefuseBombStart, CGrenade::DefuseBombEnd, CGrenade::ExplodeHeGrenade, CGrenade::ExplodeFlashbang, CGrenade::ExplodeSmokeGrenade, CGrenade::ExplodeBomb, ThrowHeGrenade, ThrowFlashbang, ThrowSmokeGrenade, PlantBomb
2018-01-27 19:31:30 +03:00
# ifdef REGAMEDLL_API
bool CanPlayerHearPlayer_OrigFunc ( CBasePlayer * pListener , CBasePlayer * pSender ) ;
# endif
2016-02-04 03:18:26 +03:00
} ;
2015-06-30 12:46:07 +03:00
2016-07-14 17:12:17 +03:00
extern CGameRules DLLEXPORT * g_pGameRules ;
2015-06-30 12:46:07 +03:00
2017-07-01 23:40:10 +03:00
# ifdef REGAMEDLL_API
CGameRules * InstallGameRules_OrigFunc ( ) ;
# endif
2016-01-28 07:48:09 +03:00
CGameRules * InstallGameRules ( ) ;
2015-06-30 12:46:07 +03:00
2016-10-05 18:27:50 +03:00
// Gets us at the CS game rules
2016-02-23 02:13:52 +03:00
inline CHalfLifeMultiplay * CSGameRules ( )
{
2016-10-05 18:27:50 +03:00
return static_cast < CHalfLifeMultiplay * > ( g_pGameRules ) ;
2016-02-23 02:13:52 +03:00
}
2016-05-23 01:51:21 +03:00
inline void CHalfLifeMultiplay : : TerminateRound ( float tmDelay , int iWinStatus )
{
m_iRoundWinStatus = iWinStatus ;
2016-10-05 18:27:50 +03:00
m_flRestartRoundTime = gpGlobals - > time + tmDelay ;
2016-05-23 01:51:21 +03:00
m_bRoundTerminating = true ;
}
2016-12-10 21:27:53 +03:00
inline float CHalfLifeMultiplay : : GetRoundRemainingTimeReal ( ) const
{
# ifdef REGAMEDLL_FIXES
return m_iRoundTimeSecs - gpGlobals - > time + m_fRoundStartTimeReal ;
# else
return GetRoundRemainingTime ( ) ;
# endif
}
2016-05-23 01:51:21 +03:00
inline float CHalfLifeMultiplay : : GetRoundRespawnTime ( ) const
{
# ifdef REGAMEDLL_ADD
return roundrespawn_time . value ;
# else
return ROUND_RESPAWN_TIME ;
# endif
}
2016-06-14 18:00:27 +03:00
inline bool CHalfLifeMultiplay : : IsFreeForAll ( ) const
2016-05-23 01:51:21 +03:00
{
# ifdef REGAMEDLL_ADD
2016-06-14 18:00:27 +03:00
if ( freeforall . value ! = 0.0f )
2016-05-23 01:51:21 +03:00
return true ;
# endif
return false ;
}
2017-05-04 01:45:36 +03:00
inline float CHalfLifeMultiplay : : GetRoundRestartDelay ( ) const
{
# ifdef REGAMEDLL_ADD
return round_restart_delay . value ;
# else
return ROUND_BEGIN_DELAY ;
# endif
}
2017-01-20 17:52:37 +03:00
inline bool HasRoundInfinite ( int flags = 0 )
2016-05-23 01:51:21 +03:00
{
# ifdef REGAMEDLL_ADD
2016-07-14 17:12:17 +03:00
if ( round_infinite . string [ 0 ] = = ' 1 ' )
2016-05-23 01:51:21 +03:00
return true ;
2016-07-14 17:12:17 +03:00
if ( flags & & ( UTIL_ReadFlags ( round_infinite . string ) & flags ) )
return true ;
2016-05-23 01:51:21 +03:00
# endif
return false ;
}
2017-11-13 01:20:08 +03:00
inline float CGameRules : : GetItemKillDelay ( )
{
# ifdef REGAMEDLL_ADD
return item_staytime . value ;
# else
return ITEM_KILL_DELAY ;
# endif
}
2019-07-30 15:30:34 +03:00
inline float CGameRules : : GetRadioTimeout ( )
{
# ifdef REGAMEDLL_ADD
return radio_timeout . value ;
# else
return RADIO_TIMEOUT ;
# endif
}
2016-01-28 07:48:09 +03:00
bool IsBotSpeaking ( ) ;
void SV_Continue_f ( ) ;
void SV_Tutor_Toggle_f ( ) ;
void SV_Career_Restart_f ( ) ;
void SV_Career_EndRound_f ( ) ;
void SV_CareerAddTask_f ( ) ;
void SV_CareerMatchLimit_f ( ) ;
2015-09-16 23:19:21 +03:00
void Broadcast ( const char * sentence ) ;
2017-01-20 17:52:37 +03:00
char * GetTeam ( int team ) ;
2015-09-16 23:19:21 +03:00
void DestroyMapCycle ( mapcycle_t * cycle ) ;
int ReloadMapCycleFile ( char * filename , mapcycle_t * cycle ) ;
2016-01-28 07:48:09 +03:00
int CountPlayers ( ) ;
2015-09-16 23:19:21 +03:00
void ExtractCommandString ( char * s , char * szCommand ) ;
2016-01-28 07:48:09 +03:00
int GetMapCount ( ) ;