constfloatROUND_BEGIN_DELAY=5.0f;// delay before beginning new round
constfloatITEM_KILL_DELAY=300.0f;
constfloatRADIO_TIMEOUT=1.5f;
constintMAX_INTERMISSION_TIME=120;// longest the intermission can last, in seconds
// when we are within this close to running out of entities, items
// marked with the ITEM_FLAG_LIMITINWORLD will delay their respawn
constintENTITY_INTOLERANCE=100;
enum
{
WINSTATUS_NONE=0,
WINSTATUS_CTS,
WINSTATUS_TERRORISTS,
WINSTATUS_DRAW,
};
// Custom enum
// Used for EndRoundMessage() logged messages
enumScenarioEventEndRound
{
ROUND_NONE,
ROUND_TARGET_BOMB,
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,
ROUND_GAME_RESTART,
ROUND_GAME_OVER
};
enumRewardRules
{
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
};
// custom enum
enumRewardAccount
{
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,
// the end round was by the expiration time
REWARD_TARGET_BOMB_SAVED=3250,
REWARD_HOSTAGE_NOT_RESCUED=3250,
REWARD_VIP_NOT_ESCAPED=3250,
// loser bonus
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,
};
// custom enum
enumPaybackForBadThing
{
PAYBACK_FOR_KILLED_TEAMMATES=-3300,
};
// custom enum
enumInfoMapBuyParam
{
BUYING_EVERYONE=0,
BUYING_ONLY_CTS,
BUYING_ONLY_TERRORISTS,
BUYING_NO_ONE,
};
// weapon respawning return codes
enum
{
GR_NONE=0,
GR_WEAPON_RESPAWN_YES,
GR_WEAPON_RESPAWN_NO,
GR_AMMO_RESPAWN_YES,
GR_AMMO_RESPAWN_NO,
GR_ITEM_RESPAWN_YES,
GR_ITEM_RESPAWN_NO,
GR_PLR_DROP_GUN_ALL,
GR_PLR_DROP_GUN_ACTIVE,
GR_PLR_DROP_GUN_NO,
GR_PLR_DROP_AMMO_ALL,
GR_PLR_DROP_AMMO_ACTIVE,
GR_PLR_DROP_AMMO_NO,
};
// custom enum
enum
{
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"
};
// Player relationship return codes
enum
{
GR_NOTTEAMMATE=0,
GR_TEAMMATE,
GR_ENEMY,
GR_ALLY,
GR_NEUTRAL,
};
classCItem;
classCGameRules
{
public:
CGameRules();
virtual~CGameRules();
virtualvoidRefreshSkillData();// fill skill data struct with proper values
virtualvoidThink()=0;// runs every server frame, should handle any timer tasks, periodic events, etc.
virtualBOOLIsAllowedToSpawn(CBaseEntity*pEntity)=0;// Can this item spawn (eg monsters don't spawn in deathmatch).
virtualBOOLFAllowFlashlight()=0;// Are players allowed to switch on their flashlight?
virtualBOOLFShouldSwitchWeapon(CBasePlayer*pPlayer,CBasePlayerItem*pWeapon)=0;// should the player switch to this weapon?
virtualBOOLGetNextBestWeapon(CBasePlayer*pPlayer,CBasePlayerItem*pCurrentWeapon)=0;// I can't use this weapon anymore, get me the next best one.
// Functions to verify the single/multiplayer status of a game
virtualBOOLIsMultiplayer()=0;// is this a multiplayer game? (either coop or deathmatch)
virtualBOOLIsDeathmatch()=0;// is this a deathmatch game?
virtualBOOLIsTeamplay(){returnFALSE;}// is this deathmatch game being played with team rules?
virtualBOOLIsCoOp()=0;// is this a coop game?
virtualconstchar*GetGameDescription();// this is the game name that gets seen in the server browser
// Client connection/disconnection
virtualBOOLClientConnected(edict_t*pEntity,constchar*pszName,constchar*pszAddress,char*szRejectReason)=0;// a client just connected to the server (player hasn't spawned yet)
virtualvoidInitHUD(CBasePlayer*pl)=0;// the client dll is ready for updating
virtualvoidClientDisconnected(edict_t*pClient)=0;// a client just disconnected from the server
virtualvoidUpdateGameMode(CBasePlayer*pPlayer){};// the client needs to be informed of the current game mode
virtualBOOLClientCommand(CBasePlayer*pPlayer,constchar*pcmd){returnFALSE;}// handles the user commands; returns TRUE if command handled properly
virtualvoidClientUserInfoChanged(CBasePlayer*pPlayer,char*infobuffer){};// the player has changed userinfo; can change it now
// Client kills/scoring
virtualintIPointsForKill(CBasePlayer*pAttacker,CBasePlayer*pKilled)=0;// how many points do I award whoever kills this player?
virtualvoidPlayerKilled(CBasePlayer*pVictim,entvars_t*pKiller,entvars_t*pInflictor)=0;// Called each time a player dies
virtualvoidDeathNotice(CBasePlayer*pVictim,entvars_t*pKiller,entvars_t*pevInflictor)=0;// Call this from within a GameRules class to report an obituary.
// Weapon retrieval
virtualBOOLCanHavePlayerItem(CBasePlayer*pPlayer,CBasePlayerItem*pItem);// The player is touching an CBasePlayerItem, do I give it to him?
virtualvoidPlayerGotWeapon(CBasePlayer*pPlayer,CBasePlayerItem*pWeapon)=0;// Called each time a player picks up a weapon from the ground
// Weapon spawn/respawn control
virtualintWeaponShouldRespawn(CBasePlayerItem*pWeapon)=0;// should this weapon respawn?
virtualfloatFlWeaponRespawnTime(CBasePlayerItem*pWeapon)=0;// when may this weapon respawn?
virtualfloatFlWeaponTryRespawn(CBasePlayerItem*pWeapon)=0;// can i respawn now, and if not, when should i try again?
virtualVectorVecWeaponRespawnSpot(CBasePlayerItem*pWeapon)=0;// where in the world should this weapon respawn?
// Item retrieval
virtualBOOLCanHaveItem(CBasePlayer*pPlayer,CItem*pItem)=0;// is this player allowed to take this item?
virtualvoidPlayerGotItem(CBasePlayer*pPlayer,CItem*pItem)=0;// call each time a player picks up an item (battery, healthkit, longjump)
// Item spawn/respawn control
virtualintItemShouldRespawn(CItem*pItem)=0;// Should this item respawn?
virtualfloatFlItemRespawnTime(CItem*pItem)=0;// when may this item respawn?
virtualVectorVecItemRespawnSpot(CItem*pItem)=0;// where in the world should this item respawn?
// Ammo retrieval
virtualBOOLCanHaveAmmo(CBasePlayer*pPlayer,constchar*pszAmmoName,intiMaxCarry);// can this player take more of this ammo?
virtualvoidPlayerGotAmmo(CBasePlayer*pPlayer,char*szName,intiCount)=0;// called each time a player picks up some ammo in the world
// Ammo spawn/respawn control
virtualintAmmoShouldRespawn(CBasePlayerAmmo*pAmmo)=0;// should this ammo item respawn?
virtualfloatFlAmmoRespawnTime(CBasePlayerAmmo*pAmmo)=0;// when should this ammo item respawn?
virtualVectorVecAmmoRespawnSpot(CBasePlayerAmmo*pAmmo)=0;// where in the world should this ammo item respawn?
// Healthcharger respawn control
virtualfloatFlHealthChargerRechargeTime()=0;// how long until a depleted HealthCharger recharges itself?
virtualfloatFlHEVChargerRechargeTime(){return0.0f;}// how long until a depleted HealthCharger recharges itself?
// What happens to a dead player's weapons
virtualintDeadPlayerWeapons(CBasePlayer*pPlayer)=0;// what do I do with a player's weapons when he's killed?
// What happens to a dead player's ammo
virtualintDeadPlayerAmmo(CBasePlayer*pPlayer)=0;// Do I drop ammo when the player dies? How much?
// Teamplay stuff
virtualconstchar*GetTeamID(CBaseEntity*pEntity)=0;// what team is this entity on?
virtualintPlayerRelationship(CBasePlayer*pPlayer,CBaseEntity*pTarget)=0;// What is the player's relationship with this entity?
floatm_flRestartRoundTime;// The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount)
floatm_flCheckWinConditions;
floatm_fRoundStartTime;// Time round has started (deprecated name m_fRoundCount)
intm_iRoundTime;// (From mp_roundtime) - How many seconds long this round is.
intm_iRoundTimeSecs;
intm_iIntroRoundTime;// (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is.
floatm_fRoundStartTimeReal;// The global time when the intro round ends and the real one starts
// wrote the original "m_flRoundTime" comment for this variable).
intm_iAccountTerrorist;
intm_iAccountCT;
intm_iNumTerrorist;// The number of terrorists on the team (this is generated at the end of a round)
intm_iNumCT;// The number of CTs on the team (this is generated at the end of a round)
intm_iNumSpawnableTerrorist;
intm_iNumSpawnableCT;
intm_iSpawnPointCount_Terrorist;// Number of Terrorist spawn points
intm_iSpawnPointCount_CT;// Number of CT spawn points
intm_iHostagesRescued;
intm_iHostagesTouched;
intm_iRoundWinStatus;// 1 == CT's won last round, 2 == Terrorists did, 3 == Draw, no winner
shortm_iNumCTWins;
shortm_iNumTerroristWins;
boolm_bTargetBombed;// whether or not the bomb has been bombed
boolm_bBombDefused;// whether or not the bomb has been defused
boolm_bMapHasBombTarget;
boolm_bMapHasBombZone;
boolm_bMapHasBuyZone;
boolm_bMapHasRescueZone;
boolm_bMapHasEscapeZone;
BOOLm_bMapHasVIPSafetyZone;// TRUE = has VIP safety zone, FALSE = does not have VIP safetyzone
BOOLm_bMapHasCameras;
intm_iC4Timer;
intm_iC4Guy;// The current Terrorist who has the C4.
intm_iLoserBonus;// the amount of money the losing team gets. This scales up as they lose more rounds in a row
intm_iNumConsecutiveCTLoses;// the number of rounds the CTs have lost in a row.
intm_iNumConsecutiveTerroristLoses;// the number of rounds the Terrorists have lost in a row.
floatm_fMaxIdlePeriod;// For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked
intm_iLimitTeams;
boolm_bLevelInitialized;
boolm_bRoundTerminating;
boolm_bCompleteReset;// Set to TRUE to have the scores reset next time round restarts
floatm_flRequiredEscapeRatio;
intm_iNumEscapers;
intm_iHaveEscaped;
boolm_bCTCantBuy;
boolm_bTCantBuy;// Who can and can't buy.
floatm_flBombRadius;
intm_iConsecutiveVIP;
intm_iTotalGunCount;
intm_iTotalGrenadeCount;
intm_iTotalArmourCount;
intm_iUnBalancedRounds;// keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2
intm_iNumEscapeRounds;// keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds
intm_iMapVotes[MAX_VOTE_MAPS];
intm_iLastPick;
intm_iMaxMapTime;
intm_iMaxRounds;
intm_iTotalRoundsPlayed;
intm_iMaxRoundsWon;
intm_iStoredSpectValue;
floatm_flForceCameraValue;
floatm_flForceChaseCamValue;
floatm_flFadeToBlackValue;
CBasePlayer*m_pVIP;
CBasePlayer*m_pVIPQueue[MAX_VIP_QUEUES];
protected:
floatm_flIntermissionEndTime;
floatm_flIntermissionStartTime;
BOOLm_iEndIntermissionButtonHit;
floatm_tmNextPeriodicThink;
boolm_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)