mirror of
https://github.com/rehlds/ReFreeLook.git
synced 2025-01-12 14:27:55 +03:00
Update CSSDK
This commit is contained in:
parent
1733dde18e
commit
39ef08fb6d
@ -71,6 +71,9 @@
|
||||
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
|
||||
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
|
||||
|
||||
// SV_EmitSound2 flags
|
||||
#define SND_EMIT2_NOPAS (1<<0) // never to do check PAS
|
||||
#define SND_EMIT2_INVOKER (1<<1) // do not send to the client invoker
|
||||
|
||||
// Engine edict->spawnflags
|
||||
#define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file
|
||||
|
@ -49,8 +49,8 @@ class CBaseMonster: public CBaseToggle {
|
||||
public:
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual int TakeHealth(float flHealth, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeHealth(float flHealth, int bitsDamageType) = 0;
|
||||
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
|
||||
virtual int BloodColor() = 0;
|
||||
virtual BOOL IsAlive() = 0;
|
||||
|
@ -281,7 +281,7 @@ private:
|
||||
// The Counter-strike Bot
|
||||
class CCSBot: public CBot {
|
||||
public:
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; // invoked when injured by something (EXTEND) - returns the amount of damage inflicted
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; // invoked when injured by something (EXTEND) - returns the amount of damage inflicted
|
||||
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; // invoked when killed (EXTEND)
|
||||
virtual void RoundRespawn() = 0;
|
||||
virtual void Blind(float duration, float holdTime, float fadeTime, int alpha = 255) = 0; // player blinded by a flashbang
|
||||
|
@ -99,6 +99,6 @@ class CButtonTarget: public CBaseEntity {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual int ObjectCaps() = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
|
||||
};
|
||||
|
@ -68,8 +68,8 @@ public:
|
||||
virtual void DeathNotice(entvars_t *pevChild) = 0;
|
||||
|
||||
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual int TakeHealth(float flHealth, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeHealth(float flHealth, int bitsDamageType) = 0;
|
||||
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
|
||||
virtual int BloodColor() = 0;
|
||||
virtual void TraceBleed(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
|
||||
@ -268,7 +268,7 @@ public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void Precache() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual int Save(CSave &save) = 0;
|
||||
virtual int Restore(CRestore &restore) = 0;
|
||||
virtual int ObjectCaps() = 0; // Buttons that don't take damage can be IMPULSE used
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
|
||||
|
||||
// breakables use an overridden takedamage
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
|
||||
virtual int DamageDecal(int bitsDamageType) = 0;
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
virtual int Save(CSave &save) = 0;
|
||||
virtual int Restore(CRestore &restore) = 0;
|
||||
virtual int ObjectCaps() = 0
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual void Touch(CBaseEntity *pOther) = 0;
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
|
||||
|
||||
|
@ -90,6 +90,33 @@ enum ScenarioEventEndRound
|
||||
ROUND_GAME_COMMENCE,
|
||||
};
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
// custom enum
|
||||
enum RewardAccount
|
||||
{
|
||||
@ -141,18 +168,24 @@ enum InfoMapBuyParam
|
||||
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,
|
||||
@ -170,6 +203,7 @@ enum
|
||||
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6),
|
||||
};
|
||||
|
||||
// Player relationship return codes
|
||||
enum
|
||||
{
|
||||
GR_NOTTEAMMATE = 0,
|
||||
@ -182,68 +216,106 @@ enum
|
||||
class CItem;
|
||||
|
||||
class CGameRules {
|
||||
protected:
|
||||
virtual ~CGameRules() {};
|
||||
public:
|
||||
virtual void RefreshSkillData() = 0;
|
||||
virtual void Think() = 0;
|
||||
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
|
||||
virtual BOOL FAllowFlashlight() = 0;
|
||||
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
|
||||
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
|
||||
virtual BOOL IsMultiplayer() = 0;
|
||||
virtual BOOL IsDeathmatch() = 0;
|
||||
virtual BOOL IsTeamplay() = 0;
|
||||
virtual BOOL IsCoOp() = 0;
|
||||
virtual void RefreshSkillData() = 0; // fill skill data struct with proper values
|
||||
virtual void Think() = 0; // runs every server frame, should handle any timer tasks, periodic events, etc.
|
||||
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0; // Can this item spawn (eg monsters don't spawn in deathmatch).
|
||||
|
||||
// this is the game name that gets seen in the server browser
|
||||
virtual const char *GetGameDescription() = 0;
|
||||
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) = 0;
|
||||
virtual void InitHUD(CBasePlayer *pl) = 0;
|
||||
virtual void ClientDisconnected(edict_t *pClient) = 0;
|
||||
virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0;
|
||||
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.
|
||||
|
||||
// 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?
|
||||
virtual BOOL IsTeamplay() = 0; // is this deathmatch game being played with team rules?
|
||||
virtual BOOL IsCoOp() = 0; // is this a coop game?
|
||||
virtual const char *GetGameDescription() = 0; // this is the game name that gets seen in the server browser
|
||||
|
||||
// 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
|
||||
virtual void ClientDisconnected(edict_t *pClient) = 0; // a client just disconnected from the server
|
||||
virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0; // the client needs to be informed of the current game mode
|
||||
|
||||
// Client damage rules
|
||||
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
|
||||
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0;
|
||||
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0; // can this player take damage from this attacker?
|
||||
virtual BOOL ShouldAutoAim(CBasePlayer *pPlayer, edict_t *target) = 0;
|
||||
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
|
||||
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
|
||||
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
|
||||
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
|
||||
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
// 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
|
||||
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) = 0; // Place this player on their spawnspot and face them the proper direction.
|
||||
|
||||
virtual BOOL AllowAutoTargetCrosshair() = 0;
|
||||
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) = 0;
|
||||
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;
|
||||
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0;
|
||||
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
|
||||
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
|
||||
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor) = 0;
|
||||
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem) = 0;
|
||||
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
|
||||
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
|
||||
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
|
||||
virtual int ItemShouldRespawn(CItem *pItem) = 0;
|
||||
virtual float FlItemRespawnTime(CItem *pItem) = 0;
|
||||
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
|
||||
virtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry) = 0;
|
||||
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
|
||||
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
|
||||
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
|
||||
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
|
||||
virtual float FlHealthChargerRechargeTime() = 0;
|
||||
virtual float FlHEVChargerRechargeTime() = 0;
|
||||
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
|
||||
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
|
||||
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
|
||||
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
|
||||
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; // handles the user commands; returns TRUE if command handled properly
|
||||
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0; // 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?
|
||||
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.
|
||||
|
||||
// Weapon retrieval
|
||||
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem) = 0; // 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
|
||||
virtual int ItemShouldRespawn(CItem *pItem) = 0; // Should this item respawn?
|
||||
virtual float FlItemRespawnTime(CItem *pItem) = 0; // when may this item respawn?
|
||||
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0; // where in the world should this item respawn?
|
||||
|
||||
// Ammo retrieval
|
||||
virtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry) = 0; // 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
|
||||
|
||||
// Ammo spawn/respawn control
|
||||
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0; // should this ammo item respawn?
|
||||
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?
|
||||
|
||||
// Healthcharger respawn control
|
||||
virtual float FlHealthChargerRechargeTime() = 0; // how long until a depleted HealthCharger recharges itself?
|
||||
virtual float FlHEVChargerRechargeTime() = 0; // 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?
|
||||
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0; // What is the player's relationship with this entity?
|
||||
virtual int GetTeamIndex(const char *pTeamName) = 0;
|
||||
virtual const char *GetIndexedTeamName(int teamIndex) = 0;
|
||||
virtual BOOL IsValidTeam(const char *pTeamName) = 0;
|
||||
virtual void ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib) = 0;
|
||||
virtual const char *SetDefaultPlayerTeam(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
// Sounds
|
||||
virtual BOOL PlayTextureSounds() = 0;
|
||||
virtual BOOL FAllowMonsters() = 0;
|
||||
|
||||
// Monsters
|
||||
virtual BOOL FAllowMonsters() = 0; // are monsters allowed
|
||||
|
||||
// Immediately end a multiplayer game
|
||||
virtual void EndMultiplayerGame() = 0;
|
||||
|
||||
// Stuff that is shared between client and server.
|
||||
@ -253,107 +325,187 @@ public:
|
||||
public:
|
||||
BOOL m_bFreezePeriod;
|
||||
BOOL m_bBombDropped;
|
||||
|
||||
// custom
|
||||
char *m_GameDesc;
|
||||
};
|
||||
|
||||
// CHalfLifeRules - rules for the single player Half-Life game.
|
||||
class CHalfLifeRules: public CGameRules {
|
||||
protected:
|
||||
virtual ~CHalfLifeRules() {};
|
||||
public:
|
||||
virtual void Think() = 0;
|
||||
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
|
||||
virtual BOOL FAllowFlashlight() = 0;
|
||||
|
||||
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
|
||||
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
|
||||
|
||||
// Functions to verify the single/multiplayer status of a game
|
||||
virtual BOOL IsMultiplayer() = 0;
|
||||
virtual BOOL IsDeathmatch() = 0;
|
||||
virtual BOOL IsCoOp() = 0;
|
||||
|
||||
// Client connection/disconnection
|
||||
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0;
|
||||
virtual void InitHUD(CBasePlayer *pl) = 0;
|
||||
virtual void InitHUD(CBasePlayer *pl) = 0; // the client dll is ready for updating
|
||||
virtual void ClientDisconnected(edict_t *pClient) = 0;
|
||||
|
||||
// Client damage rules
|
||||
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
// Client spawn/respawn control
|
||||
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
|
||||
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
|
||||
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
|
||||
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
|
||||
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
virtual BOOL AllowAutoTargetCrosshair() = 0;
|
||||
|
||||
// Client kills/scoring
|
||||
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
|
||||
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
|
||||
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
|
||||
|
||||
// Weapon retrieval
|
||||
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
|
||||
|
||||
// Weapon spawn/respawn control
|
||||
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
|
||||
|
||||
// Item retrieval
|
||||
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
|
||||
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
|
||||
|
||||
// Item spawn/respawn control
|
||||
virtual int ItemShouldRespawn(CItem *pItem) = 0;
|
||||
virtual float FlItemRespawnTime(CItem *pItem) = 0;
|
||||
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
|
||||
|
||||
// Ammo retrieval
|
||||
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
|
||||
|
||||
// Ammo spawn/respawn control
|
||||
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
|
||||
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
|
||||
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
|
||||
|
||||
// Healthcharger respawn control
|
||||
virtual float FlHealthChargerRechargeTime() = 0;
|
||||
|
||||
// What happens to a dead player's weapons
|
||||
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
// What happens to a dead player's ammo
|
||||
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
// Teamplay stuff
|
||||
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
|
||||
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
|
||||
|
||||
// Monsters
|
||||
virtual BOOL FAllowMonsters() = 0;
|
||||
};
|
||||
|
||||
// CHalfLifeMultiplay - rules for the basic half life multiplayer competition
|
||||
class CHalfLifeMultiplay: public CGameRules {
|
||||
protected:
|
||||
virtual ~CHalfLifeMultiplay() {};
|
||||
public:
|
||||
virtual void RefreshSkillData() = 0;
|
||||
virtual void Think() = 0;
|
||||
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
|
||||
virtual BOOL FAllowFlashlight() = 0;
|
||||
|
||||
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
|
||||
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
|
||||
|
||||
virtual BOOL IsMultiplayer() = 0;
|
||||
virtual BOOL IsDeathmatch() = 0;
|
||||
virtual BOOL IsCoOp() = 0;
|
||||
|
||||
// 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.
|
||||
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0;
|
||||
virtual void InitHUD(CBasePlayer *pl) = 0;
|
||||
virtual void ClientDisconnected(edict_t *pClient) = 0;
|
||||
virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
// Client damage rules
|
||||
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
|
||||
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0;
|
||||
|
||||
// Client spawn/respawn control
|
||||
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
|
||||
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
|
||||
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
|
||||
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
|
||||
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
virtual BOOL AllowAutoTargetCrosshair() = 0;
|
||||
|
||||
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) = 0;
|
||||
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;
|
||||
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0;
|
||||
|
||||
// Client kills/scoring
|
||||
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
|
||||
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
|
||||
|
||||
// Death notices
|
||||
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
|
||||
|
||||
// Weapon retrieval
|
||||
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
|
||||
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
|
||||
|
||||
// Weapon spawn/respawn control
|
||||
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
|
||||
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
|
||||
|
||||
// Item retrieval
|
||||
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
|
||||
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
|
||||
|
||||
// Item spawn/respawn control
|
||||
virtual int ItemShouldRespawn(CItem *pItem) = 0;
|
||||
virtual float FlItemRespawnTime(CItem *pItem) = 0;
|
||||
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
|
||||
|
||||
// Ammo retrieval
|
||||
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
|
||||
|
||||
// Ammo spawn/respawn control
|
||||
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
|
||||
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
|
||||
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
|
||||
|
||||
// Healthcharger respawn control
|
||||
virtual float FlHealthChargerRechargeTime() = 0;
|
||||
virtual float FlHEVChargerRechargeTime() = 0;
|
||||
|
||||
// What happens to a dead player's weapons
|
||||
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
// What happens to a dead player's ammo
|
||||
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
// Teamplay stuff
|
||||
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
|
||||
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
|
||||
|
||||
virtual BOOL PlayTextureSounds() = 0;
|
||||
|
||||
// Monsters
|
||||
virtual BOOL FAllowMonsters() = 0;
|
||||
|
||||
// Immediately end a multiplayer game
|
||||
virtual void EndMultiplayerGame() = 0;
|
||||
virtual void ServerDeactivate() = 0;
|
||||
virtual void CheckMapConditions() = 0;
|
||||
@ -371,9 +523,32 @@ public:
|
||||
virtual void GiveC4() = 0;
|
||||
virtual void ChangeLevel() = 0;
|
||||
virtual void GoToIntermission() = 0;
|
||||
|
||||
// Setup counts for m_iNumTerrorist, m_iNumCT, m_iNumSpawnableTerrorist, m_iNumSpawnableCT, etc.
|
||||
virtual void InitializePlayerCounts(int &NumAliveTerrorist, int &NumAliveCT, int &NumDeadTerrorist, int &NumDeadCT) = 0;
|
||||
|
||||
virtual void BalanceTeams() = 0;
|
||||
virtual void SwapAllPlayers() = 0;
|
||||
virtual void UpdateTeamScores() = 0;
|
||||
virtual void EndRoundMessage(const char *sentence, int event) = 0;
|
||||
virtual void SetAccountRules(RewardRules rules, int amount) = 0;
|
||||
virtual RewardAccount GetAccountRules(RewardRules rules) const = 0;
|
||||
|
||||
// BOMB MAP FUNCTIONS
|
||||
virtual BOOL IsThereABomber() = 0;
|
||||
virtual BOOL IsThereABomb() = 0;
|
||||
virtual TeamName SelectDefaultTeam() = 0;
|
||||
|
||||
virtual bool HasRoundTimeExpired() = 0;
|
||||
virtual bool IsBombPlanted() = 0;
|
||||
|
||||
public:
|
||||
bool ShouldSkipShowMenu() const { return m_bSkipShowMenu; }
|
||||
void MarkShowMenuSkipped() { m_bSkipShowMenu = false; }
|
||||
|
||||
bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
|
||||
void MarkSpawnSkipped() { m_bSkipSpawn = false; }
|
||||
|
||||
float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }
|
||||
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
|
||||
|
||||
@ -454,7 +629,7 @@ public:
|
||||
float m_flForceChaseCamValue;
|
||||
float m_flFadeToBlackValue;
|
||||
CBasePlayer *m_pVIP;
|
||||
CBasePlayer *VIPQueue[MAX_VIP_QUEUES];
|
||||
CBasePlayer *m_pVIPQueue[MAX_VIP_QUEUES];
|
||||
float m_flIntermissionEndTime;
|
||||
float m_flIntermissionStartTime;
|
||||
BOOL m_iEndIntermissionButtonHit;
|
||||
@ -468,6 +643,7 @@ public:
|
||||
bool m_bSkipSpawn;
|
||||
|
||||
// custom
|
||||
bool m_bSkipShowMenu;
|
||||
bool m_bNeededPlayers;
|
||||
float m_flEscapeRatio;
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
virtual int Save(CSave &save) = 0;
|
||||
virtual int Restore(CRestore &restore) = 0;
|
||||
virtual int ObjectCaps() = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
|
||||
// Don't treat as a live target
|
||||
virtual BOOL IsAlive() = 0;
|
||||
@ -62,7 +62,7 @@ public:
|
||||
virtual int Save(CSave &save) = 0;
|
||||
virtual int Restore(CRestore &restore) = 0;
|
||||
virtual int ObjectCaps() = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual void Think() = 0;
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
|
||||
public:
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
virtual void Precache() = 0;
|
||||
virtual int ObjectCaps() = 0; // make hostage "useable"
|
||||
virtual int Classify() = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual int BloodColor() = 0;
|
||||
virtual void Touch(CBaseEntity *pOther) = 0;
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
|
||||
|
@ -27,22 +27,66 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
enum ItemRestType
|
||||
{
|
||||
ITEM_TYPE_BUYING, // when a player buying items
|
||||
ITEM_TYPE_TOUCHED, // when the player touches with a weaponbox or armoury_entity
|
||||
ITEM_TYPE_EQUIPPED // when a entity game_player_equip to player gives item
|
||||
};
|
||||
|
||||
// constant items
|
||||
#define ITEM_HEALTHKIT 1
|
||||
#define ITEM_ANTIDOTE 2
|
||||
#define ITEM_SECURITY 3
|
||||
#define ITEM_BATTERY 4
|
||||
#define ITEM_SUIT 5
|
||||
enum ItemID
|
||||
{
|
||||
ITEM_NONE = -1,
|
||||
ITEM_SHIELDGUN,
|
||||
ITEM_P228,
|
||||
ITEM_GLOCK,
|
||||
ITEM_SCOUT,
|
||||
ITEM_HEGRENADE,
|
||||
ITEM_XM1014,
|
||||
ITEM_C4,
|
||||
ITEM_MAC10,
|
||||
ITEM_AUG,
|
||||
ITEM_SMOKEGRENADE,
|
||||
ITEM_ELITE,
|
||||
ITEM_FIVESEVEN,
|
||||
ITEM_UMP45,
|
||||
ITEM_SG550,
|
||||
ITEM_GALIL,
|
||||
ITEM_FAMAS,
|
||||
ITEM_USP,
|
||||
ITEM_GLOCK18,
|
||||
ITEM_AWP,
|
||||
ITEM_MP5N,
|
||||
ITEM_M249,
|
||||
ITEM_M3,
|
||||
ITEM_M4A1,
|
||||
ITEM_TMP,
|
||||
ITEM_G3SG1,
|
||||
ITEM_FLASHBANG,
|
||||
ITEM_DEAGLE,
|
||||
ITEM_SG552,
|
||||
ITEM_AK47,
|
||||
ITEM_KNIFE,
|
||||
ITEM_P90,
|
||||
ITEM_NVG,
|
||||
ITEM_DEFUSEKIT,
|
||||
ITEM_KEVLAR,
|
||||
ITEM_ASSAULT,
|
||||
ITEM_LONGJUMP,
|
||||
ITEM_SODACAN,
|
||||
ITEM_HEALTHKIT,
|
||||
ITEM_ANTIDOTE,
|
||||
ITEM_SECURITY,
|
||||
ITEM_BATTERY,
|
||||
ITEM_SUIT
|
||||
};
|
||||
|
||||
class CItem: public CBaseEntity {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual CBaseEntity *Respawn() = 0;
|
||||
virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0;
|
||||
|
||||
public:
|
||||
void EXPORT ItemTouch(CBaseEntity *pOther) = 0;
|
||||
void EXPORT Materialize() = 0;
|
||||
};
|
||||
|
||||
class CWorldItem: public CBaseEntity {
|
||||
@ -50,7 +94,7 @@ public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
public:
|
||||
int m_iType;
|
||||
ItemID m_iType;
|
||||
};
|
||||
|
||||
class CItemSuit: public CItem {
|
||||
|
@ -111,7 +111,6 @@
|
||||
typedef unsigned int uchar32;
|
||||
#endif
|
||||
#else // _WIN32
|
||||
#ifndef __CLANG_STDINT_H
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
@ -123,7 +122,7 @@
|
||||
typedef short int16_t;
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned short uchar16;
|
||||
@ -201,3 +200,4 @@
|
||||
#define C_DLLEXPORT extern "C" DLLEXPORT
|
||||
|
||||
#define EXT_FUNC /*FORCE_STACK_ALIGN*/
|
||||
#define EXT_ALIGN FORCE_STACK_ALIGN
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
virtual int ObjectCaps() = 0;
|
||||
virtual void Activate() = 0;
|
||||
virtual int Classify() = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual int BloodColor() = 0;
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
|
||||
virtual Vector BodyTarget(const Vector &posSrc) = 0;
|
||||
|
@ -67,13 +67,15 @@
|
||||
// NOTE: It works for CZ
|
||||
#define MONEY_BLINK_AMOUNT 30
|
||||
|
||||
// Player physics flags bits
|
||||
// CBasePlayer::m_afPhysicsFlags
|
||||
#define PFLAG_ONLADDER (1<<0)
|
||||
#define PFLAG_ONSWING (1<<0)
|
||||
#define PFLAG_ONTRAIN (1<<1)
|
||||
#define PFLAG_ONBARNACLE (1<<2)
|
||||
#define PFLAG_DUCKING (1<<3)
|
||||
#define PFLAG_USING (1<<4)
|
||||
#define PFLAG_OBSERVER (1<<5)
|
||||
#define PFLAG_DUCKING (1<<3) // In the process of ducking, but totally squatted yet
|
||||
#define PFLAG_USING (1<<4) // Using a continuous entity
|
||||
#define PFLAG_OBSERVER (1<<5) // player is locked in stationary cam mode. Spectators can move, observers can't.
|
||||
|
||||
#define TRAIN_OFF 0x00
|
||||
#define TRAIN_NEUTRAL 0x01
|
||||
@ -148,7 +150,7 @@ enum RewardType
|
||||
RT_VIP_RESCUED_MYSELF
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum PLAYER_ANIM
|
||||
{
|
||||
PLAYER_IDLE,
|
||||
PLAYER_WALK,
|
||||
@ -161,10 +163,9 @@ typedef enum
|
||||
PLAYER_LARGE_FLINCH,
|
||||
PLAYER_RELOAD,
|
||||
PLAYER_HOLDBOMB
|
||||
};
|
||||
|
||||
} PLAYER_ANIM;
|
||||
|
||||
typedef enum
|
||||
enum _Menu
|
||||
{
|
||||
Menu_OFF,
|
||||
Menu_ChooseTeam,
|
||||
@ -181,19 +182,17 @@ typedef enum
|
||||
Menu_Radio2,
|
||||
Menu_Radio3,
|
||||
Menu_ClientBuy
|
||||
};
|
||||
|
||||
} _Menu;
|
||||
|
||||
typedef enum
|
||||
enum TeamName
|
||||
{
|
||||
UNASSIGNED,
|
||||
TERRORIST,
|
||||
CT,
|
||||
SPECTATOR,
|
||||
};
|
||||
|
||||
} TeamName;
|
||||
|
||||
typedef enum
|
||||
enum ModelName
|
||||
{
|
||||
MODEL_UNASSIGNED,
|
||||
MODEL_URBAN,
|
||||
@ -206,11 +205,11 @@ typedef enum
|
||||
MODEL_GUERILLA,
|
||||
MODEL_VIP,
|
||||
MODEL_MILITIA,
|
||||
MODEL_SPETSNAZ
|
||||
MODEL_SPETSNAZ,
|
||||
MODEL_AUTO
|
||||
};
|
||||
|
||||
} ModelName;
|
||||
|
||||
typedef enum
|
||||
enum JoinState
|
||||
{
|
||||
JOINED,
|
||||
SHOWLTEXT,
|
||||
@ -218,10 +217,9 @@ typedef enum
|
||||
SHOWTEAMSELECT,
|
||||
PICKINGTEAM,
|
||||
GETINTOGAME
|
||||
};
|
||||
|
||||
} JoinState;
|
||||
|
||||
typedef enum
|
||||
enum TrackCommands
|
||||
{
|
||||
CMD_SAY = 0,
|
||||
CMD_SAYTEAM,
|
||||
@ -232,10 +230,9 @@ typedef enum
|
||||
CMD_LISTPLAYERS,
|
||||
CMD_NIGHTVISION,
|
||||
COMMANDS_TO_TRACK,
|
||||
};
|
||||
|
||||
} TrackCommands;
|
||||
|
||||
typedef struct
|
||||
struct RebuyStruct
|
||||
{
|
||||
int m_primaryWeapon;
|
||||
int m_primaryAmmo;
|
||||
@ -246,11 +243,10 @@ typedef struct
|
||||
int m_smokeGrenade;
|
||||
int m_defuser;
|
||||
int m_nightVision;
|
||||
int m_armor;
|
||||
ArmorType m_armor;
|
||||
};
|
||||
|
||||
} RebuyStruct;
|
||||
|
||||
typedef enum
|
||||
enum ThrowDirection
|
||||
{
|
||||
THROW_NONE,
|
||||
THROW_FORWARD,
|
||||
@ -259,8 +255,7 @@ typedef enum
|
||||
THROW_BOMB,
|
||||
THROW_GRENADE,
|
||||
THROW_HITVEL_MINUS_AIRVEL
|
||||
|
||||
} ThrowDirection;
|
||||
};
|
||||
|
||||
enum sbar_data
|
||||
{
|
||||
@ -270,13 +265,7 @@ enum sbar_data
|
||||
SBAR_END
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SILENT,
|
||||
CALM,
|
||||
INTENSE
|
||||
|
||||
} MusicState;
|
||||
enum MusicState { SILENT, CALM, INTENSE };
|
||||
|
||||
class CCSPlayer;
|
||||
|
||||
@ -320,8 +309,8 @@ public:
|
||||
virtual int ObjectCaps() = 0;
|
||||
virtual int Classify() = 0;
|
||||
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual int TakeHealth(float flHealth, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeHealth(float flHealth, int bitsDamageType) = 0;
|
||||
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
|
||||
virtual void AddPoints(int score, BOOL bAllowNegativeScore) = 0;
|
||||
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
|
||||
@ -353,6 +342,10 @@ public:
|
||||
virtual void Blind(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha) = 0;
|
||||
virtual void OnTouchingWeapon(CWeaponBox *pWeapon) = 0;
|
||||
public:
|
||||
static CBasePlayer *Instance(edict_t *pent) { return (CBasePlayer *)GET_PRIVATE(pent ? pent : ENT(0)); }
|
||||
static CBasePlayer *Instance(entvars_t *pev) { return Instance(ENT(pev)); }
|
||||
static CBasePlayer *Instance(int offset) { return Instance(ENT(offset)); }
|
||||
|
||||
int IsObserver() { return pev->iuser1; }
|
||||
void SetWeaponAnimType(const char *szExtention) { strcpy(m_szAnimExtention, szExtention); }
|
||||
bool IsProtectedByShield() { return m_bOwnsShield && m_bShieldDrawn; }
|
||||
@ -382,7 +375,7 @@ public:
|
||||
int m_iLastZoom;
|
||||
bool m_bResumeZoom;
|
||||
float m_flEjectBrass;
|
||||
int m_iKevlar;
|
||||
ArmorType m_iKevlar;
|
||||
bool m_bNotKilled;
|
||||
TeamName m_iTeam;
|
||||
int m_iAccount;
|
||||
|
@ -32,8 +32,10 @@
|
||||
#include "interface.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
#include "client.h"
|
||||
#include "items.h"
|
||||
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 3
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 4
|
||||
#define REGAMEDLL_API_VERSION_MINOR 1
|
||||
|
||||
// CBasePlayer::Spawn hook
|
||||
@ -57,12 +59,12 @@ typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, float, Vector
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHookRegistry_CBasePlayer_TraceAttack;
|
||||
|
||||
// CBasePlayer::TakeDamage hook
|
||||
typedef IHookChainClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
|
||||
typedef IHookChainClass<BOOL, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
|
||||
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
|
||||
|
||||
// CBasePlayer::TakeHealth hook
|
||||
typedef IHookChainClass<int, class CBasePlayer, float, int> IReGameHook_CBasePlayer_TakeHealth;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, float, int> IReGameHookRegistry_CBasePlayer_TakeHealth;
|
||||
typedef IHookChainClass<BOOL, class CBasePlayer, float, int> IReGameHook_CBasePlayer_TakeHealth;
|
||||
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, float, int> IReGameHookRegistry_CBasePlayer_TakeHealth;
|
||||
|
||||
// CBasePlayer::Killed hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, int> IReGameHook_CBasePlayer_Killed;
|
||||
@ -124,7 +126,6 @@ typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBase
|
||||
typedef IVoidHookChainClass<class CBasePlayer, float, float, float, int> IReGameHook_CBasePlayer_Blind;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, float, float, float, int> IReGameHookRegistry_CBasePlayer_Blind;
|
||||
|
||||
|
||||
// CBasePlayer::Observer_IsValidTarget hook
|
||||
typedef IHookChainClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
|
||||
typedef IHookChainRegistryClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget;
|
||||
@ -157,6 +158,14 @@ typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHo
|
||||
typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
|
||||
|
||||
// CBasePlayer::HasRestrictItem hook
|
||||
typedef IHookChainClass<bool, class CBasePlayer, ItemID, ItemRestType> IReGameHook_CBasePlayer_HasRestrictItem;
|
||||
typedef IHookChainRegistryClass<bool, class CBasePlayer, ItemID, ItemRestType> IReGameHookRegistry_CBasePlayer_HasRestrictItem;
|
||||
|
||||
// CBasePlayer::DropPlayerItem hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropPlayerItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropPlayerItem;
|
||||
|
||||
// CBaseAnimating::ResetSequenceInfo hook
|
||||
typedef IVoidHookChainClass<class CBaseAnimating> IReGameHook_CBaseAnimating_ResetSequenceInfo;
|
||||
typedef IVoidHookChainRegistryClass<class CBaseAnimating> IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
|
||||
@ -177,10 +186,6 @@ typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct e
|
||||
typedef IHookChain<bool, int, ScenarioEventEndRound, float> IReGameHook_RoundEnd;
|
||||
typedef IHookChainRegistry<bool, int, ScenarioEventEndRound, float> IReGameHookRegistry_RoundEnd;
|
||||
|
||||
// CanBuyThis hook
|
||||
typedef IHookChain<bool, class CBasePlayer *, int> IReGameHook_CanBuyThis;
|
||||
typedef IHookChainRegistry<bool, class CBasePlayer *, int> IReGameHookRegistry_CanBuyThis;
|
||||
|
||||
// InstallGameRules hook
|
||||
typedef IHookChain<class CGameRules *> IReGameHook_InstallGameRules;
|
||||
typedef IHookChainRegistry<class CGameRules *> IReGameHookRegistry_InstallGameRules;
|
||||
@ -336,13 +341,14 @@ public:
|
||||
virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0;
|
||||
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;
|
||||
virtual IReGameHookRegistry_PlayerBlind* PlayerBlind() = 0;
|
||||
virtual IReGameHookRegistry_RadiusFlash_TraceLine* RadiusFlash_TraceLine() = 0;
|
||||
virtual IReGameHookRegistry_RoundEnd* RoundEnd() = 0;
|
||||
virtual IReGameHookRegistry_CanBuyThis* CanBuyThis() = 0;
|
||||
virtual IReGameHookRegistry_InstallGameRules* InstallGameRules() = 0;
|
||||
virtual IReGameHookRegistry_PM_Init* PM_Init() = 0;
|
||||
virtual IReGameHookRegistry_PM_Move* PM_Move() = 0;
|
||||
|
@ -51,7 +51,7 @@ class CCSArmoury: public CCSEntity {};
|
||||
|
||||
class CCSPlayer: public CCSMonster {
|
||||
public:
|
||||
CCSPlayer()
|
||||
CCSPlayer() : m_bForceShowMenu(false)
|
||||
{
|
||||
m_szModel[0] = '\0';
|
||||
}
|
||||
@ -83,10 +83,14 @@ public:
|
||||
virtual bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot);
|
||||
virtual bool SwitchWeapon(CBasePlayerItem *pWeapon);
|
||||
virtual void SwitchTeam();
|
||||
virtual bool JoinTeam(TeamName team);
|
||||
virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle);
|
||||
virtual void TeamChangeUpdate();
|
||||
|
||||
CBasePlayer *BasePlayer() const;
|
||||
public:
|
||||
char m_szModel[32];
|
||||
bool m_bForceShowMenu;
|
||||
};
|
||||
|
||||
class CAPI_Bot: public CCSPlayer {};
|
||||
|
@ -28,6 +28,8 @@
|
||||
#pragma once
|
||||
|
||||
class CHalfLifeTraining: public CHalfLifeMultiplay {
|
||||
protected:
|
||||
virtual ~CHalfLifeTraining() {};
|
||||
public:
|
||||
virtual BOOL IsMultiplayer() = 0;
|
||||
virtual BOOL IsDeathmatch() = 0;
|
||||
|
@ -57,6 +57,7 @@ extern globalvars_t *gpGlobals;
|
||||
#define SND_CHANGE_VOL (1<<6) // duplicated in protocol.h change sound vol
|
||||
#define SND_CHANGE_PITCH (1<<7) // duplicated in protocol.h change sound pitch
|
||||
|
||||
// All monsters need this data
|
||||
#define DONT_BLEED -1
|
||||
#define BLOOD_COLOR_RED (byte)247
|
||||
#define BLOOD_COLOR_YELLOW (byte)195
|
||||
|
@ -31,13 +31,15 @@
|
||||
// operations that are treated as planar rather than 3d.
|
||||
class Vector2D {
|
||||
public:
|
||||
inline Vector2D() : x(0.0), y(0.0) {}
|
||||
inline Vector2D(float X, float Y) : x(0.0), y(0.0) { x = X; y = Y; }
|
||||
inline Vector2D() : x(), y() {}
|
||||
inline Vector2D(float X, float Y) : x(X), y(Y) {}
|
||||
inline Vector2D(const Vector2D &v) { *(int*)&x = *(int*)&v.x; *(int*)&y = *(int*)&v.y; }
|
||||
inline Vector2D operator+(const Vector2D &v) const { return Vector2D(x + v.x, y + v.y); }
|
||||
inline Vector2D operator-(const Vector2D &v) const { return Vector2D(x - v.x, y - v.y); }
|
||||
inline Vector2D operator*(float fl) const { return Vector2D(x * fl, y * fl); }
|
||||
inline Vector2D operator/(float fl) const { return Vector2D(x / fl, y / fl); }
|
||||
inline Vector2D operator/=(float fl) const { return Vector2D(x / fl, y / fl); }
|
||||
|
||||
inline float Length() const { return sqrt(x * x + y * y); }
|
||||
inline float LengthSquared() const { return (x * x + y * y); }
|
||||
|
||||
@ -89,11 +91,10 @@ inline Vector2D operator*(float fl, const Vector2D &v) { return v * fl; }
|
||||
class Vector {
|
||||
public:
|
||||
// Construction/destruction
|
||||
inline Vector() : x(0.0), y(0.0), z(0.0) {}
|
||||
inline Vector(float X, float Y, float Z) : x(0.0), y(0.0), z(0.0) { x = X; y = Y; z = Z; }
|
||||
|
||||
inline Vector(const Vector &v) : x(0.0), y(0.0), z(0.0) { x = v.x; y = v.y; z = v.z; }
|
||||
inline Vector(const float rgfl[3]) : x(0.0), y(0.0), z(0.0) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; }
|
||||
inline Vector() : x(), y(), z() {}
|
||||
inline Vector(float X, float Y, float Z) : x(X), y(Y), z(Z) {}
|
||||
inline Vector(const Vector &v) { *(int*)&x = *(int*)&v.x; *(int*)&y = *(int*)&v.y; *(int*)&z = *(int*)&v.z; }
|
||||
inline Vector(const float rgfl[3]) { *(int*)&x = *(int*)&rgfl[0]; *(int*)&y = *(int*)&rgfl[1]; *(int*)&z = *(int*)&rgfl[2]; }
|
||||
|
||||
// Operators
|
||||
inline Vector operator-() const { return Vector(-x, -y, -z); }
|
||||
@ -106,7 +107,7 @@ public:
|
||||
inline Vector operator/=(float fl) const{ return Vector(x / fl, y / fl, z / fl); }
|
||||
|
||||
// Methods
|
||||
inline void CopyToArray(float *rgfl) const { rgfl[0] = x; rgfl[1] = y; rgfl[2] = z; }
|
||||
inline void CopyToArray(float *rgfl) const { *(int*)&rgfl[0] = *(int*)&x; *(int*)&rgfl[1] = *(int*)&y; *(int*)&rgfl[2] = *(int*)&z; }
|
||||
inline float Length() const { return sqrt(x * x + y * y + z * z); }
|
||||
inline float LengthSquared() const { return (x * x + y * y + z * z); }
|
||||
|
||||
@ -122,7 +123,14 @@ public:
|
||||
flLen = 1 / flLen;
|
||||
return Vector(x * flLen, y * flLen, z * flLen);
|
||||
}
|
||||
inline Vector2D Make2D() const { return Vector2D(x, y); }
|
||||
inline Vector2D Make2D() const
|
||||
{
|
||||
Vector2D Vec2;
|
||||
*(int*)&Vec2.x = *(int*)&x;
|
||||
*(int*)&Vec2.y = *(int*)&y;
|
||||
return Vec2;
|
||||
}
|
||||
|
||||
inline float Length2D() const { return sqrt(x * x + y * y); }
|
||||
|
||||
inline bool IsLengthLessThan(float length) const { return (LengthSquared() < length * length); }
|
||||
|
@ -92,8 +92,7 @@ enum ArmouryItemPack
|
||||
ARMOURY_HEGRENADE,
|
||||
ARMOURY_KEVLAR,
|
||||
ARMOURY_ASSAULT,
|
||||
ARMOURY_SMOKEGRENADE,
|
||||
ARMOURY_END
|
||||
ARMOURY_SMOKEGRENADE
|
||||
};
|
||||
|
||||
struct ItemInfo
|
||||
@ -131,7 +130,7 @@ public:
|
||||
virtual void Restart() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
public:
|
||||
int m_iItem;
|
||||
ArmouryItemPack m_iItem;
|
||||
int m_iCount;
|
||||
int m_iInitialCount;
|
||||
bool m_bAlreadyCounted;
|
||||
|
@ -185,6 +185,10 @@ typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Spawn_f;
|
||||
typedef IHookChain<int, enum sv_delta_s, IGameClient *, struct packet_entities_s *, struct sizebuf_s *> IRehldsHook_SV_CreatePacketEntities;
|
||||
typedef IHookChainRegistry<int, enum sv_delta_s, IGameClient *, struct packet_entities_s *, struct sizebuf_s *> IRehldsHookRegistry_SV_CreatePacketEntities;
|
||||
|
||||
//SV_EmitSound2 hook
|
||||
typedef IHookChain<bool, edict_t *, IGameClient *, int, const char*, float, float, int, int, int, const float*> IRehldsHook_SV_EmitSound2;
|
||||
typedef IHookChainRegistry<bool, edict_t *, IGameClient *, int, const char*, float, float, int, int, int, const float*> IRehldsHookRegistry_SV_EmitSound2;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
virtual ~IRehldsHookchains() { }
|
||||
@ -226,6 +230,7 @@ public:
|
||||
virtual IRehldsHookRegistry_SV_EstablishTimeBase* SV_EstablishTimeBase() = 0;
|
||||
virtual IRehldsHookRegistry_SV_Spawn_f* SV_Spawn_f() = 0;
|
||||
virtual IRehldsHookRegistry_SV_CreatePacketEntities* SV_CreatePacketEntities() = 0;
|
||||
virtual IRehldsHookRegistry_SV_EmitSound2* SV_EmitSound2() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
@ -273,6 +278,8 @@ struct RehldsFuncs_t {
|
||||
qboolean(*SV_FileInConsistencyList)(const char *filename, struct consistency_s **ppconsist);
|
||||
qboolean(*Steam_NotifyClientConnect)(IGameClient *cl, const void *pvSteam2Key, unsigned int ucbSteam2Key);
|
||||
void(*Steam_NotifyClientDisconnect)(IGameClient* cl);
|
||||
void(*SV_StartSound)(int recipients, edict_t *entity, int channel, const char *sample, int volume, float attenuation, int flags, int pitch);
|
||||
bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin);
|
||||
};
|
||||
|
||||
class IRehldsApi {
|
||||
|
@ -35,10 +35,11 @@ public:
|
||||
virtual void Spawn() = 0;
|
||||
|
||||
// invoked when injured by something
|
||||
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
|
||||
// invoked when killed
|
||||
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
|
||||
virtual BOOL IsNetClient() = 0;
|
||||
virtual void Think() = 0;
|
||||
virtual BOOL IsBot() = 0;
|
||||
virtual Vector GetAutoaimVector(float flDelta) = 0;
|
||||
|
78
src/main.cpp
78
src/main.cpp
@ -2,28 +2,37 @@
|
||||
|
||||
cvar_t cv_admin_access_flags = { "afl_admin_access_flags", "d" };
|
||||
|
||||
cvar_t *pcv_fadetoblack;
|
||||
cvar_t *pcv_forcecamera;
|
||||
cvar_t *pcv_forcechasecam;
|
||||
cvar_t *pcv_admin_access_flags;
|
||||
CGameRules *g_pGameRules;
|
||||
|
||||
inline bool ShouldRunCode()
|
||||
{
|
||||
if (!pcv_fadetoblack || !pcv_forcecamera || !pcv_forcechasecam)
|
||||
return true;
|
||||
|
||||
return pcv_fadetoblack->value <= 0.0f && pcv_forcecamera->value > 0.0f && pcv_forcechasecam->value > 0.0f;
|
||||
}
|
||||
|
||||
inline bool canFreeLook(const int nIndex) {
|
||||
inline bool hasFlags(const int nIndex) {
|
||||
return (UTIL_ReadFlags(pcv_admin_access_flags->string) & g_amxxapi.GetPlayerFlags(nIndex)) != 0;
|
||||
}
|
||||
|
||||
int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver)
|
||||
{
|
||||
int retVal = chain->callNext(pObserver);
|
||||
if (ShouldRunCode()) {
|
||||
if (canFreeLook(pObserver->entindex()))
|
||||
|
||||
// When set to 1, player's screen fades to black for the remainder of the round when he dies
|
||||
// (hud still works normally so player can chat and see the scores, etc.)
|
||||
// Overrides mp_forcechasecam
|
||||
if (CSGameRules()->m_flFadeToBlackValue > 0.0f
|
||||
|
||||
// 0 - You can spectate anyone
|
||||
// 1 - You can spectate teammates only + No Free Look
|
||||
// 2 - Only first person mode is allowed
|
||||
// 3 - You can spectate teammates only (Free Look works)
|
||||
|| CSGameRules()->m_flForceCameraValue <= 0.0f
|
||||
|
||||
// 0 - You can spectate anyone
|
||||
// 1 - You can spectate teammates only + No Free Look
|
||||
// 2 - Only first person mode is allowed
|
||||
// 3 - You can spectate teammates only (Free Look works)
|
||||
|| CSGameRules()->m_flForceChaseCamValue <= 0.0f) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (hasFlags(pObserver->entindex())) {
|
||||
retVal = CAMERA_MODE_SPEC_ANYONE;
|
||||
}
|
||||
|
||||
@ -32,7 +41,10 @@ int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver)
|
||||
|
||||
CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer_IsValidTarget *chain, CBasePlayer *pthis, int iPlayerIndex, bool bSameTeam)
|
||||
{
|
||||
if (ShouldRunCode()) {
|
||||
if (CSGameRules()->m_flFadeToBlackValue <= 0.0f
|
||||
&& CSGameRules()->m_flForceCameraValue > 0.0f
|
||||
&& CSGameRules()->m_flForceChaseCamValue > 0.0f)
|
||||
{
|
||||
// go next hook and call the original in the end
|
||||
return chain->callNext(pthis, iPlayerIndex, bSameTeam);
|
||||
}
|
||||
@ -46,7 +58,7 @@ CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer
|
||||
if (!pPlayer || pPlayer == pthis || pPlayer->has_disconnected || pPlayer->IsObserver() || (pPlayer->pev->effects & EF_NODRAW) || pPlayer->m_iTeam == UNASSIGNED)
|
||||
return nullptr;
|
||||
|
||||
if (bSameTeam && pPlayer->m_iTeam != pthis->m_iTeam && !canFreeLook(pthis->entindex()))
|
||||
if (bSameTeam && pPlayer->m_iTeam != pthis->m_iTeam && !hasFlags(pthis->entindex()))
|
||||
return nullptr;
|
||||
|
||||
return pPlayer;
|
||||
@ -60,38 +72,20 @@ bool OnAmxxAttach()
|
||||
CVAR_REGISTER(&cv_admin_access_flags);
|
||||
pcv_admin_access_flags = CVAR_GET_POINTER(cv_admin_access_flags.name);
|
||||
|
||||
g_ReGameApi->GetHookchains()->CBasePlayer_Observer_IsValidTarget()->registerHook(&CBasePlayer_Observer_IsValidTarget);
|
||||
g_ReGameApi->GetHookchains()->GetForceCamera()->registerHook(&GetForceCamera);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnMetaAttach()
|
||||
{
|
||||
g_ReGameHookchains->InstallGameRules()->registerHook(&InstallGameRules);
|
||||
g_ReGameHookchains->CBasePlayer_Observer_IsValidTarget()->registerHook(&CBasePlayer_Observer_IsValidTarget);
|
||||
g_ReGameHookchains->GetForceCamera()->registerHook(&GetForceCamera);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnMetaDetach()
|
||||
{
|
||||
g_ReGameApi->GetHookchains()->CBasePlayer_Observer_IsValidTarget()->unregisterHook(&CBasePlayer_Observer_IsValidTarget);
|
||||
g_ReGameApi->GetHookchains()->GetForceCamera()->unregisterHook(&GetForceCamera);
|
||||
g_ReGameHookchains->InstallGameRules()->unregisterHook(&InstallGameRules);
|
||||
g_ReGameHookchains->CBasePlayer_Observer_IsValidTarget()->unregisterHook(&CBasePlayer_Observer_IsValidTarget);
|
||||
g_ReGameHookchains->GetForceCamera()->unregisterHook(&GetForceCamera);
|
||||
}
|
||||
|
||||
void OnPluginsLoaded()
|
||||
CGameRules *InstallGameRules(IReGameHook_InstallGameRules *chain)
|
||||
{
|
||||
// When set to 1, player's screen fades to black for the remainder of the round when he dies
|
||||
// (hud still works normally so player can chat and see the scores, etc.)
|
||||
// Overrides mp_forcechasecam
|
||||
pcv_fadetoblack = CVAR_GET_POINTER("mp_fadetoblack");
|
||||
|
||||
// 0 - You can spectate anyone
|
||||
// 1 - You can spectate teammates only + No Free Look
|
||||
// 2 - Only first person mode is allowed
|
||||
// 3 - You can spectate teammates only (Free Look works)
|
||||
pcv_forcecamera = CVAR_GET_POINTER("mp_forcecamera");
|
||||
|
||||
// 0 - You can spectate anyone
|
||||
// 1 - You can spectate teammates only + No Free Look
|
||||
// 2 - Only first person mode is allowed
|
||||
// 3 - You can spectate teammates only (Free Look works)
|
||||
pcv_forcechasecam = CVAR_GET_POINTER("mp_forcechasecam");
|
||||
return g_pGameRules = chain->callNext();
|
||||
}
|
||||
|
@ -3,3 +3,4 @@
|
||||
bool OnAmxxAttach();
|
||||
bool OnMetaAttach();
|
||||
void OnMetaDetach();
|
||||
CGameRules *InstallGameRules(IReGameHook_InstallGameRules *chain);
|
||||
|
@ -8,7 +8,7 @@ plugin_info_t Plugin_info =
|
||||
{
|
||||
META_INTERFACE_VERSION, // ifvers
|
||||
"ReFreeLook", // name
|
||||
"1.7", // version
|
||||
"1.8", // version
|
||||
__DATE__, // date
|
||||
"s1lent", // author
|
||||
"http://www.dedicated-server.ru", // url
|
||||
@ -42,11 +42,6 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
|
||||
gpMetaGlobals = pMGlobals;
|
||||
gpGamedllFuncs = pGamedllFuncs;
|
||||
|
||||
if (!OnMetaAttach())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS));
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user