mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-26 22:55:41 +03:00
Fix newlines
This commit is contained in:
parent
71c83fbd5b
commit
c2f62eb98a
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,270 +1,270 @@
|
||||
/*
|
||||
*
|
||||
* 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 "cs_bot_init.h"
|
||||
|
||||
extern CBotManager *TheBots;
|
||||
|
||||
// The manager for Counter-Strike specific bots
|
||||
class CCSBotManager: public CBotManager
|
||||
{
|
||||
public:
|
||||
CCSBotManager();
|
||||
|
||||
virtual void ClientDisconnect(CBasePlayer *pPlayer);
|
||||
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd);
|
||||
|
||||
virtual void ServerActivate();
|
||||
virtual void ServerDeactivate();
|
||||
|
||||
virtual void ServerCommand(const char *pcmd);
|
||||
virtual void AddServerCommand(const char *cmd);
|
||||
virtual void AddServerCommands();
|
||||
|
||||
virtual void RestartRound(); // (EXTEND) invoked when a new round begins
|
||||
virtual void StartFrame(); // (EXTEND) called each frame
|
||||
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr);
|
||||
virtual unsigned int GetPlayerPriority(CBasePlayer *pPlayer) const; // return priority of pPlayer (0 = max pri)
|
||||
virtual bool IsImportantPlayer(CBasePlayer *pPlayer) const; // return true if pPlayer is important to scenario (VIP, bomb carrier, etc)
|
||||
|
||||
public:
|
||||
void ValidateMapData();
|
||||
void OnFreeEntPrivateData(CBaseEntity *pEntity);
|
||||
bool IsLearningMap() const { return m_isLearningMap; }
|
||||
void SetLearningMapFlag() { m_isLearningMap = true; }
|
||||
bool IsAnalysisRequested() const { return m_isAnalysisRequested; }
|
||||
void RequestAnalysis() { m_isAnalysisRequested = true; }
|
||||
void AckAnalysisRequest() { m_isAnalysisRequested = false; }
|
||||
|
||||
// difficulty levels
|
||||
static BotDifficultyType GetDifficultyLevel()
|
||||
{
|
||||
if (cv_bot_difficulty.value < 0.9f)
|
||||
return BOT_EASY;
|
||||
|
||||
if (cv_bot_difficulty.value < 1.9f)
|
||||
return BOT_NORMAL;
|
||||
|
||||
if (cv_bot_difficulty.value < 2.9f)
|
||||
return BOT_HARD;
|
||||
|
||||
return BOT_EXPERT;
|
||||
}
|
||||
|
||||
// the supported game scenarios
|
||||
enum GameScenarioType
|
||||
{
|
||||
SCENARIO_DEATHMATCH,
|
||||
SCENARIO_DEFUSE_BOMB,
|
||||
SCENARIO_RESCUE_HOSTAGES,
|
||||
SCENARIO_ESCORT_VIP
|
||||
};
|
||||
|
||||
GameScenarioType GetScenario() const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// if we have included deathmatch mode, so set the game type like SCENARIO_DEATHMATCH
|
||||
if (cv_bot_deathmatch.value > 0)
|
||||
return SCENARIO_DEATHMATCH;
|
||||
#endif
|
||||
|
||||
return m_gameScenario;
|
||||
}
|
||||
|
||||
// "zones"
|
||||
// depending on the game mode, these are bomb zones, rescue zones, etc.
|
||||
enum { MAX_ZONES = 4 }; // max # of zones in a map
|
||||
enum { MAX_ZONE_NAV_AREAS = 16 }; // max # of nav areas in a zone
|
||||
struct Zone
|
||||
{
|
||||
CBaseEntity *m_entity; // the map entity
|
||||
CNavArea *m_area[MAX_ZONE_NAV_AREAS]; // nav areas that overlap this zone
|
||||
int m_areaCount;
|
||||
Vector m_center;
|
||||
bool m_isLegacy; // if true, use pev->origin and 256 unit radius as zone
|
||||
int m_index;
|
||||
Extent m_extent;
|
||||
};
|
||||
|
||||
const Zone *GetZone(int i) const { return &m_zone[i]; }
|
||||
const Zone *GetZone(const Vector *pos) const; // return the zone that contains the given position
|
||||
const Zone *GetClosestZone(const Vector *pos) const; // return the closest zone to the given position
|
||||
const Zone *GetClosestZone(const CBaseEntity *pEntity) const { return GetClosestZone(&pEntity->pev->origin); } // return the closest zone to the given entity
|
||||
int GetZoneCount() const { return m_zoneCount; }
|
||||
|
||||
const Vector *GetRandomPositionInZone(const Zone *zone) const;
|
||||
CNavArea *GetRandomAreaInZone(const Zone *zone) const;
|
||||
|
||||
// Return the zone closest to the given position, using the given cost heuristic
|
||||
template<typename CostFunctor>
|
||||
const Zone *GetClosestZone(CNavArea *startArea, CostFunctor costFunc, float *travelDistance = nullptr) const
|
||||
{
|
||||
const Zone *closeZone = nullptr;
|
||||
float closeDist = 99999999.9f;
|
||||
|
||||
if (startArea == nullptr)
|
||||
return nullptr;
|
||||
|
||||
for (int i = 0; i < m_zoneCount; i++)
|
||||
{
|
||||
if (m_zone[i].m_areaCount == 0)
|
||||
continue;
|
||||
|
||||
// just use the first overlapping nav area as a reasonable approximation
|
||||
real_t dist = NavAreaTravelDistance(startArea, m_zone[i].m_area[0], costFunc);
|
||||
|
||||
if (dist >= 0.0f && dist < closeDist)
|
||||
{
|
||||
closeZone = &m_zone[i];
|
||||
closeDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
if (travelDistance)
|
||||
*travelDistance = closeDist;
|
||||
|
||||
return closeZone;
|
||||
}
|
||||
|
||||
// pick a zone at random and return it
|
||||
const Zone *GetRandomZone() const
|
||||
{
|
||||
if (!m_zoneCount)
|
||||
return nullptr;
|
||||
|
||||
return &m_zone[RANDOM_LONG(0, m_zoneCount - 1)];
|
||||
}
|
||||
|
||||
bool IsBombPlanted() const { return m_isBombPlanted; } // returns true if bomb has been planted
|
||||
float GetBombPlantTimestamp() const { return m_bombPlantTimestamp; } // return time bomb was planted
|
||||
bool IsTimeToPlantBomb() const { return (gpGlobals->time >= m_earliestBombPlantTimestamp); } // return true if it's ok to try to plant bomb
|
||||
CBasePlayer *GetBombDefuser() const { return m_bombDefuser; } // return the player currently defusing the bomb, or NULL
|
||||
float GetBombTimeLeft() const; // get the time remaining before the planted bomb explodes
|
||||
CBaseEntity *GetLooseBomb() { return m_looseBomb; } // return the bomb if it is loose on the ground
|
||||
CNavArea *GetLooseBombArea() const { return m_looseBombArea; } // return area that bomb is in/near
|
||||
void SetLooseBomb(CBaseEntity *bomb);
|
||||
|
||||
float GetRadioMessageTimestamp(GameEventType event, int teamID) const; // return the last time the given radio message was sent for given team
|
||||
float GetRadioMessageInterval(GameEventType event, int teamID) const; // return the interval since the last time this message was sent
|
||||
void SetRadioMessageTimestamp(GameEventType event, int teamID);
|
||||
void ResetRadioMessageTimestamps();
|
||||
|
||||
float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy
|
||||
void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; }
|
||||
|
||||
float GetRoundStartTime() const { return m_roundStartTimestamp; }
|
||||
float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began
|
||||
|
||||
bool AllowRogues() const { return cv_bot_allow_rogues.value != 0.0f; }
|
||||
bool AllowPistols() const { return cv_bot_allow_pistols.value != 0.0f; }
|
||||
bool AllowShotguns() const { return cv_bot_allow_shotguns.value != 0.0f; }
|
||||
bool AllowSubMachineGuns() const { return cv_bot_allow_sub_machine_guns.value != 0.0f; }
|
||||
bool AllowRifles() const { return cv_bot_allow_rifles.value != 0.0f; }
|
||||
bool AllowMachineGuns() const { return cv_bot_allow_machine_guns.value != 0.0f; }
|
||||
bool AllowGrenades() const { return cv_bot_allow_grenades.value != 0.0f; }
|
||||
bool AllowSnipers() const { return cv_bot_allow_snipers.value != 0.0f; }
|
||||
bool AllowTacticalShield() const { return cv_bot_allow_shield.value != 0.0f; }
|
||||
bool AllowFriendlyFireDamage() const { return friendlyfire.value != 0.0f; }
|
||||
|
||||
bool IsWeaponUseable(CBasePlayerItem *item) const; // return true if the bot can use this weapon
|
||||
bool IsWeaponUseable(ArmouryItemPack item) const;
|
||||
|
||||
bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round
|
||||
bool IsOnDefense(CBasePlayer *pPlayer) const; // return true if this player is on "defense"
|
||||
bool IsOnOffense(CBasePlayer *pPlayer) const; // return true if this player is on "offense"
|
||||
|
||||
bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended
|
||||
|
||||
unsigned int GetNavPlace() const { return m_navPlace; }
|
||||
void SetNavPlace(unsigned int place) { m_navPlace = place; }
|
||||
|
||||
enum SkillType { LOW, AVERAGE, HIGH, RANDOM };
|
||||
const char *GetRandomBotName(SkillType skill);
|
||||
|
||||
void MonitorBotCVars();
|
||||
void MaintainBotQuota();
|
||||
bool AddBot(const BotProfile *profile, BotProfileTeamType team);
|
||||
|
||||
#define FROM_CONSOLE true
|
||||
bool BotAddCommand(BotProfileTeamType team, bool isFromConsole = false); // process the "bot_add" console command
|
||||
|
||||
private:
|
||||
static float m_flNextCVarCheck;
|
||||
static bool m_isMapDataLoaded; // true if we've attempted to load map data
|
||||
static bool m_isLearningMap;
|
||||
static bool m_isAnalysisRequested;
|
||||
|
||||
GameScenarioType m_gameScenario; // what kind of game are we playing
|
||||
|
||||
Zone m_zone[MAX_ZONES];
|
||||
int m_zoneCount;
|
||||
|
||||
bool m_isBombPlanted; // true if bomb has been planted
|
||||
float m_bombPlantTimestamp; // time bomb was planted
|
||||
float m_earliestBombPlantTimestamp; // don't allow planting until after this time has elapsed
|
||||
CBasePlayer *m_bombDefuser; // the player currently defusing a bomb
|
||||
EHANDLE m_looseBomb; // will be non-NULL if bomb is loose on the ground
|
||||
CNavArea *m_looseBombArea; // area that bomb is is/near
|
||||
|
||||
bool m_isRoundOver; // true if the round has ended
|
||||
|
||||
float m_radioMsgTimestamp[24][2];
|
||||
|
||||
float m_lastSeenEnemyTimestamp;
|
||||
float m_roundStartTimestamp; // the time when the current round began
|
||||
|
||||
bool m_isDefenseRushing; // whether defensive team is rushing this round or not
|
||||
|
||||
static NavEditCmdType m_editCmd;
|
||||
unsigned int m_navPlace;
|
||||
CountdownTimer m_respawnTimer;
|
||||
bool m_isRespawnStarted;
|
||||
bool m_canRespawn;
|
||||
bool m_bServerActive;
|
||||
};
|
||||
|
||||
inline int OtherTeam(int team)
|
||||
{
|
||||
return (team == TERRORIST) ? CT : TERRORIST;
|
||||
}
|
||||
|
||||
inline CCSBotManager *TheCSBots()
|
||||
{
|
||||
return reinterpret_cast<CCSBotManager *>(TheBots);
|
||||
}
|
||||
|
||||
// Determine whether bots can be used or not
|
||||
inline bool AreBotsAllowed()
|
||||
{
|
||||
return g_bAllowedCSBot;
|
||||
}
|
||||
|
||||
void PrintAllEntities();
|
||||
/*
|
||||
*
|
||||
* 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 "cs_bot_init.h"
|
||||
|
||||
extern CBotManager *TheBots;
|
||||
|
||||
// The manager for Counter-Strike specific bots
|
||||
class CCSBotManager: public CBotManager
|
||||
{
|
||||
public:
|
||||
CCSBotManager();
|
||||
|
||||
virtual void ClientDisconnect(CBasePlayer *pPlayer);
|
||||
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd);
|
||||
|
||||
virtual void ServerActivate();
|
||||
virtual void ServerDeactivate();
|
||||
|
||||
virtual void ServerCommand(const char *pcmd);
|
||||
virtual void AddServerCommand(const char *cmd);
|
||||
virtual void AddServerCommands();
|
||||
|
||||
virtual void RestartRound(); // (EXTEND) invoked when a new round begins
|
||||
virtual void StartFrame(); // (EXTEND) called each frame
|
||||
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr);
|
||||
virtual unsigned int GetPlayerPriority(CBasePlayer *pPlayer) const; // return priority of pPlayer (0 = max pri)
|
||||
virtual bool IsImportantPlayer(CBasePlayer *pPlayer) const; // return true if pPlayer is important to scenario (VIP, bomb carrier, etc)
|
||||
|
||||
public:
|
||||
void ValidateMapData();
|
||||
void OnFreeEntPrivateData(CBaseEntity *pEntity);
|
||||
bool IsLearningMap() const { return m_isLearningMap; }
|
||||
void SetLearningMapFlag() { m_isLearningMap = true; }
|
||||
bool IsAnalysisRequested() const { return m_isAnalysisRequested; }
|
||||
void RequestAnalysis() { m_isAnalysisRequested = true; }
|
||||
void AckAnalysisRequest() { m_isAnalysisRequested = false; }
|
||||
|
||||
// difficulty levels
|
||||
static BotDifficultyType GetDifficultyLevel()
|
||||
{
|
||||
if (cv_bot_difficulty.value < 0.9f)
|
||||
return BOT_EASY;
|
||||
|
||||
if (cv_bot_difficulty.value < 1.9f)
|
||||
return BOT_NORMAL;
|
||||
|
||||
if (cv_bot_difficulty.value < 2.9f)
|
||||
return BOT_HARD;
|
||||
|
||||
return BOT_EXPERT;
|
||||
}
|
||||
|
||||
// the supported game scenarios
|
||||
enum GameScenarioType
|
||||
{
|
||||
SCENARIO_DEATHMATCH,
|
||||
SCENARIO_DEFUSE_BOMB,
|
||||
SCENARIO_RESCUE_HOSTAGES,
|
||||
SCENARIO_ESCORT_VIP
|
||||
};
|
||||
|
||||
GameScenarioType GetScenario() const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// if we have included deathmatch mode, so set the game type like SCENARIO_DEATHMATCH
|
||||
if (cv_bot_deathmatch.value > 0)
|
||||
return SCENARIO_DEATHMATCH;
|
||||
#endif
|
||||
|
||||
return m_gameScenario;
|
||||
}
|
||||
|
||||
// "zones"
|
||||
// depending on the game mode, these are bomb zones, rescue zones, etc.
|
||||
enum { MAX_ZONES = 4 }; // max # of zones in a map
|
||||
enum { MAX_ZONE_NAV_AREAS = 16 }; // max # of nav areas in a zone
|
||||
struct Zone
|
||||
{
|
||||
CBaseEntity *m_entity; // the map entity
|
||||
CNavArea *m_area[MAX_ZONE_NAV_AREAS]; // nav areas that overlap this zone
|
||||
int m_areaCount;
|
||||
Vector m_center;
|
||||
bool m_isLegacy; // if true, use pev->origin and 256 unit radius as zone
|
||||
int m_index;
|
||||
Extent m_extent;
|
||||
};
|
||||
|
||||
const Zone *GetZone(int i) const { return &m_zone[i]; }
|
||||
const Zone *GetZone(const Vector *pos) const; // return the zone that contains the given position
|
||||
const Zone *GetClosestZone(const Vector *pos) const; // return the closest zone to the given position
|
||||
const Zone *GetClosestZone(const CBaseEntity *pEntity) const { return GetClosestZone(&pEntity->pev->origin); } // return the closest zone to the given entity
|
||||
int GetZoneCount() const { return m_zoneCount; }
|
||||
|
||||
const Vector *GetRandomPositionInZone(const Zone *zone) const;
|
||||
CNavArea *GetRandomAreaInZone(const Zone *zone) const;
|
||||
|
||||
// Return the zone closest to the given position, using the given cost heuristic
|
||||
template<typename CostFunctor>
|
||||
const Zone *GetClosestZone(CNavArea *startArea, CostFunctor costFunc, float *travelDistance = nullptr) const
|
||||
{
|
||||
const Zone *closeZone = nullptr;
|
||||
float closeDist = 99999999.9f;
|
||||
|
||||
if (startArea == nullptr)
|
||||
return nullptr;
|
||||
|
||||
for (int i = 0; i < m_zoneCount; i++)
|
||||
{
|
||||
if (m_zone[i].m_areaCount == 0)
|
||||
continue;
|
||||
|
||||
// just use the first overlapping nav area as a reasonable approximation
|
||||
real_t dist = NavAreaTravelDistance(startArea, m_zone[i].m_area[0], costFunc);
|
||||
|
||||
if (dist >= 0.0f && dist < closeDist)
|
||||
{
|
||||
closeZone = &m_zone[i];
|
||||
closeDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
if (travelDistance)
|
||||
*travelDistance = closeDist;
|
||||
|
||||
return closeZone;
|
||||
}
|
||||
|
||||
// pick a zone at random and return it
|
||||
const Zone *GetRandomZone() const
|
||||
{
|
||||
if (!m_zoneCount)
|
||||
return nullptr;
|
||||
|
||||
return &m_zone[RANDOM_LONG(0, m_zoneCount - 1)];
|
||||
}
|
||||
|
||||
bool IsBombPlanted() const { return m_isBombPlanted; } // returns true if bomb has been planted
|
||||
float GetBombPlantTimestamp() const { return m_bombPlantTimestamp; } // return time bomb was planted
|
||||
bool IsTimeToPlantBomb() const { return (gpGlobals->time >= m_earliestBombPlantTimestamp); } // return true if it's ok to try to plant bomb
|
||||
CBasePlayer *GetBombDefuser() const { return m_bombDefuser; } // return the player currently defusing the bomb, or NULL
|
||||
float GetBombTimeLeft() const; // get the time remaining before the planted bomb explodes
|
||||
CBaseEntity *GetLooseBomb() { return m_looseBomb; } // return the bomb if it is loose on the ground
|
||||
CNavArea *GetLooseBombArea() const { return m_looseBombArea; } // return area that bomb is in/near
|
||||
void SetLooseBomb(CBaseEntity *bomb);
|
||||
|
||||
float GetRadioMessageTimestamp(GameEventType event, int teamID) const; // return the last time the given radio message was sent for given team
|
||||
float GetRadioMessageInterval(GameEventType event, int teamID) const; // return the interval since the last time this message was sent
|
||||
void SetRadioMessageTimestamp(GameEventType event, int teamID);
|
||||
void ResetRadioMessageTimestamps();
|
||||
|
||||
float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy
|
||||
void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; }
|
||||
|
||||
float GetRoundStartTime() const { return m_roundStartTimestamp; }
|
||||
float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began
|
||||
|
||||
bool AllowRogues() const { return cv_bot_allow_rogues.value != 0.0f; }
|
||||
bool AllowPistols() const { return cv_bot_allow_pistols.value != 0.0f; }
|
||||
bool AllowShotguns() const { return cv_bot_allow_shotguns.value != 0.0f; }
|
||||
bool AllowSubMachineGuns() const { return cv_bot_allow_sub_machine_guns.value != 0.0f; }
|
||||
bool AllowRifles() const { return cv_bot_allow_rifles.value != 0.0f; }
|
||||
bool AllowMachineGuns() const { return cv_bot_allow_machine_guns.value != 0.0f; }
|
||||
bool AllowGrenades() const { return cv_bot_allow_grenades.value != 0.0f; }
|
||||
bool AllowSnipers() const { return cv_bot_allow_snipers.value != 0.0f; }
|
||||
bool AllowTacticalShield() const { return cv_bot_allow_shield.value != 0.0f; }
|
||||
bool AllowFriendlyFireDamage() const { return friendlyfire.value != 0.0f; }
|
||||
|
||||
bool IsWeaponUseable(CBasePlayerItem *item) const; // return true if the bot can use this weapon
|
||||
bool IsWeaponUseable(ArmouryItemPack item) const;
|
||||
|
||||
bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round
|
||||
bool IsOnDefense(CBasePlayer *pPlayer) const; // return true if this player is on "defense"
|
||||
bool IsOnOffense(CBasePlayer *pPlayer) const; // return true if this player is on "offense"
|
||||
|
||||
bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended
|
||||
|
||||
unsigned int GetNavPlace() const { return m_navPlace; }
|
||||
void SetNavPlace(unsigned int place) { m_navPlace = place; }
|
||||
|
||||
enum SkillType { LOW, AVERAGE, HIGH, RANDOM };
|
||||
const char *GetRandomBotName(SkillType skill);
|
||||
|
||||
void MonitorBotCVars();
|
||||
void MaintainBotQuota();
|
||||
bool AddBot(const BotProfile *profile, BotProfileTeamType team);
|
||||
|
||||
#define FROM_CONSOLE true
|
||||
bool BotAddCommand(BotProfileTeamType team, bool isFromConsole = false); // process the "bot_add" console command
|
||||
|
||||
private:
|
||||
static float m_flNextCVarCheck;
|
||||
static bool m_isMapDataLoaded; // true if we've attempted to load map data
|
||||
static bool m_isLearningMap;
|
||||
static bool m_isAnalysisRequested;
|
||||
|
||||
GameScenarioType m_gameScenario; // what kind of game are we playing
|
||||
|
||||
Zone m_zone[MAX_ZONES];
|
||||
int m_zoneCount;
|
||||
|
||||
bool m_isBombPlanted; // true if bomb has been planted
|
||||
float m_bombPlantTimestamp; // time bomb was planted
|
||||
float m_earliestBombPlantTimestamp; // don't allow planting until after this time has elapsed
|
||||
CBasePlayer *m_bombDefuser; // the player currently defusing a bomb
|
||||
EHANDLE m_looseBomb; // will be non-NULL if bomb is loose on the ground
|
||||
CNavArea *m_looseBombArea; // area that bomb is is/near
|
||||
|
||||
bool m_isRoundOver; // true if the round has ended
|
||||
|
||||
float m_radioMsgTimestamp[24][2];
|
||||
|
||||
float m_lastSeenEnemyTimestamp;
|
||||
float m_roundStartTimestamp; // the time when the current round began
|
||||
|
||||
bool m_isDefenseRushing; // whether defensive team is rushing this round or not
|
||||
|
||||
static NavEditCmdType m_editCmd;
|
||||
unsigned int m_navPlace;
|
||||
CountdownTimer m_respawnTimer;
|
||||
bool m_isRespawnStarted;
|
||||
bool m_canRespawn;
|
||||
bool m_bServerActive;
|
||||
};
|
||||
|
||||
inline int OtherTeam(int team)
|
||||
{
|
||||
return (team == TERRORIST) ? CT : TERRORIST;
|
||||
}
|
||||
|
||||
inline CCSBotManager *TheCSBots()
|
||||
{
|
||||
return reinterpret_cast<CCSBotManager *>(TheBots);
|
||||
}
|
||||
|
||||
// Determine whether bots can be used or not
|
||||
inline bool AreBotsAllowed()
|
||||
{
|
||||
return g_bAllowedCSBot;
|
||||
}
|
||||
|
||||
void PrintAllEntities();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,119 +1,119 @@
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
const int MAX_WEAPON_SLOTS = 5; // hud item selection slots
|
||||
const int MAX_ITEM_TYPES = 6; // hud item selection slots
|
||||
const int MAX_AMMO_SLOTS = 32; // not really slots
|
||||
const int MAX_ITEMS = 4; // hard coded item types
|
||||
|
||||
const int DEFAULT_FOV = 90; // the default field of view
|
||||
|
||||
#define HIDEHUD_WEAPONS BIT(0)
|
||||
#define HIDEHUD_FLASHLIGHT BIT(1)
|
||||
#define HIDEHUD_ALL BIT(2)
|
||||
#define HIDEHUD_HEALTH BIT(3)
|
||||
#define HIDEHUD_TIMER BIT(4)
|
||||
#define HIDEHUD_MONEY BIT(5)
|
||||
#define HIDEHUD_CROSSHAIR BIT(6)
|
||||
#define HIDEHUD_OBSERVER_CROSSHAIR BIT(7)
|
||||
|
||||
#define STATUSICON_HIDE 0
|
||||
#define STATUSICON_SHOW 1
|
||||
#define STATUSICON_FLASH 2
|
||||
|
||||
#define HUD_PRINTNOTIFY 1
|
||||
#define HUD_PRINTCONSOLE 2
|
||||
#define HUD_PRINTTALK 3
|
||||
#define HUD_PRINTCENTER 4
|
||||
#define HUD_PRINTRADIO 5
|
||||
|
||||
#define STATUS_NIGHTVISION_ON 1
|
||||
#define STATUS_NIGHTVISION_OFF 0
|
||||
|
||||
#define ITEM_STATUS_NIGHTVISION BIT(0)
|
||||
#define ITEM_STATUS_DEFUSER BIT(1)
|
||||
|
||||
#define SCORE_STATUS_DEAD BIT(0)
|
||||
#define SCORE_STATUS_BOMB BIT(1)
|
||||
#define SCORE_STATUS_VIP BIT(2)
|
||||
#define SCORE_STATUS_DEFKIT BIT(3)
|
||||
|
||||
// player data iuser3
|
||||
#define PLAYER_CAN_SHOOT BIT(0)
|
||||
#define PLAYER_FREEZE_TIME_OVER BIT(1)
|
||||
#define PLAYER_IN_BOMB_ZONE BIT(2)
|
||||
#define PLAYER_HOLDING_SHIELD BIT(3)
|
||||
#define PLAYER_PREVENT_DUCK BIT(4)
|
||||
#define PLAYER_PREVENT_CLIMB BIT(5) // The player can't climb ladder
|
||||
#define PLAYER_PREVENT_JUMP BIT(6)
|
||||
|
||||
#define MENU_KEY_1 BIT(0)
|
||||
#define MENU_KEY_2 BIT(1)
|
||||
#define MENU_KEY_3 BIT(2)
|
||||
#define MENU_KEY_4 BIT(3)
|
||||
#define MENU_KEY_5 BIT(4)
|
||||
#define MENU_KEY_6 BIT(5)
|
||||
#define MENU_KEY_7 BIT(6)
|
||||
#define MENU_KEY_8 BIT(7)
|
||||
#define MENU_KEY_9 BIT(8)
|
||||
#define MENU_KEY_0 BIT(9)
|
||||
|
||||
#define WEAPON_SUIT 31
|
||||
#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))
|
||||
|
||||
// custom enum
|
||||
enum VGUIMenu
|
||||
{
|
||||
VGUI_Menu_Team = 2,
|
||||
VGUI_Menu_MapBriefing = 4,
|
||||
|
||||
VGUI_Menu_Class_T = 26,
|
||||
VGUI_Menu_Class_CT,
|
||||
VGUI_Menu_Buy,
|
||||
VGUI_Menu_Buy_Pistol,
|
||||
VGUI_Menu_Buy_ShotGun,
|
||||
VGUI_Menu_Buy_Rifle,
|
||||
VGUI_Menu_Buy_SubMachineGun,
|
||||
VGUI_Menu_Buy_MachineGun,
|
||||
VGUI_Menu_Buy_Item,
|
||||
};
|
||||
|
||||
// custom enum
|
||||
enum VGUIMenuSlot
|
||||
{
|
||||
VGUI_MenuSlot_Buy_Pistol = 1,
|
||||
VGUI_MenuSlot_Buy_ShotGun,
|
||||
VGUI_MenuSlot_Buy_SubMachineGun,
|
||||
VGUI_MenuSlot_Buy_Rifle,
|
||||
VGUI_MenuSlot_Buy_MachineGun,
|
||||
VGUI_MenuSlot_Buy_PrimAmmo,
|
||||
VGUI_MenuSlot_Buy_SecAmmo,
|
||||
VGUI_MenuSlot_Buy_Item,
|
||||
};
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
const int MAX_WEAPON_SLOTS = 5; // hud item selection slots
|
||||
const int MAX_ITEM_TYPES = 6; // hud item selection slots
|
||||
const int MAX_AMMO_SLOTS = 32; // not really slots
|
||||
const int MAX_ITEMS = 4; // hard coded item types
|
||||
|
||||
const int DEFAULT_FOV = 90; // the default field of view
|
||||
|
||||
#define HIDEHUD_WEAPONS BIT(0)
|
||||
#define HIDEHUD_FLASHLIGHT BIT(1)
|
||||
#define HIDEHUD_ALL BIT(2)
|
||||
#define HIDEHUD_HEALTH BIT(3)
|
||||
#define HIDEHUD_TIMER BIT(4)
|
||||
#define HIDEHUD_MONEY BIT(5)
|
||||
#define HIDEHUD_CROSSHAIR BIT(6)
|
||||
#define HIDEHUD_OBSERVER_CROSSHAIR BIT(7)
|
||||
|
||||
#define STATUSICON_HIDE 0
|
||||
#define STATUSICON_SHOW 1
|
||||
#define STATUSICON_FLASH 2
|
||||
|
||||
#define HUD_PRINTNOTIFY 1
|
||||
#define HUD_PRINTCONSOLE 2
|
||||
#define HUD_PRINTTALK 3
|
||||
#define HUD_PRINTCENTER 4
|
||||
#define HUD_PRINTRADIO 5
|
||||
|
||||
#define STATUS_NIGHTVISION_ON 1
|
||||
#define STATUS_NIGHTVISION_OFF 0
|
||||
|
||||
#define ITEM_STATUS_NIGHTVISION BIT(0)
|
||||
#define ITEM_STATUS_DEFUSER BIT(1)
|
||||
|
||||
#define SCORE_STATUS_DEAD BIT(0)
|
||||
#define SCORE_STATUS_BOMB BIT(1)
|
||||
#define SCORE_STATUS_VIP BIT(2)
|
||||
#define SCORE_STATUS_DEFKIT BIT(3)
|
||||
|
||||
// player data iuser3
|
||||
#define PLAYER_CAN_SHOOT BIT(0)
|
||||
#define PLAYER_FREEZE_TIME_OVER BIT(1)
|
||||
#define PLAYER_IN_BOMB_ZONE BIT(2)
|
||||
#define PLAYER_HOLDING_SHIELD BIT(3)
|
||||
#define PLAYER_PREVENT_DUCK BIT(4)
|
||||
#define PLAYER_PREVENT_CLIMB BIT(5) // The player can't climb ladder
|
||||
#define PLAYER_PREVENT_JUMP BIT(6)
|
||||
|
||||
#define MENU_KEY_1 BIT(0)
|
||||
#define MENU_KEY_2 BIT(1)
|
||||
#define MENU_KEY_3 BIT(2)
|
||||
#define MENU_KEY_4 BIT(3)
|
||||
#define MENU_KEY_5 BIT(4)
|
||||
#define MENU_KEY_6 BIT(5)
|
||||
#define MENU_KEY_7 BIT(6)
|
||||
#define MENU_KEY_8 BIT(7)
|
||||
#define MENU_KEY_9 BIT(8)
|
||||
#define MENU_KEY_0 BIT(9)
|
||||
|
||||
#define WEAPON_SUIT 31
|
||||
#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))
|
||||
|
||||
// custom enum
|
||||
enum VGUIMenu
|
||||
{
|
||||
VGUI_Menu_Team = 2,
|
||||
VGUI_Menu_MapBriefing = 4,
|
||||
|
||||
VGUI_Menu_Class_T = 26,
|
||||
VGUI_Menu_Class_CT,
|
||||
VGUI_Menu_Buy,
|
||||
VGUI_Menu_Buy_Pistol,
|
||||
VGUI_Menu_Buy_ShotGun,
|
||||
VGUI_Menu_Buy_Rifle,
|
||||
VGUI_Menu_Buy_SubMachineGun,
|
||||
VGUI_Menu_Buy_MachineGun,
|
||||
VGUI_Menu_Buy_Item,
|
||||
};
|
||||
|
||||
// custom enum
|
||||
enum VGUIMenuSlot
|
||||
{
|
||||
VGUI_MenuSlot_Buy_Pistol = 1,
|
||||
VGUI_MenuSlot_Buy_ShotGun,
|
||||
VGUI_MenuSlot_Buy_SubMachineGun,
|
||||
VGUI_MenuSlot_Buy_Rifle,
|
||||
VGUI_MenuSlot_Buy_MachineGun,
|
||||
VGUI_MenuSlot_Buy_PrimAmmo,
|
||||
VGUI_MenuSlot_Buy_SecAmmo,
|
||||
VGUI_MenuSlot_Buy_Item,
|
||||
};
|
||||
|
@ -1,374 +1,374 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
void PlayerBlind(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, float fadeTime, float fadeHold, int alpha, Vector &color)
|
||||
{
|
||||
UTIL_ScreenFade(pPlayer, color, fadeTime, fadeHold, alpha, 0);
|
||||
|
||||
if (!fadetoblack.value)
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pObserver = UTIL_PlayerByIndex(i);
|
||||
if (pObserver && pObserver->IsObservingPlayer(pPlayer))
|
||||
{
|
||||
UTIL_ScreenFade(pObserver, color, fadeTime, fadeHold, alpha, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pPlayer->Blind(fadeTime * 0.33, fadeHold, fadeTime, alpha);
|
||||
|
||||
if (TheBots)
|
||||
{
|
||||
TheBots->OnEvent(EVENT_PLAYER_BLINDED_BY_FLASHBANG, pPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
void RadiusFlash_TraceLine_hook(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, Vector &vecSrc, Vector &vecSpot, TraceResult *tr)
|
||||
{
|
||||
UTIL_TraceLine(vecSrc, vecSpot, dont_ignore_monsters, ENT(pevInflictor), tr);
|
||||
}
|
||||
|
||||
void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
TraceResult tr;
|
||||
float flAdjustedDamage, falloff;
|
||||
Vector vecSpot;
|
||||
float flRadius = 1500;
|
||||
|
||||
if (flRadius)
|
||||
falloff = flDamage / flRadius;
|
||||
else
|
||||
falloff = 1;
|
||||
|
||||
int bInWater = (UTIL_PointContents(vecSrc) == CONTENTS_WATER);
|
||||
|
||||
vecSrc.z += 1;
|
||||
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, 1500.0)))
|
||||
{
|
||||
TraceResult tr2;
|
||||
Vector vecLOS;
|
||||
float flDot;
|
||||
float fadeTime;
|
||||
float fadeHold;
|
||||
int alpha;
|
||||
CBasePlayer *pPlayer;
|
||||
float currentHoldTime;
|
||||
|
||||
if (!pEntity->IsPlayer())
|
||||
continue;
|
||||
|
||||
pPlayer = (CBasePlayer *)pEntity;
|
||||
|
||||
if (pPlayer->pev->takedamage == DAMAGE_NO || pPlayer->pev->deadflag != DEAD_NO)
|
||||
continue;
|
||||
|
||||
if (bInWater && pPlayer->pev->waterlevel == 0)
|
||||
continue;
|
||||
|
||||
if (!bInWater && pPlayer->pev->waterlevel == 3)
|
||||
continue;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
vecSpot = pPlayer->EyePosition();
|
||||
#else
|
||||
// NOTE: See CBasePlayer::BodyTarget
|
||||
vecSpot = pPlayer->BodyTarget(vecSrc);
|
||||
#endif
|
||||
|
||||
g_ReGameHookchains.m_RadiusFlash_TraceLine.callChain(RadiusFlash_TraceLine_hook, pPlayer, pevInflictor, pevAttacker, vecSrc, vecSpot, &tr);
|
||||
|
||||
if (tr.flFraction != 1.0f && tr.pHit != pPlayer->pev->pContainingEntity)
|
||||
continue;
|
||||
|
||||
g_ReGameHookchains.m_RadiusFlash_TraceLine.callChain(RadiusFlash_TraceLine_hook, pPlayer, VARS(tr.pHit), pevAttacker, vecSpot, vecSrc, &tr2);
|
||||
|
||||
if (tr2.flFraction >= 1.0)
|
||||
{
|
||||
if (tr.fStartSolid)
|
||||
{
|
||||
tr.vecEndPos = vecSrc;
|
||||
tr.flFraction = 0;
|
||||
}
|
||||
|
||||
flAdjustedDamage = flDamage - (vecSrc - tr.vecEndPos).Length() * falloff;
|
||||
|
||||
if (flAdjustedDamage < 0)
|
||||
flAdjustedDamage = 0;
|
||||
|
||||
UTIL_MakeVectors(pPlayer->pev->v_angle);
|
||||
vecLOS = vecSrc - pPlayer->EarPosition();
|
||||
flDot = DotProduct(vecLOS, gpGlobals->v_forward);
|
||||
|
||||
if (flDot < 0)
|
||||
{
|
||||
alpha = 200;
|
||||
fadeTime = flAdjustedDamage * 1.75;
|
||||
fadeHold = flAdjustedDamage / 3.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha = 255;
|
||||
fadeTime = flAdjustedDamage * 3;
|
||||
fadeHold = flAdjustedDamage / 1.5;
|
||||
}
|
||||
|
||||
currentHoldTime = pPlayer->m_blindStartTime + pPlayer->m_blindHoldTime - gpGlobals->time;
|
||||
|
||||
if (currentHoldTime > 0.0 && alpha == 255)
|
||||
fadeHold += currentHoldTime;
|
||||
|
||||
if (pPlayer->m_blindStartTime != 0.0f && pPlayer->m_blindFadeTime != 0.0f)
|
||||
{
|
||||
if ((pPlayer->m_blindStartTime + pPlayer->m_blindFadeTime + pPlayer->m_blindHoldTime) > gpGlobals->time)
|
||||
{
|
||||
if (pPlayer->m_blindFadeTime > fadeTime)
|
||||
fadeTime = pPlayer->m_blindFadeTime;
|
||||
|
||||
if (pPlayer->m_blindAlpha >= alpha)
|
||||
alpha = pPlayer->m_blindAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
Vector color(255, 255, 255);
|
||||
g_ReGameHookchains.m_PlayerBlind.callChain(PlayerBlind, pPlayer, pevInflictor, pevAttacker, fadeTime, fadeHold, alpha, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *pEntity)
|
||||
{
|
||||
float retval = 0.0f;
|
||||
TraceResult tr;
|
||||
|
||||
const float topOfHead = 25.0f;
|
||||
const float standFeet = 34.0f;
|
||||
const float crouchFeet = 14.0f;
|
||||
const float edgeOffset = 13.0f;
|
||||
|
||||
const float damagePercentageChest = 0.40f;
|
||||
const float damagePercentageHead = 0.20f;
|
||||
const float damagePercentageFeet = 0.20f;
|
||||
const float damagePercentageRightSide = 0.10f;
|
||||
const float damagePercentageLeftSide = 0.10f;
|
||||
|
||||
if (!pEntity->IsPlayer())
|
||||
{
|
||||
// the entity is not a player, so the damage is all or nothing.
|
||||
UTIL_TraceLine(vecSrc, pEntity->pev->origin, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval = 1.0f;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
// check chest
|
||||
Vector vecChest = pEntity->pev->origin;
|
||||
UTIL_TraceLine(vecSrc, vecChest, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageChest;
|
||||
|
||||
// check top of head
|
||||
Vector vecHead = pEntity->pev->origin + Vector(0, 0, topOfHead);
|
||||
UTIL_TraceLine(vecSrc, vecHead, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageHead;
|
||||
|
||||
// check feet
|
||||
Vector vecFeet = pEntity->pev->origin;
|
||||
vecFeet.z -= (pEntity->pev->flags & FL_DUCKING) ? crouchFeet : standFeet;
|
||||
|
||||
UTIL_TraceLine(vecSrc, vecFeet, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageFeet;
|
||||
|
||||
Vector2D dir = (pEntity->pev->origin - vecSrc).Make2D();
|
||||
dir.NormalizeInPlace();
|
||||
|
||||
Vector2D perp(-dir.y * edgeOffset, dir.x * edgeOffset);
|
||||
Vector vecRightSide = pEntity->pev->origin + Vector(perp.x, perp.y, 0);
|
||||
Vector vecLeftSide = pEntity->pev->origin - Vector(perp.x, perp.y, 0);
|
||||
|
||||
// check right "edge"
|
||||
UTIL_TraceLine(vecSrc, vecRightSide, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageRightSide;
|
||||
|
||||
// check left "edge"
|
||||
UTIL_TraceLine(vecSrc, vecLeftSide, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageLeftSide;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
TraceResult tr;
|
||||
float flAdjustedDamage, falloff;
|
||||
Vector vecSpot;
|
||||
|
||||
if (flRadius)
|
||||
falloff = flDamage / flRadius;
|
||||
else
|
||||
falloff = 1.0;
|
||||
|
||||
int bInWater = (UTIL_PointContents(vecSrc) == CONTENTS_WATER);
|
||||
|
||||
// in case grenade is lying on the ground
|
||||
vecSrc.z += 1;
|
||||
|
||||
if (!pevAttacker)
|
||||
pevAttacker = pevInflictor;
|
||||
|
||||
// iterate on all entities in the vicinity.
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)))
|
||||
{
|
||||
if (pEntity->pev->takedamage != DAMAGE_NO)
|
||||
{
|
||||
// UNDONE: this should check a damage mask, not an ignore
|
||||
if (iClassIgnore != CLASS_NONE && pEntity->Classify() == iClassIgnore)
|
||||
continue;
|
||||
|
||||
// blast's don't tavel into or out of water
|
||||
if (bInWater && pEntity->pev->waterlevel == 0)
|
||||
continue;
|
||||
|
||||
if (!bInWater && pEntity->pev->waterlevel == 3)
|
||||
continue;
|
||||
|
||||
bool useLOS = false;
|
||||
float damageRatio = 1.0f;
|
||||
|
||||
if ((bitsDamageType & DMG_EXPLOSION) && AreRunningCZero())
|
||||
{
|
||||
useLOS = true;
|
||||
damageRatio = GetAmountOfPlayerVisible(vecSrc, pEntity);
|
||||
}
|
||||
|
||||
damageRatio = GetAmountOfPlayerVisible(vecSrc, pEntity);
|
||||
|
||||
float length;
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// allow to damage breakable objects
|
||||
if (FClassnameIs(pEntity->pev, "func_breakable"))
|
||||
length = (vecSrc - pEntity->Center()).Length();
|
||||
else
|
||||
#endif
|
||||
length = (vecSrc - pEntity->pev->origin).Length();
|
||||
|
||||
if (useLOS)
|
||||
{
|
||||
if (!flRadius)
|
||||
flRadius = flDamage;
|
||||
|
||||
if (!flDamage)
|
||||
flRadius = 0;
|
||||
|
||||
flAdjustedDamage = (flRadius - length) * (flRadius - length) * 1.25 / (flRadius * flRadius) * (damageRatio * flDamage) * 1.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
flAdjustedDamage = flDamage - length * falloff;
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// disable grenade damage through walls?
|
||||
if (hegrenade_penetration.string[0] == '1' && (bitsDamageType & DMG_EXPLOSION))
|
||||
{
|
||||
UTIL_TraceLine(vecSrc, pEntity->pev->origin, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction != 1.0f)
|
||||
flAdjustedDamage = 0.0f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// not allow inflict to the player damage is less than 1.0f and to entities not less than 0.0f
|
||||
if ((pEntity->Classify() == CLASS_PLAYER && flAdjustedDamage < 1.0f) || flAdjustedDamage <= 0.0f)
|
||||
continue;
|
||||
#else
|
||||
if (flAdjustedDamage < 0)
|
||||
flAdjustedDamage = 0;
|
||||
#endif
|
||||
pEntity->TakeDamage(pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
TraceResult tr;
|
||||
float flAdjustedDamage, falloff;
|
||||
Vector vecSpot;
|
||||
|
||||
if (flRadius)
|
||||
falloff = flDamage / flRadius;
|
||||
else
|
||||
falloff = 1.0;
|
||||
|
||||
int bInWater = (UTIL_PointContents(vecSrc) == CONTENTS_WATER);
|
||||
|
||||
// in case grenade is lying on the ground
|
||||
vecSrc.z += 1;
|
||||
|
||||
if (!pevAttacker)
|
||||
pevAttacker = pevInflictor;
|
||||
|
||||
// iterate on all entities in the vicinity.
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)))
|
||||
{
|
||||
if (pEntity->pev->takedamage != DAMAGE_NO)
|
||||
{
|
||||
// UNDONE: this should check a damage mask, not an ignore
|
||||
if (iClassIgnore != CLASS_NONE && pEntity->Classify() == iClassIgnore)
|
||||
continue;
|
||||
|
||||
// blast's don't tavel into or out of water
|
||||
if (bInWater && pEntity->pev->waterlevel == 0)
|
||||
continue;
|
||||
|
||||
if (!bInWater && pEntity->pev->waterlevel == 3)
|
||||
continue;
|
||||
|
||||
vecSpot = pEntity->BodyTarget(vecSrc);
|
||||
UTIL_TraceLine(vecSrc, vecSpot, dont_ignore_monsters, ENT(pevInflictor), &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f || tr.pHit == pEntity->edict())
|
||||
{
|
||||
if (tr.fStartSolid)
|
||||
{
|
||||
tr.vecEndPos = vecSrc;
|
||||
tr.flFraction = 0;
|
||||
}
|
||||
|
||||
flAdjustedDamage = flDamage - (vecSrc - pEntity->pev->origin).Length() * falloff;
|
||||
|
||||
if (flAdjustedDamage < 0)
|
||||
flAdjustedDamage = 0;
|
||||
|
||||
else if (flAdjustedDamage > 75)
|
||||
flAdjustedDamage = 75;
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
pEntity->TakeDamage(pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType);
|
||||
|
||||
else
|
||||
{
|
||||
ClearMultiDamage();
|
||||
pEntity->TraceAttack(pevInflictor, flAdjustedDamage, (tr.vecEndPos - vecSrc).Normalize(), &tr, bitsDamageType);
|
||||
ApplyMultiDamage(pevInflictor, pevAttacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "precompiled.h"
|
||||
|
||||
void PlayerBlind(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, float fadeTime, float fadeHold, int alpha, Vector &color)
|
||||
{
|
||||
UTIL_ScreenFade(pPlayer, color, fadeTime, fadeHold, alpha, 0);
|
||||
|
||||
if (!fadetoblack.value)
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pObserver = UTIL_PlayerByIndex(i);
|
||||
if (pObserver && pObserver->IsObservingPlayer(pPlayer))
|
||||
{
|
||||
UTIL_ScreenFade(pObserver, color, fadeTime, fadeHold, alpha, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pPlayer->Blind(fadeTime * 0.33, fadeHold, fadeTime, alpha);
|
||||
|
||||
if (TheBots)
|
||||
{
|
||||
TheBots->OnEvent(EVENT_PLAYER_BLINDED_BY_FLASHBANG, pPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
void RadiusFlash_TraceLine_hook(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, Vector &vecSrc, Vector &vecSpot, TraceResult *tr)
|
||||
{
|
||||
UTIL_TraceLine(vecSrc, vecSpot, dont_ignore_monsters, ENT(pevInflictor), tr);
|
||||
}
|
||||
|
||||
void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
TraceResult tr;
|
||||
float flAdjustedDamage, falloff;
|
||||
Vector vecSpot;
|
||||
float flRadius = 1500;
|
||||
|
||||
if (flRadius)
|
||||
falloff = flDamage / flRadius;
|
||||
else
|
||||
falloff = 1;
|
||||
|
||||
int bInWater = (UTIL_PointContents(vecSrc) == CONTENTS_WATER);
|
||||
|
||||
vecSrc.z += 1;
|
||||
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, 1500.0)))
|
||||
{
|
||||
TraceResult tr2;
|
||||
Vector vecLOS;
|
||||
float flDot;
|
||||
float fadeTime;
|
||||
float fadeHold;
|
||||
int alpha;
|
||||
CBasePlayer *pPlayer;
|
||||
float currentHoldTime;
|
||||
|
||||
if (!pEntity->IsPlayer())
|
||||
continue;
|
||||
|
||||
pPlayer = (CBasePlayer *)pEntity;
|
||||
|
||||
if (pPlayer->pev->takedamage == DAMAGE_NO || pPlayer->pev->deadflag != DEAD_NO)
|
||||
continue;
|
||||
|
||||
if (bInWater && pPlayer->pev->waterlevel == 0)
|
||||
continue;
|
||||
|
||||
if (!bInWater && pPlayer->pev->waterlevel == 3)
|
||||
continue;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
vecSpot = pPlayer->EyePosition();
|
||||
#else
|
||||
// NOTE: See CBasePlayer::BodyTarget
|
||||
vecSpot = pPlayer->BodyTarget(vecSrc);
|
||||
#endif
|
||||
|
||||
g_ReGameHookchains.m_RadiusFlash_TraceLine.callChain(RadiusFlash_TraceLine_hook, pPlayer, pevInflictor, pevAttacker, vecSrc, vecSpot, &tr);
|
||||
|
||||
if (tr.flFraction != 1.0f && tr.pHit != pPlayer->pev->pContainingEntity)
|
||||
continue;
|
||||
|
||||
g_ReGameHookchains.m_RadiusFlash_TraceLine.callChain(RadiusFlash_TraceLine_hook, pPlayer, VARS(tr.pHit), pevAttacker, vecSpot, vecSrc, &tr2);
|
||||
|
||||
if (tr2.flFraction >= 1.0)
|
||||
{
|
||||
if (tr.fStartSolid)
|
||||
{
|
||||
tr.vecEndPos = vecSrc;
|
||||
tr.flFraction = 0;
|
||||
}
|
||||
|
||||
flAdjustedDamage = flDamage - (vecSrc - tr.vecEndPos).Length() * falloff;
|
||||
|
||||
if (flAdjustedDamage < 0)
|
||||
flAdjustedDamage = 0;
|
||||
|
||||
UTIL_MakeVectors(pPlayer->pev->v_angle);
|
||||
vecLOS = vecSrc - pPlayer->EarPosition();
|
||||
flDot = DotProduct(vecLOS, gpGlobals->v_forward);
|
||||
|
||||
if (flDot < 0)
|
||||
{
|
||||
alpha = 200;
|
||||
fadeTime = flAdjustedDamage * 1.75;
|
||||
fadeHold = flAdjustedDamage / 3.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha = 255;
|
||||
fadeTime = flAdjustedDamage * 3;
|
||||
fadeHold = flAdjustedDamage / 1.5;
|
||||
}
|
||||
|
||||
currentHoldTime = pPlayer->m_blindStartTime + pPlayer->m_blindHoldTime - gpGlobals->time;
|
||||
|
||||
if (currentHoldTime > 0.0 && alpha == 255)
|
||||
fadeHold += currentHoldTime;
|
||||
|
||||
if (pPlayer->m_blindStartTime != 0.0f && pPlayer->m_blindFadeTime != 0.0f)
|
||||
{
|
||||
if ((pPlayer->m_blindStartTime + pPlayer->m_blindFadeTime + pPlayer->m_blindHoldTime) > gpGlobals->time)
|
||||
{
|
||||
if (pPlayer->m_blindFadeTime > fadeTime)
|
||||
fadeTime = pPlayer->m_blindFadeTime;
|
||||
|
||||
if (pPlayer->m_blindAlpha >= alpha)
|
||||
alpha = pPlayer->m_blindAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
Vector color(255, 255, 255);
|
||||
g_ReGameHookchains.m_PlayerBlind.callChain(PlayerBlind, pPlayer, pevInflictor, pevAttacker, fadeTime, fadeHold, alpha, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *pEntity)
|
||||
{
|
||||
float retval = 0.0f;
|
||||
TraceResult tr;
|
||||
|
||||
const float topOfHead = 25.0f;
|
||||
const float standFeet = 34.0f;
|
||||
const float crouchFeet = 14.0f;
|
||||
const float edgeOffset = 13.0f;
|
||||
|
||||
const float damagePercentageChest = 0.40f;
|
||||
const float damagePercentageHead = 0.20f;
|
||||
const float damagePercentageFeet = 0.20f;
|
||||
const float damagePercentageRightSide = 0.10f;
|
||||
const float damagePercentageLeftSide = 0.10f;
|
||||
|
||||
if (!pEntity->IsPlayer())
|
||||
{
|
||||
// the entity is not a player, so the damage is all or nothing.
|
||||
UTIL_TraceLine(vecSrc, pEntity->pev->origin, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval = 1.0f;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
// check chest
|
||||
Vector vecChest = pEntity->pev->origin;
|
||||
UTIL_TraceLine(vecSrc, vecChest, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageChest;
|
||||
|
||||
// check top of head
|
||||
Vector vecHead = pEntity->pev->origin + Vector(0, 0, topOfHead);
|
||||
UTIL_TraceLine(vecSrc, vecHead, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageHead;
|
||||
|
||||
// check feet
|
||||
Vector vecFeet = pEntity->pev->origin;
|
||||
vecFeet.z -= (pEntity->pev->flags & FL_DUCKING) ? crouchFeet : standFeet;
|
||||
|
||||
UTIL_TraceLine(vecSrc, vecFeet, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageFeet;
|
||||
|
||||
Vector2D dir = (pEntity->pev->origin - vecSrc).Make2D();
|
||||
dir.NormalizeInPlace();
|
||||
|
||||
Vector2D perp(-dir.y * edgeOffset, dir.x * edgeOffset);
|
||||
Vector vecRightSide = pEntity->pev->origin + Vector(perp.x, perp.y, 0);
|
||||
Vector vecLeftSide = pEntity->pev->origin - Vector(perp.x, perp.y, 0);
|
||||
|
||||
// check right "edge"
|
||||
UTIL_TraceLine(vecSrc, vecRightSide, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageRightSide;
|
||||
|
||||
// check left "edge"
|
||||
UTIL_TraceLine(vecSrc, vecLeftSide, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageLeftSide;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
TraceResult tr;
|
||||
float flAdjustedDamage, falloff;
|
||||
Vector vecSpot;
|
||||
|
||||
if (flRadius)
|
||||
falloff = flDamage / flRadius;
|
||||
else
|
||||
falloff = 1.0;
|
||||
|
||||
int bInWater = (UTIL_PointContents(vecSrc) == CONTENTS_WATER);
|
||||
|
||||
// in case grenade is lying on the ground
|
||||
vecSrc.z += 1;
|
||||
|
||||
if (!pevAttacker)
|
||||
pevAttacker = pevInflictor;
|
||||
|
||||
// iterate on all entities in the vicinity.
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)))
|
||||
{
|
||||
if (pEntity->pev->takedamage != DAMAGE_NO)
|
||||
{
|
||||
// UNDONE: this should check a damage mask, not an ignore
|
||||
if (iClassIgnore != CLASS_NONE && pEntity->Classify() == iClassIgnore)
|
||||
continue;
|
||||
|
||||
// blast's don't tavel into or out of water
|
||||
if (bInWater && pEntity->pev->waterlevel == 0)
|
||||
continue;
|
||||
|
||||
if (!bInWater && pEntity->pev->waterlevel == 3)
|
||||
continue;
|
||||
|
||||
bool useLOS = false;
|
||||
float damageRatio = 1.0f;
|
||||
|
||||
if ((bitsDamageType & DMG_EXPLOSION) && AreRunningCZero())
|
||||
{
|
||||
useLOS = true;
|
||||
damageRatio = GetAmountOfPlayerVisible(vecSrc, pEntity);
|
||||
}
|
||||
|
||||
damageRatio = GetAmountOfPlayerVisible(vecSrc, pEntity);
|
||||
|
||||
float length;
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// allow to damage breakable objects
|
||||
if (FClassnameIs(pEntity->pev, "func_breakable"))
|
||||
length = (vecSrc - pEntity->Center()).Length();
|
||||
else
|
||||
#endif
|
||||
length = (vecSrc - pEntity->pev->origin).Length();
|
||||
|
||||
if (useLOS)
|
||||
{
|
||||
if (!flRadius)
|
||||
flRadius = flDamage;
|
||||
|
||||
if (!flDamage)
|
||||
flRadius = 0;
|
||||
|
||||
flAdjustedDamage = (flRadius - length) * (flRadius - length) * 1.25 / (flRadius * flRadius) * (damageRatio * flDamage) * 1.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
flAdjustedDamage = flDamage - length * falloff;
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// disable grenade damage through walls?
|
||||
if (hegrenade_penetration.string[0] == '1' && (bitsDamageType & DMG_EXPLOSION))
|
||||
{
|
||||
UTIL_TraceLine(vecSrc, pEntity->pev->origin, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction != 1.0f)
|
||||
flAdjustedDamage = 0.0f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// not allow inflict to the player damage is less than 1.0f and to entities not less than 0.0f
|
||||
if ((pEntity->Classify() == CLASS_PLAYER && flAdjustedDamage < 1.0f) || flAdjustedDamage <= 0.0f)
|
||||
continue;
|
||||
#else
|
||||
if (flAdjustedDamage < 0)
|
||||
flAdjustedDamage = 0;
|
||||
#endif
|
||||
pEntity->TakeDamage(pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
TraceResult tr;
|
||||
float flAdjustedDamage, falloff;
|
||||
Vector vecSpot;
|
||||
|
||||
if (flRadius)
|
||||
falloff = flDamage / flRadius;
|
||||
else
|
||||
falloff = 1.0;
|
||||
|
||||
int bInWater = (UTIL_PointContents(vecSrc) == CONTENTS_WATER);
|
||||
|
||||
// in case grenade is lying on the ground
|
||||
vecSrc.z += 1;
|
||||
|
||||
if (!pevAttacker)
|
||||
pevAttacker = pevInflictor;
|
||||
|
||||
// iterate on all entities in the vicinity.
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)))
|
||||
{
|
||||
if (pEntity->pev->takedamage != DAMAGE_NO)
|
||||
{
|
||||
// UNDONE: this should check a damage mask, not an ignore
|
||||
if (iClassIgnore != CLASS_NONE && pEntity->Classify() == iClassIgnore)
|
||||
continue;
|
||||
|
||||
// blast's don't tavel into or out of water
|
||||
if (bInWater && pEntity->pev->waterlevel == 0)
|
||||
continue;
|
||||
|
||||
if (!bInWater && pEntity->pev->waterlevel == 3)
|
||||
continue;
|
||||
|
||||
vecSpot = pEntity->BodyTarget(vecSrc);
|
||||
UTIL_TraceLine(vecSrc, vecSpot, dont_ignore_monsters, ENT(pevInflictor), &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f || tr.pHit == pEntity->edict())
|
||||
{
|
||||
if (tr.fStartSolid)
|
||||
{
|
||||
tr.vecEndPos = vecSrc;
|
||||
tr.flFraction = 0;
|
||||
}
|
||||
|
||||
flAdjustedDamage = flDamage - (vecSrc - pEntity->pev->origin).Length() * falloff;
|
||||
|
||||
if (flAdjustedDamage < 0)
|
||||
flAdjustedDamage = 0;
|
||||
|
||||
else if (flAdjustedDamage > 75)
|
||||
flAdjustedDamage = 75;
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
pEntity->TakeDamage(pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType);
|
||||
|
||||
else
|
||||
{
|
||||
ClearMultiDamage();
|
||||
pEntity->TraceAttack(pevInflictor, flAdjustedDamage, (tr.vecEndPos - vecSrc).Normalize(), &tr, bitsDamageType);
|
||||
ApplyMultiDamage(pevInflictor, pevAttacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,85 +1,85 @@
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
#pragma warning(disable:4244) // int or float down-conversion
|
||||
#pragma warning(disable:4305) // int or float data truncation
|
||||
#pragma warning(disable:4201) // nameless struct/union
|
||||
#pragma warning(disable:4514) // unreferenced inline function removed
|
||||
#pragma warning(disable:4100) // unreferenced formal parameter
|
||||
|
||||
#include "archtypes.h"
|
||||
#include "maintypes.h"
|
||||
#include "strtools.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define NOWINRES
|
||||
#define NOSERVICE
|
||||
#define NOMCX
|
||||
#define NOIME
|
||||
#include "winsani_in.h"
|
||||
#include "windows.h"
|
||||
#include "winsani_out.h"
|
||||
#undef PlaySound
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#endif // _WIN32
|
||||
|
||||
// Misc C-runtime library headers
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
|
||||
// Header file containing definition of globalvars_t and entvars_t
|
||||
typedef int EOFFSET; // More explicit than "int"
|
||||
typedef unsigned int func_t;
|
||||
typedef float vec_t; // needed before including progdefs.h
|
||||
|
||||
// Vector class
|
||||
#include "vector.h"
|
||||
|
||||
// Defining it as a (bogus) struct helps enforce type-checking
|
||||
#define vec3_t Vector
|
||||
|
||||
// QString class
|
||||
#include "qstring.h"
|
||||
|
||||
// Shared engine/DLL constants
|
||||
#include "const.h"
|
||||
#include "edict.h"
|
||||
|
||||
// Shared header describing protocol between engine and DLLs
|
||||
#include "eiface.h"
|
||||
|
||||
// Shared header between the client DLL and the game DLLs
|
||||
#include "cdll_dll.h"
|
||||
#include "extdef.h"
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
#pragma warning(disable:4244) // int or float down-conversion
|
||||
#pragma warning(disable:4305) // int or float data truncation
|
||||
#pragma warning(disable:4201) // nameless struct/union
|
||||
#pragma warning(disable:4514) // unreferenced inline function removed
|
||||
#pragma warning(disable:4100) // unreferenced formal parameter
|
||||
|
||||
#include "archtypes.h"
|
||||
#include "maintypes.h"
|
||||
#include "strtools.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define NOWINRES
|
||||
#define NOSERVICE
|
||||
#define NOMCX
|
||||
#define NOIME
|
||||
#include "winsani_in.h"
|
||||
#include "windows.h"
|
||||
#include "winsani_out.h"
|
||||
#undef PlaySound
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#endif // _WIN32
|
||||
|
||||
// Misc C-runtime library headers
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
|
||||
// Header file containing definition of globalvars_t and entvars_t
|
||||
typedef int EOFFSET; // More explicit than "int"
|
||||
typedef unsigned int func_t;
|
||||
typedef float vec_t; // needed before including progdefs.h
|
||||
|
||||
// Vector class
|
||||
#include "vector.h"
|
||||
|
||||
// Defining it as a (bogus) struct helps enforce type-checking
|
||||
#define vec3_t Vector
|
||||
|
||||
// QString class
|
||||
#include "qstring.h"
|
||||
|
||||
// Shared engine/DLL constants
|
||||
#include "const.h"
|
||||
#include "edict.h"
|
||||
|
||||
// Shared header describing protocol between engine and DLLs
|
||||
#include "eiface.h"
|
||||
|
||||
// Shared header between the client DLL and the game DLLs
|
||||
#include "cdll_dll.h"
|
||||
#include "extdef.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,366 +1,366 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
cvar_t *g_pskill = nullptr;
|
||||
cvar_t *g_psv_gravity = nullptr;
|
||||
cvar_t *g_psv_aim = nullptr;
|
||||
cvar_t *g_footsteps = nullptr;
|
||||
cvar_t *g_psv_accelerate = nullptr;
|
||||
cvar_t *g_psv_friction = nullptr;
|
||||
cvar_t *g_psv_stopspeed = nullptr;
|
||||
cvar_t *g_psv_stepsize = nullptr;
|
||||
cvar_t *g_psv_clienttrace = nullptr;
|
||||
|
||||
cvar_t displaysoundlist = { "displaysoundlist", "0", 0, 0.0f, nullptr };
|
||||
cvar_t timelimit = { "mp_timelimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t flashlight = { "mp_flashlight", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t decalfrequency = { "decalfrequency", "30", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t fadetoblack = { "mp_fadetoblack", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t fragsleft = { "mp_fragsleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, nullptr }; // Don't spam console/log files/users with this changing
|
||||
cvar_t timeleft = { "mp_timeleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, nullptr };
|
||||
|
||||
cvar_t friendlyfire = { "mp_friendlyfire", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t infiniteAmmo = { "mp_infinite_ammo", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t infiniteGrenades = { "mp_infinite_grenades", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t allowmonsters = { "mp_allowmonsters", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t roundtime = { "mp_roundtime", "5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t buytime = { "mp_buytime", "1.5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t freezetime = { "mp_freezetime", "6", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t c4timer = { "mp_c4timer", "45", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ghostfrequency = { "mp_ghostfrequency", "0.1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autokick = { "mp_autokick", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autokick_timeout = { "mp_autokick_timeout", "-1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t restartround = { "sv_restartround", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t sv_restart = { "sv_restart", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t limitteams = { "mp_limitteams", "2", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autoteambalance = { "mp_autoteambalance", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t tkpunish = { "mp_tkpunish", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t hostagepenalty = { "mp_hostagepenalty", "13", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mirrordamage = { "mp_mirrordamage", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t logmessages = { "mp_logmessages", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t forcecamera = { "mp_forcecamera", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t forcechasecam = { "mp_forcechasecam", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mapvoteratio = { "mp_mapvoteratio", "0.66", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t logdetail = { "mp_logdetail", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t startmoney = { "mp_startmoney", "800", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t maxrounds = { "mp_maxrounds", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t winlimit = { "mp_winlimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t windifference = { "mp_windifference", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t playerid = { "mp_playerid", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t allow_spectators = { "allow_spectators", "1.0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mp_chattime = { "mp_chattime", "10", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t kick_percent = { "mp_kickpercent", "0.66", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t humans_join_team = { "humans_join_team", "any", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet1 = { "sk_plr_9mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet2 = { "sk_plr_9mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet3 = { "sk_plr_9mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet1 = { "sk_plr_357_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet2 = { "sk_plr_357_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet3 = { "sk_plr_357_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet1 = { "sk_plr_9mmAR_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet2 = { "sk_plr_9mmAR_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet3 = { "sk_plr_9mmAR_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade1 = { "sk_plr_9mmAR_grenade1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade2 = { "sk_plr_9mmAR_grenade2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade3 = { "sk_plr_9mmAR_grenade3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot1 = { "sk_plr_buckshot1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot2 = { "sk_plr_buckshot2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot3 = { "sk_plr_buckshot3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg1 = { "sk_plr_rpg1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg2 = { "sk_plr_rpg2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg3 = { "sk_plr_rpg3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet1 = { "sk_12mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet2 = { "sk_12mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet3 = { "sk_12mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet1 = { "sk_9mmAR_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet2 = { "sk_9mmAR_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet3 = { "sk_9mmAR_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet1 = { "sk_9mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet2 = { "sk_9mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet3 = { "sk_9mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger1 = { "sk_suitcharger1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger2 = { "sk_suitcharger2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger3 = { "sk_suitcharger3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery1 = { "sk_battery1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery2 = { "sk_battery2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery3 = { "sk_battery3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger1 = { "sk_healthcharger1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger2 = { "sk_healthcharger2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger3 = { "sk_healthcharger3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit1 = { "sk_healthkit1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit2 = { "sk_healthkit2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit3 = { "sk_healthkit3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal1 = { "sk_scientist_heal1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal2 = { "sk_scientist_heal2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal3 = { "sk_scientist_heal3", "0", 0, 0.0f, nullptr };
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
||||
cvar_t game_version = { "game_version", APP_VERSION, FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t maxmoney = { "mp_maxmoney", "16000", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t round_infinite = { "mp_round_infinite", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t hegrenade_penetration = { "mp_hegrenade_penetration", "0", 0, 0.0f, nullptr };
|
||||
cvar_t nadedrops = { "mp_nadedrops", "0", 0, 0.0f, nullptr };
|
||||
cvar_t roundrespawn_time = { "mp_roundrespawn_time", "20", 0, 20.0f, nullptr };
|
||||
cvar_t auto_reload_weapons = { "mp_auto_reload_weapons", "0", 0, 0.0f, nullptr };
|
||||
cvar_t refill_bpammo_weapons = { "mp_refill_bpammo_weapons", "0", 0, 0.0f, nullptr }; // Useful for mods like DeathMatch, GunGame, ZombieMod etc
|
||||
cvar_t freeforall = { "mp_freeforall", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t auto_join_team = { "mp_auto_join_team", "0", 0, 0.0f, nullptr };
|
||||
cvar_t max_teamkills = { "mp_max_teamkills", "3", 0, 3.0f, nullptr };
|
||||
cvar_t fraglimit = { "mp_fraglimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t round_restart_delay = { "mp_round_restart_delay", "5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t showtriggers = { "showtriggers", "0", 0, 0.0f, nullptr }; // debug cvar shows triggers
|
||||
// TODO: Maybe it's better to register in the engine?
|
||||
cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 1.0f, nullptr };
|
||||
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t show_radioicon = { "mp_show_radioicon", "1", 0, 1.0f, nullptr };
|
||||
cvar_t show_scenarioicon = { "mp_show_scenarioicon", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", 0, 1.0f, nullptr };
|
||||
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
|
||||
cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", 0, 1.0f, nullptr };
|
||||
cvar_t respawn_immunitytime = { "mp_respawn_immunitytime", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t respawn_immunity_effects = { "mp_respawn_immunity_effects", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", 0, 0.0f, nullptr };
|
||||
cvar_t afk_bomb_drop_time = { "mp_afk_bomb_drop_time", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t buy_anywhere = { "mp_buy_anywhere", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t allow_point_servercommand = { "mp_allow_point_servercommand", "0", 0, 0.0f, nullptr };
|
||||
cvar_t hullbounds_sets = { "mp_hullbounds_sets", "1", 0, 0.0f, nullptr };
|
||||
cvar_t unduck_method = { "mp_unduck_method", "0", 0, 0.0f, nullptr };
|
||||
|
||||
cvar_t scoreboard_showmoney = { "mp_scoreboard_showmoney", "3", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t scoreboard_showhealth = { "mp_scoreboard_showhealth", "3", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t ff_damage_reduction_bullets = { "ff_damage_reduction_bullets", "0.35", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ff_damage_reduction_grenade = { "ff_damage_reduction_grenade", "0.25", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ff_damage_reduction_grenade_self = { "ff_damage_reduction_grenade_self", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ff_damage_reduction_other = { "ff_damage_reduction_other", "0.25", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t radio_timeout = { "mp_radio_timeout", "1.5", FCVAR_SERVER, 1.5f, nullptr };
|
||||
cvar_t radio_maxinround = { "mp_radio_maxinround", "60", FCVAR_SERVER, 60.0f, nullptr };
|
||||
|
||||
void GameDLL_Version_f()
|
||||
{
|
||||
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
|
||||
return;
|
||||
|
||||
// print version
|
||||
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
|
||||
CONSOLE_ECHO("Build date: " APP_COMMIT_TIME " " APP_COMMIT_DATE "\n");
|
||||
CONSOLE_ECHO("Build from: " APP_COMMIT_URL APP_COMMIT_SHA "\n");
|
||||
}
|
||||
|
||||
void GameDLL_EndRound_f()
|
||||
{
|
||||
if (CMD_ARGC() == 2)
|
||||
{
|
||||
const char *pCmd = CMD_ARGV(1);
|
||||
|
||||
if (pCmd[0] == '1' || !Q_stricmp(pCmd, "T"))
|
||||
{
|
||||
CSGameRules()->OnRoundEnd_Intercept(WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, CSGameRules()->GetRoundRestartDelay());
|
||||
return;
|
||||
}
|
||||
else if (pCmd[0] == '2' || !Q_stricmp(pCmd, "CT"))
|
||||
{
|
||||
CSGameRules()->OnRoundEnd_Intercept(WINSTATUS_CTS, ROUND_CTS_WIN, CSGameRules()->GetRoundRestartDelay());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CSGameRules()->OnRoundEnd_Intercept(WINSTATUS_DRAW, ROUND_END_DRAW, CSGameRules()->GetRoundRestartDelay());
|
||||
}
|
||||
|
||||
#endif // REGAMEDLL_ADD
|
||||
|
||||
void EXT_FUNC GameDLLInit()
|
||||
{
|
||||
g_pskill = CVAR_GET_POINTER("skill");
|
||||
g_psv_gravity = CVAR_GET_POINTER("sv_gravity");
|
||||
g_psv_aim = CVAR_GET_POINTER("sv_aim");
|
||||
g_footsteps = CVAR_GET_POINTER("mp_footsteps");
|
||||
g_psv_accelerate = CVAR_GET_POINTER("sv_accelerate");
|
||||
g_psv_friction = CVAR_GET_POINTER("sv_friction");
|
||||
g_psv_stopspeed = CVAR_GET_POINTER("sv_stopspeed");
|
||||
g_psv_stepsize = CVAR_GET_POINTER("sv_stepsize");
|
||||
g_psv_clienttrace = CVAR_GET_POINTER("sv_clienttrace");
|
||||
|
||||
CVAR_REGISTER(&displaysoundlist);
|
||||
CVAR_REGISTER(&timelimit);
|
||||
CVAR_REGISTER(&friendlyfire);
|
||||
|
||||
#ifdef BUILD_LATEST
|
||||
CVAR_REGISTER(&infiniteAmmo);
|
||||
CVAR_REGISTER(&infiniteGrenades);
|
||||
#endif
|
||||
|
||||
CVAR_REGISTER(&flashlight);
|
||||
CVAR_REGISTER(&decalfrequency);
|
||||
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
CVAR_REGISTER(&allowmonsters);
|
||||
#endif
|
||||
|
||||
CVAR_REGISTER(&roundtime);
|
||||
CVAR_REGISTER(&buytime);
|
||||
CVAR_REGISTER(&freezetime);
|
||||
CVAR_REGISTER(&c4timer);
|
||||
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
CVAR_REGISTER(&ghostfrequency);
|
||||
#endif
|
||||
|
||||
CVAR_REGISTER(&autokick);
|
||||
CVAR_REGISTER(&autokick_timeout);
|
||||
CVAR_REGISTER(&restartround);
|
||||
CVAR_REGISTER(&sv_restart);
|
||||
CVAR_REGISTER(&limitteams);
|
||||
CVAR_REGISTER(&autoteambalance);
|
||||
CVAR_REGISTER(&tkpunish);
|
||||
CVAR_REGISTER(&hostagepenalty);
|
||||
CVAR_REGISTER(&mirrordamage);
|
||||
CVAR_REGISTER(&logmessages);
|
||||
CVAR_REGISTER(&forcecamera);
|
||||
CVAR_REGISTER(&forcechasecam);
|
||||
CVAR_REGISTER(&mapvoteratio);
|
||||
CVAR_REGISTER(&maxrounds);
|
||||
CVAR_REGISTER(&winlimit);
|
||||
CVAR_REGISTER(&windifference);
|
||||
CVAR_REGISTER(&fadetoblack);
|
||||
CVAR_REGISTER(&logdetail);
|
||||
CVAR_REGISTER(&startmoney);
|
||||
CVAR_REGISTER(&playerid);
|
||||
CVAR_REGISTER(&allow_spectators);
|
||||
CVAR_REGISTER(&mp_chattime);
|
||||
CVAR_REGISTER(&kick_percent);
|
||||
CVAR_REGISTER(&fragsleft);
|
||||
CVAR_REGISTER(&timeleft);
|
||||
CVAR_REGISTER(&humans_join_team);
|
||||
|
||||
#ifdef BUILD_LATEST
|
||||
if (AreRunningBeta())
|
||||
{
|
||||
CVAR_REGISTER(&scoreboard_showhealth);
|
||||
CVAR_REGISTER(&scoreboard_showmoney);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Remove unused cvars
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
|
||||
CVAR_REGISTER(&sk_plr_9mm_bullet1);
|
||||
CVAR_REGISTER(&sk_plr_9mm_bullet2);
|
||||
CVAR_REGISTER(&sk_plr_9mm_bullet3);
|
||||
CVAR_REGISTER(&sk_plr_357_bullet1);
|
||||
CVAR_REGISTER(&sk_plr_357_bullet2);
|
||||
CVAR_REGISTER(&sk_plr_357_bullet3);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_bullet1);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_bullet2);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_bullet3);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_grenade1);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_grenade2);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_grenade3);
|
||||
CVAR_REGISTER(&sk_plr_buckshot1);
|
||||
CVAR_REGISTER(&sk_plr_buckshot2);
|
||||
CVAR_REGISTER(&sk_plr_buckshot3);
|
||||
CVAR_REGISTER(&sk_plr_rpg1);
|
||||
CVAR_REGISTER(&sk_plr_rpg2);
|
||||
CVAR_REGISTER(&sk_plr_rpg3);
|
||||
CVAR_REGISTER(&sk_12mm_bullet1);
|
||||
CVAR_REGISTER(&sk_12mm_bullet2);
|
||||
CVAR_REGISTER(&sk_12mm_bullet3);
|
||||
CVAR_REGISTER(&sk_9mmAR_bullet1);
|
||||
CVAR_REGISTER(&sk_9mmAR_bullet2);
|
||||
CVAR_REGISTER(&sk_9mmAR_bullet3);
|
||||
CVAR_REGISTER(&sk_9mm_bullet1);
|
||||
CVAR_REGISTER(&sk_9mm_bullet2);
|
||||
CVAR_REGISTER(&sk_9mm_bullet3);
|
||||
CVAR_REGISTER(&sk_suitcharger1);
|
||||
CVAR_REGISTER(&sk_suitcharger2);
|
||||
CVAR_REGISTER(&sk_suitcharger3);
|
||||
CVAR_REGISTER(&sk_battery1);
|
||||
CVAR_REGISTER(&sk_battery2);
|
||||
CVAR_REGISTER(&sk_battery3);
|
||||
CVAR_REGISTER(&sk_healthcharger1);
|
||||
CVAR_REGISTER(&sk_healthcharger2);
|
||||
CVAR_REGISTER(&sk_healthcharger3);
|
||||
CVAR_REGISTER(&sk_healthkit1);
|
||||
CVAR_REGISTER(&sk_healthkit2);
|
||||
CVAR_REGISTER(&sk_healthkit3);
|
||||
CVAR_REGISTER(&sk_scientist_heal1);
|
||||
CVAR_REGISTER(&sk_scientist_heal2);
|
||||
CVAR_REGISTER(&sk_scientist_heal3);
|
||||
|
||||
#endif // REGAMEDLL_FIXES
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
||||
ADD_SERVER_COMMAND("game", GameDLL_Version_f);
|
||||
ADD_SERVER_COMMAND("endround", GameDLL_EndRound_f);
|
||||
|
||||
CVAR_REGISTER(&game_version);
|
||||
CVAR_REGISTER(&maxmoney);
|
||||
CVAR_REGISTER(&round_infinite);
|
||||
CVAR_REGISTER(&hegrenade_penetration);
|
||||
CVAR_REGISTER(&nadedrops);
|
||||
CVAR_REGISTER(&roundrespawn_time);
|
||||
CVAR_REGISTER(&auto_reload_weapons);
|
||||
CVAR_REGISTER(&refill_bpammo_weapons);
|
||||
CVAR_REGISTER(&freeforall);
|
||||
CVAR_REGISTER(&auto_join_team);
|
||||
CVAR_REGISTER(&max_teamkills);
|
||||
CVAR_REGISTER(&fraglimit);
|
||||
CVAR_REGISTER(&round_restart_delay);
|
||||
|
||||
CVAR_REGISTER(&showtriggers);
|
||||
CVAR_REGISTER(&hostagehurtable);
|
||||
CVAR_REGISTER(&roundover);
|
||||
CVAR_REGISTER(&forcerespawn);
|
||||
CVAR_REGISTER(&show_radioicon);
|
||||
|
||||
if (!AreRunningCZero())
|
||||
{
|
||||
CVAR_REGISTER(&show_scenarioicon);
|
||||
}
|
||||
|
||||
CVAR_REGISTER(&old_bomb_defused_sound);
|
||||
CVAR_REGISTER(&item_staytime);
|
||||
CVAR_REGISTER(&legacy_bombtarget_touch);
|
||||
CVAR_REGISTER(&respawn_immunitytime);
|
||||
CVAR_REGISTER(&respawn_immunity_effects);
|
||||
CVAR_REGISTER(&kill_filled_spawn);
|
||||
CVAR_REGISTER(&afk_bomb_drop_time);
|
||||
CVAR_REGISTER(&buy_anywhere);
|
||||
CVAR_REGISTER(&allow_point_servercommand);
|
||||
CVAR_REGISTER(&hullbounds_sets);
|
||||
CVAR_REGISTER(&unduck_method);
|
||||
|
||||
CVAR_REGISTER(&ff_damage_reduction_bullets);
|
||||
CVAR_REGISTER(&ff_damage_reduction_grenade);
|
||||
CVAR_REGISTER(&ff_damage_reduction_grenade_self);
|
||||
CVAR_REGISTER(&ff_damage_reduction_other);
|
||||
|
||||
CVAR_REGISTER(&radio_timeout);
|
||||
CVAR_REGISTER(&radio_maxinround);
|
||||
|
||||
// print version
|
||||
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
|
||||
|
||||
#endif // REGAMEDLL_ADD
|
||||
|
||||
Bot_RegisterCVars();
|
||||
Tutor_RegisterCVars();
|
||||
Hostage_RegisterCVars();
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
VoiceGameMgr_RegisterCVars();
|
||||
#endif
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// execute initial pre-configurations
|
||||
SERVER_COMMAND("exec game_init.cfg\n");
|
||||
SERVER_EXECUTE();
|
||||
#endif
|
||||
|
||||
}
|
||||
#include "precompiled.h"
|
||||
|
||||
cvar_t *g_pskill = nullptr;
|
||||
cvar_t *g_psv_gravity = nullptr;
|
||||
cvar_t *g_psv_aim = nullptr;
|
||||
cvar_t *g_footsteps = nullptr;
|
||||
cvar_t *g_psv_accelerate = nullptr;
|
||||
cvar_t *g_psv_friction = nullptr;
|
||||
cvar_t *g_psv_stopspeed = nullptr;
|
||||
cvar_t *g_psv_stepsize = nullptr;
|
||||
cvar_t *g_psv_clienttrace = nullptr;
|
||||
|
||||
cvar_t displaysoundlist = { "displaysoundlist", "0", 0, 0.0f, nullptr };
|
||||
cvar_t timelimit = { "mp_timelimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t flashlight = { "mp_flashlight", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t decalfrequency = { "decalfrequency", "30", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t fadetoblack = { "mp_fadetoblack", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t fragsleft = { "mp_fragsleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, nullptr }; // Don't spam console/log files/users with this changing
|
||||
cvar_t timeleft = { "mp_timeleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, nullptr };
|
||||
|
||||
cvar_t friendlyfire = { "mp_friendlyfire", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t infiniteAmmo = { "mp_infinite_ammo", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t infiniteGrenades = { "mp_infinite_grenades", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t allowmonsters = { "mp_allowmonsters", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t roundtime = { "mp_roundtime", "5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t buytime = { "mp_buytime", "1.5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t freezetime = { "mp_freezetime", "6", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t c4timer = { "mp_c4timer", "45", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ghostfrequency = { "mp_ghostfrequency", "0.1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autokick = { "mp_autokick", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autokick_timeout = { "mp_autokick_timeout", "-1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t restartround = { "sv_restartround", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t sv_restart = { "sv_restart", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t limitteams = { "mp_limitteams", "2", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autoteambalance = { "mp_autoteambalance", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t tkpunish = { "mp_tkpunish", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t hostagepenalty = { "mp_hostagepenalty", "13", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mirrordamage = { "mp_mirrordamage", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t logmessages = { "mp_logmessages", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t forcecamera = { "mp_forcecamera", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t forcechasecam = { "mp_forcechasecam", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mapvoteratio = { "mp_mapvoteratio", "0.66", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t logdetail = { "mp_logdetail", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t startmoney = { "mp_startmoney", "800", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t maxrounds = { "mp_maxrounds", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t winlimit = { "mp_winlimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t windifference = { "mp_windifference", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t playerid = { "mp_playerid", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t allow_spectators = { "allow_spectators", "1.0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mp_chattime = { "mp_chattime", "10", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t kick_percent = { "mp_kickpercent", "0.66", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t humans_join_team = { "humans_join_team", "any", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet1 = { "sk_plr_9mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet2 = { "sk_plr_9mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet3 = { "sk_plr_9mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet1 = { "sk_plr_357_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet2 = { "sk_plr_357_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet3 = { "sk_plr_357_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet1 = { "sk_plr_9mmAR_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet2 = { "sk_plr_9mmAR_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet3 = { "sk_plr_9mmAR_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade1 = { "sk_plr_9mmAR_grenade1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade2 = { "sk_plr_9mmAR_grenade2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade3 = { "sk_plr_9mmAR_grenade3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot1 = { "sk_plr_buckshot1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot2 = { "sk_plr_buckshot2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot3 = { "sk_plr_buckshot3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg1 = { "sk_plr_rpg1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg2 = { "sk_plr_rpg2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg3 = { "sk_plr_rpg3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet1 = { "sk_12mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet2 = { "sk_12mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet3 = { "sk_12mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet1 = { "sk_9mmAR_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet2 = { "sk_9mmAR_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet3 = { "sk_9mmAR_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet1 = { "sk_9mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet2 = { "sk_9mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet3 = { "sk_9mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger1 = { "sk_suitcharger1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger2 = { "sk_suitcharger2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger3 = { "sk_suitcharger3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery1 = { "sk_battery1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery2 = { "sk_battery2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery3 = { "sk_battery3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger1 = { "sk_healthcharger1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger2 = { "sk_healthcharger2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger3 = { "sk_healthcharger3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit1 = { "sk_healthkit1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit2 = { "sk_healthkit2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit3 = { "sk_healthkit3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal1 = { "sk_scientist_heal1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal2 = { "sk_scientist_heal2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal3 = { "sk_scientist_heal3", "0", 0, 0.0f, nullptr };
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
||||
cvar_t game_version = { "game_version", APP_VERSION, FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t maxmoney = { "mp_maxmoney", "16000", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t round_infinite = { "mp_round_infinite", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t hegrenade_penetration = { "mp_hegrenade_penetration", "0", 0, 0.0f, nullptr };
|
||||
cvar_t nadedrops = { "mp_nadedrops", "0", 0, 0.0f, nullptr };
|
||||
cvar_t roundrespawn_time = { "mp_roundrespawn_time", "20", 0, 20.0f, nullptr };
|
||||
cvar_t auto_reload_weapons = { "mp_auto_reload_weapons", "0", 0, 0.0f, nullptr };
|
||||
cvar_t refill_bpammo_weapons = { "mp_refill_bpammo_weapons", "0", 0, 0.0f, nullptr }; // Useful for mods like DeathMatch, GunGame, ZombieMod etc
|
||||
cvar_t freeforall = { "mp_freeforall", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t auto_join_team = { "mp_auto_join_team", "0", 0, 0.0f, nullptr };
|
||||
cvar_t max_teamkills = { "mp_max_teamkills", "3", 0, 3.0f, nullptr };
|
||||
cvar_t fraglimit = { "mp_fraglimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t round_restart_delay = { "mp_round_restart_delay", "5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t showtriggers = { "showtriggers", "0", 0, 0.0f, nullptr }; // debug cvar shows triggers
|
||||
// TODO: Maybe it's better to register in the engine?
|
||||
cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 1.0f, nullptr };
|
||||
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t show_radioicon = { "mp_show_radioicon", "1", 0, 1.0f, nullptr };
|
||||
cvar_t show_scenarioicon = { "mp_show_scenarioicon", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", 0, 1.0f, nullptr };
|
||||
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
|
||||
cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", 0, 1.0f, nullptr };
|
||||
cvar_t respawn_immunitytime = { "mp_respawn_immunitytime", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t respawn_immunity_effects = { "mp_respawn_immunity_effects", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", 0, 0.0f, nullptr };
|
||||
cvar_t afk_bomb_drop_time = { "mp_afk_bomb_drop_time", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t buy_anywhere = { "mp_buy_anywhere", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t allow_point_servercommand = { "mp_allow_point_servercommand", "0", 0, 0.0f, nullptr };
|
||||
cvar_t hullbounds_sets = { "mp_hullbounds_sets", "1", 0, 0.0f, nullptr };
|
||||
cvar_t unduck_method = { "mp_unduck_method", "0", 0, 0.0f, nullptr };
|
||||
|
||||
cvar_t scoreboard_showmoney = { "mp_scoreboard_showmoney", "3", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t scoreboard_showhealth = { "mp_scoreboard_showhealth", "3", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t ff_damage_reduction_bullets = { "ff_damage_reduction_bullets", "0.35", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ff_damage_reduction_grenade = { "ff_damage_reduction_grenade", "0.25", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ff_damage_reduction_grenade_self = { "ff_damage_reduction_grenade_self", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ff_damage_reduction_other = { "ff_damage_reduction_other", "0.25", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t radio_timeout = { "mp_radio_timeout", "1.5", FCVAR_SERVER, 1.5f, nullptr };
|
||||
cvar_t radio_maxinround = { "mp_radio_maxinround", "60", FCVAR_SERVER, 60.0f, nullptr };
|
||||
|
||||
void GameDLL_Version_f()
|
||||
{
|
||||
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
|
||||
return;
|
||||
|
||||
// print version
|
||||
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
|
||||
CONSOLE_ECHO("Build date: " APP_COMMIT_TIME " " APP_COMMIT_DATE "\n");
|
||||
CONSOLE_ECHO("Build from: " APP_COMMIT_URL APP_COMMIT_SHA "\n");
|
||||
}
|
||||
|
||||
void GameDLL_EndRound_f()
|
||||
{
|
||||
if (CMD_ARGC() == 2)
|
||||
{
|
||||
const char *pCmd = CMD_ARGV(1);
|
||||
|
||||
if (pCmd[0] == '1' || !Q_stricmp(pCmd, "T"))
|
||||
{
|
||||
CSGameRules()->OnRoundEnd_Intercept(WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, CSGameRules()->GetRoundRestartDelay());
|
||||
return;
|
||||
}
|
||||
else if (pCmd[0] == '2' || !Q_stricmp(pCmd, "CT"))
|
||||
{
|
||||
CSGameRules()->OnRoundEnd_Intercept(WINSTATUS_CTS, ROUND_CTS_WIN, CSGameRules()->GetRoundRestartDelay());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CSGameRules()->OnRoundEnd_Intercept(WINSTATUS_DRAW, ROUND_END_DRAW, CSGameRules()->GetRoundRestartDelay());
|
||||
}
|
||||
|
||||
#endif // REGAMEDLL_ADD
|
||||
|
||||
void EXT_FUNC GameDLLInit()
|
||||
{
|
||||
g_pskill = CVAR_GET_POINTER("skill");
|
||||
g_psv_gravity = CVAR_GET_POINTER("sv_gravity");
|
||||
g_psv_aim = CVAR_GET_POINTER("sv_aim");
|
||||
g_footsteps = CVAR_GET_POINTER("mp_footsteps");
|
||||
g_psv_accelerate = CVAR_GET_POINTER("sv_accelerate");
|
||||
g_psv_friction = CVAR_GET_POINTER("sv_friction");
|
||||
g_psv_stopspeed = CVAR_GET_POINTER("sv_stopspeed");
|
||||
g_psv_stepsize = CVAR_GET_POINTER("sv_stepsize");
|
||||
g_psv_clienttrace = CVAR_GET_POINTER("sv_clienttrace");
|
||||
|
||||
CVAR_REGISTER(&displaysoundlist);
|
||||
CVAR_REGISTER(&timelimit);
|
||||
CVAR_REGISTER(&friendlyfire);
|
||||
|
||||
#ifdef BUILD_LATEST
|
||||
CVAR_REGISTER(&infiniteAmmo);
|
||||
CVAR_REGISTER(&infiniteGrenades);
|
||||
#endif
|
||||
|
||||
CVAR_REGISTER(&flashlight);
|
||||
CVAR_REGISTER(&decalfrequency);
|
||||
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
CVAR_REGISTER(&allowmonsters);
|
||||
#endif
|
||||
|
||||
CVAR_REGISTER(&roundtime);
|
||||
CVAR_REGISTER(&buytime);
|
||||
CVAR_REGISTER(&freezetime);
|
||||
CVAR_REGISTER(&c4timer);
|
||||
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
CVAR_REGISTER(&ghostfrequency);
|
||||
#endif
|
||||
|
||||
CVAR_REGISTER(&autokick);
|
||||
CVAR_REGISTER(&autokick_timeout);
|
||||
CVAR_REGISTER(&restartround);
|
||||
CVAR_REGISTER(&sv_restart);
|
||||
CVAR_REGISTER(&limitteams);
|
||||
CVAR_REGISTER(&autoteambalance);
|
||||
CVAR_REGISTER(&tkpunish);
|
||||
CVAR_REGISTER(&hostagepenalty);
|
||||
CVAR_REGISTER(&mirrordamage);
|
||||
CVAR_REGISTER(&logmessages);
|
||||
CVAR_REGISTER(&forcecamera);
|
||||
CVAR_REGISTER(&forcechasecam);
|
||||
CVAR_REGISTER(&mapvoteratio);
|
||||
CVAR_REGISTER(&maxrounds);
|
||||
CVAR_REGISTER(&winlimit);
|
||||
CVAR_REGISTER(&windifference);
|
||||
CVAR_REGISTER(&fadetoblack);
|
||||
CVAR_REGISTER(&logdetail);
|
||||
CVAR_REGISTER(&startmoney);
|
||||
CVAR_REGISTER(&playerid);
|
||||
CVAR_REGISTER(&allow_spectators);
|
||||
CVAR_REGISTER(&mp_chattime);
|
||||
CVAR_REGISTER(&kick_percent);
|
||||
CVAR_REGISTER(&fragsleft);
|
||||
CVAR_REGISTER(&timeleft);
|
||||
CVAR_REGISTER(&humans_join_team);
|
||||
|
||||
#ifdef BUILD_LATEST
|
||||
if (AreRunningBeta())
|
||||
{
|
||||
CVAR_REGISTER(&scoreboard_showhealth);
|
||||
CVAR_REGISTER(&scoreboard_showmoney);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Remove unused cvars
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
|
||||
CVAR_REGISTER(&sk_plr_9mm_bullet1);
|
||||
CVAR_REGISTER(&sk_plr_9mm_bullet2);
|
||||
CVAR_REGISTER(&sk_plr_9mm_bullet3);
|
||||
CVAR_REGISTER(&sk_plr_357_bullet1);
|
||||
CVAR_REGISTER(&sk_plr_357_bullet2);
|
||||
CVAR_REGISTER(&sk_plr_357_bullet3);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_bullet1);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_bullet2);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_bullet3);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_grenade1);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_grenade2);
|
||||
CVAR_REGISTER(&sk_plr_9mmAR_grenade3);
|
||||
CVAR_REGISTER(&sk_plr_buckshot1);
|
||||
CVAR_REGISTER(&sk_plr_buckshot2);
|
||||
CVAR_REGISTER(&sk_plr_buckshot3);
|
||||
CVAR_REGISTER(&sk_plr_rpg1);
|
||||
CVAR_REGISTER(&sk_plr_rpg2);
|
||||
CVAR_REGISTER(&sk_plr_rpg3);
|
||||
CVAR_REGISTER(&sk_12mm_bullet1);
|
||||
CVAR_REGISTER(&sk_12mm_bullet2);
|
||||
CVAR_REGISTER(&sk_12mm_bullet3);
|
||||
CVAR_REGISTER(&sk_9mmAR_bullet1);
|
||||
CVAR_REGISTER(&sk_9mmAR_bullet2);
|
||||
CVAR_REGISTER(&sk_9mmAR_bullet3);
|
||||
CVAR_REGISTER(&sk_9mm_bullet1);
|
||||
CVAR_REGISTER(&sk_9mm_bullet2);
|
||||
CVAR_REGISTER(&sk_9mm_bullet3);
|
||||
CVAR_REGISTER(&sk_suitcharger1);
|
||||
CVAR_REGISTER(&sk_suitcharger2);
|
||||
CVAR_REGISTER(&sk_suitcharger3);
|
||||
CVAR_REGISTER(&sk_battery1);
|
||||
CVAR_REGISTER(&sk_battery2);
|
||||
CVAR_REGISTER(&sk_battery3);
|
||||
CVAR_REGISTER(&sk_healthcharger1);
|
||||
CVAR_REGISTER(&sk_healthcharger2);
|
||||
CVAR_REGISTER(&sk_healthcharger3);
|
||||
CVAR_REGISTER(&sk_healthkit1);
|
||||
CVAR_REGISTER(&sk_healthkit2);
|
||||
CVAR_REGISTER(&sk_healthkit3);
|
||||
CVAR_REGISTER(&sk_scientist_heal1);
|
||||
CVAR_REGISTER(&sk_scientist_heal2);
|
||||
CVAR_REGISTER(&sk_scientist_heal3);
|
||||
|
||||
#endif // REGAMEDLL_FIXES
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
||||
ADD_SERVER_COMMAND("game", GameDLL_Version_f);
|
||||
ADD_SERVER_COMMAND("endround", GameDLL_EndRound_f);
|
||||
|
||||
CVAR_REGISTER(&game_version);
|
||||
CVAR_REGISTER(&maxmoney);
|
||||
CVAR_REGISTER(&round_infinite);
|
||||
CVAR_REGISTER(&hegrenade_penetration);
|
||||
CVAR_REGISTER(&nadedrops);
|
||||
CVAR_REGISTER(&roundrespawn_time);
|
||||
CVAR_REGISTER(&auto_reload_weapons);
|
||||
CVAR_REGISTER(&refill_bpammo_weapons);
|
||||
CVAR_REGISTER(&freeforall);
|
||||
CVAR_REGISTER(&auto_join_team);
|
||||
CVAR_REGISTER(&max_teamkills);
|
||||
CVAR_REGISTER(&fraglimit);
|
||||
CVAR_REGISTER(&round_restart_delay);
|
||||
|
||||
CVAR_REGISTER(&showtriggers);
|
||||
CVAR_REGISTER(&hostagehurtable);
|
||||
CVAR_REGISTER(&roundover);
|
||||
CVAR_REGISTER(&forcerespawn);
|
||||
CVAR_REGISTER(&show_radioicon);
|
||||
|
||||
if (!AreRunningCZero())
|
||||
{
|
||||
CVAR_REGISTER(&show_scenarioicon);
|
||||
}
|
||||
|
||||
CVAR_REGISTER(&old_bomb_defused_sound);
|
||||
CVAR_REGISTER(&item_staytime);
|
||||
CVAR_REGISTER(&legacy_bombtarget_touch);
|
||||
CVAR_REGISTER(&respawn_immunitytime);
|
||||
CVAR_REGISTER(&respawn_immunity_effects);
|
||||
CVAR_REGISTER(&kill_filled_spawn);
|
||||
CVAR_REGISTER(&afk_bomb_drop_time);
|
||||
CVAR_REGISTER(&buy_anywhere);
|
||||
CVAR_REGISTER(&allow_point_servercommand);
|
||||
CVAR_REGISTER(&hullbounds_sets);
|
||||
CVAR_REGISTER(&unduck_method);
|
||||
|
||||
CVAR_REGISTER(&ff_damage_reduction_bullets);
|
||||
CVAR_REGISTER(&ff_damage_reduction_grenade);
|
||||
CVAR_REGISTER(&ff_damage_reduction_grenade_self);
|
||||
CVAR_REGISTER(&ff_damage_reduction_other);
|
||||
|
||||
CVAR_REGISTER(&radio_timeout);
|
||||
CVAR_REGISTER(&radio_maxinround);
|
||||
|
||||
// print version
|
||||
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
|
||||
|
||||
#endif // REGAMEDLL_ADD
|
||||
|
||||
Bot_RegisterCVars();
|
||||
Tutor_RegisterCVars();
|
||||
Hostage_RegisterCVars();
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
VoiceGameMgr_RegisterCVars();
|
||||
#endif
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// execute initial pre-configurations
|
||||
SERVER_COMMAND("exec game_init.cfg\n");
|
||||
SERVER_EXECUTE();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -1,179 +1,179 @@
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
#define LOG_ENEMYATTACK 1
|
||||
#define LOG_TEAMMATEATTACK 2
|
||||
|
||||
// playerid
|
||||
#define PLAYERID_MODE_EVERYONE 0
|
||||
#define PLAYERID_MODE_TEAMONLY 1
|
||||
#define PLAYERID_MODE_OFF 2
|
||||
|
||||
#define PLAYERID_EVERYONE 0
|
||||
#define PLAYERID_TEAMONLY 1
|
||||
#define PLAYERID_OFF 2
|
||||
|
||||
extern cvar_t *g_pskill;
|
||||
extern cvar_t *g_psv_gravity;
|
||||
extern cvar_t *g_psv_aim;
|
||||
extern cvar_t *g_psv_accelerate;
|
||||
extern cvar_t *g_psv_friction;
|
||||
extern cvar_t *g_psv_stopspeed;
|
||||
extern cvar_t *g_psv_stepsize;
|
||||
extern cvar_t *g_psv_clienttrace;
|
||||
extern cvar_t *g_footsteps;
|
||||
|
||||
extern cvar_t displaysoundlist;
|
||||
extern cvar_t timelimit;
|
||||
extern cvar_t flashlight;
|
||||
extern cvar_t decalfrequency;
|
||||
extern cvar_t fadetoblack;
|
||||
extern cvar_t fragsleft;
|
||||
extern cvar_t timeleft;
|
||||
extern cvar_t friendlyfire;
|
||||
extern cvar_t infiniteAmmo;
|
||||
extern cvar_t infiniteGrenades;
|
||||
extern cvar_t allowmonsters;
|
||||
extern cvar_t roundtime;
|
||||
extern cvar_t buytime;
|
||||
extern cvar_t freezetime;
|
||||
extern cvar_t c4timer;
|
||||
extern cvar_t ghostfrequency;
|
||||
extern cvar_t autokick;
|
||||
extern cvar_t autokick_timeout;
|
||||
extern cvar_t restartround;
|
||||
extern cvar_t sv_restart;
|
||||
extern cvar_t limitteams;
|
||||
extern cvar_t autoteambalance;
|
||||
extern cvar_t tkpunish;
|
||||
extern cvar_t hostagepenalty;
|
||||
extern cvar_t mirrordamage;
|
||||
extern cvar_t logmessages;
|
||||
extern cvar_t forcecamera;
|
||||
extern cvar_t forcechasecam;
|
||||
extern cvar_t mapvoteratio;
|
||||
extern cvar_t logdetail;
|
||||
extern cvar_t startmoney;
|
||||
extern cvar_t maxrounds;
|
||||
extern cvar_t winlimit;
|
||||
extern cvar_t windifference;
|
||||
extern cvar_t playerid;
|
||||
extern cvar_t allow_spectators;
|
||||
extern cvar_t mp_chattime;
|
||||
extern cvar_t kick_percent;
|
||||
extern cvar_t humans_join_team;
|
||||
extern cvar_t sk_plr_9mm_bullet1;
|
||||
extern cvar_t sk_plr_9mm_bullet2;
|
||||
extern cvar_t sk_plr_9mm_bullet3;
|
||||
extern cvar_t sk_plr_357_bullet1;
|
||||
extern cvar_t sk_plr_357_bullet2;
|
||||
extern cvar_t sk_plr_357_bullet3;
|
||||
extern cvar_t sk_plr_9mmAR_bullet1;
|
||||
extern cvar_t sk_plr_9mmAR_bullet2;
|
||||
extern cvar_t sk_plr_9mmAR_bullet3;
|
||||
extern cvar_t sk_plr_9mmAR_grenade1;
|
||||
extern cvar_t sk_plr_9mmAR_grenade2;
|
||||
extern cvar_t sk_plr_9mmAR_grenade3;
|
||||
extern cvar_t sk_plr_buckshot1;
|
||||
extern cvar_t sk_plr_buckshot2;
|
||||
extern cvar_t sk_plr_buckshot3;
|
||||
extern cvar_t sk_plr_rpg1;
|
||||
extern cvar_t sk_plr_rpg2;
|
||||
extern cvar_t sk_plr_rpg3;
|
||||
extern cvar_t sk_12mm_bullet1;
|
||||
extern cvar_t sk_12mm_bullet2;
|
||||
extern cvar_t sk_12mm_bullet3;
|
||||
extern cvar_t sk_9mmAR_bullet1;
|
||||
extern cvar_t sk_9mmAR_bullet2;
|
||||
extern cvar_t sk_9mmAR_bullet3;
|
||||
extern cvar_t sk_9mm_bullet1;
|
||||
extern cvar_t sk_9mm_bullet2;
|
||||
extern cvar_t sk_9mm_bullet3;
|
||||
extern cvar_t sk_suitcharger1;
|
||||
extern cvar_t sk_suitcharger2;
|
||||
extern cvar_t sk_suitcharger3;
|
||||
extern cvar_t sk_battery1;
|
||||
extern cvar_t sk_battery2;
|
||||
extern cvar_t sk_battery3;
|
||||
extern cvar_t sk_healthcharger1;
|
||||
extern cvar_t sk_healthcharger2;
|
||||
extern cvar_t sk_healthcharger3;
|
||||
extern cvar_t sk_healthkit1;
|
||||
extern cvar_t sk_healthkit2;
|
||||
extern cvar_t sk_healthkit3;
|
||||
extern cvar_t sk_scientist_heal1;
|
||||
extern cvar_t sk_scientist_heal2;
|
||||
extern cvar_t sk_scientist_heal3;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
||||
extern cvar_t maxmoney;
|
||||
extern cvar_t round_infinite;
|
||||
extern cvar_t hegrenade_penetration;
|
||||
extern cvar_t nadedrops;
|
||||
extern cvar_t roundrespawn_time;
|
||||
extern cvar_t auto_reload_weapons;
|
||||
extern cvar_t refill_bpammo_weapons;
|
||||
extern cvar_t freeforall;
|
||||
extern cvar_t auto_join_team;
|
||||
extern cvar_t max_teamkills;
|
||||
extern cvar_t fraglimit;
|
||||
extern cvar_t round_restart_delay;
|
||||
|
||||
extern cvar_t showtriggers;
|
||||
extern cvar_t hostagehurtable;
|
||||
extern cvar_t roundover;
|
||||
extern cvar_t forcerespawn;
|
||||
extern cvar_t show_radioicon;
|
||||
extern cvar_t show_scenarioicon;
|
||||
extern cvar_t old_bomb_defused_sound;
|
||||
extern cvar_t item_staytime;
|
||||
extern cvar_t legacy_bombtarget_touch;
|
||||
extern cvar_t respawn_immunitytime;
|
||||
extern cvar_t respawn_immunity_effects;
|
||||
extern cvar_t kill_filled_spawn;
|
||||
extern cvar_t afk_bomb_drop_time;
|
||||
extern cvar_t buy_anywhere;
|
||||
extern cvar_t allow_point_servercommand;
|
||||
extern cvar_t hullbounds_sets;
|
||||
extern cvar_t unduck_method;
|
||||
extern cvar_t ff_damage_reduction_bullets;
|
||||
extern cvar_t ff_damage_reduction_grenade;
|
||||
extern cvar_t ff_damage_reduction_grenade_self;
|
||||
extern cvar_t ff_damage_reduction_other;
|
||||
extern cvar_t radio_timeout;
|
||||
extern cvar_t radio_maxinround;
|
||||
|
||||
#endif
|
||||
|
||||
extern cvar_t scoreboard_showmoney;
|
||||
extern cvar_t scoreboard_showhealth;
|
||||
|
||||
void GameDLLInit();
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
#define LOG_ENEMYATTACK 1
|
||||
#define LOG_TEAMMATEATTACK 2
|
||||
|
||||
// playerid
|
||||
#define PLAYERID_MODE_EVERYONE 0
|
||||
#define PLAYERID_MODE_TEAMONLY 1
|
||||
#define PLAYERID_MODE_OFF 2
|
||||
|
||||
#define PLAYERID_EVERYONE 0
|
||||
#define PLAYERID_TEAMONLY 1
|
||||
#define PLAYERID_OFF 2
|
||||
|
||||
extern cvar_t *g_pskill;
|
||||
extern cvar_t *g_psv_gravity;
|
||||
extern cvar_t *g_psv_aim;
|
||||
extern cvar_t *g_psv_accelerate;
|
||||
extern cvar_t *g_psv_friction;
|
||||
extern cvar_t *g_psv_stopspeed;
|
||||
extern cvar_t *g_psv_stepsize;
|
||||
extern cvar_t *g_psv_clienttrace;
|
||||
extern cvar_t *g_footsteps;
|
||||
|
||||
extern cvar_t displaysoundlist;
|
||||
extern cvar_t timelimit;
|
||||
extern cvar_t flashlight;
|
||||
extern cvar_t decalfrequency;
|
||||
extern cvar_t fadetoblack;
|
||||
extern cvar_t fragsleft;
|
||||
extern cvar_t timeleft;
|
||||
extern cvar_t friendlyfire;
|
||||
extern cvar_t infiniteAmmo;
|
||||
extern cvar_t infiniteGrenades;
|
||||
extern cvar_t allowmonsters;
|
||||
extern cvar_t roundtime;
|
||||
extern cvar_t buytime;
|
||||
extern cvar_t freezetime;
|
||||
extern cvar_t c4timer;
|
||||
extern cvar_t ghostfrequency;
|
||||
extern cvar_t autokick;
|
||||
extern cvar_t autokick_timeout;
|
||||
extern cvar_t restartround;
|
||||
extern cvar_t sv_restart;
|
||||
extern cvar_t limitteams;
|
||||
extern cvar_t autoteambalance;
|
||||
extern cvar_t tkpunish;
|
||||
extern cvar_t hostagepenalty;
|
||||
extern cvar_t mirrordamage;
|
||||
extern cvar_t logmessages;
|
||||
extern cvar_t forcecamera;
|
||||
extern cvar_t forcechasecam;
|
||||
extern cvar_t mapvoteratio;
|
||||
extern cvar_t logdetail;
|
||||
extern cvar_t startmoney;
|
||||
extern cvar_t maxrounds;
|
||||
extern cvar_t winlimit;
|
||||
extern cvar_t windifference;
|
||||
extern cvar_t playerid;
|
||||
extern cvar_t allow_spectators;
|
||||
extern cvar_t mp_chattime;
|
||||
extern cvar_t kick_percent;
|
||||
extern cvar_t humans_join_team;
|
||||
extern cvar_t sk_plr_9mm_bullet1;
|
||||
extern cvar_t sk_plr_9mm_bullet2;
|
||||
extern cvar_t sk_plr_9mm_bullet3;
|
||||
extern cvar_t sk_plr_357_bullet1;
|
||||
extern cvar_t sk_plr_357_bullet2;
|
||||
extern cvar_t sk_plr_357_bullet3;
|
||||
extern cvar_t sk_plr_9mmAR_bullet1;
|
||||
extern cvar_t sk_plr_9mmAR_bullet2;
|
||||
extern cvar_t sk_plr_9mmAR_bullet3;
|
||||
extern cvar_t sk_plr_9mmAR_grenade1;
|
||||
extern cvar_t sk_plr_9mmAR_grenade2;
|
||||
extern cvar_t sk_plr_9mmAR_grenade3;
|
||||
extern cvar_t sk_plr_buckshot1;
|
||||
extern cvar_t sk_plr_buckshot2;
|
||||
extern cvar_t sk_plr_buckshot3;
|
||||
extern cvar_t sk_plr_rpg1;
|
||||
extern cvar_t sk_plr_rpg2;
|
||||
extern cvar_t sk_plr_rpg3;
|
||||
extern cvar_t sk_12mm_bullet1;
|
||||
extern cvar_t sk_12mm_bullet2;
|
||||
extern cvar_t sk_12mm_bullet3;
|
||||
extern cvar_t sk_9mmAR_bullet1;
|
||||
extern cvar_t sk_9mmAR_bullet2;
|
||||
extern cvar_t sk_9mmAR_bullet3;
|
||||
extern cvar_t sk_9mm_bullet1;
|
||||
extern cvar_t sk_9mm_bullet2;
|
||||
extern cvar_t sk_9mm_bullet3;
|
||||
extern cvar_t sk_suitcharger1;
|
||||
extern cvar_t sk_suitcharger2;
|
||||
extern cvar_t sk_suitcharger3;
|
||||
extern cvar_t sk_battery1;
|
||||
extern cvar_t sk_battery2;
|
||||
extern cvar_t sk_battery3;
|
||||
extern cvar_t sk_healthcharger1;
|
||||
extern cvar_t sk_healthcharger2;
|
||||
extern cvar_t sk_healthcharger3;
|
||||
extern cvar_t sk_healthkit1;
|
||||
extern cvar_t sk_healthkit2;
|
||||
extern cvar_t sk_healthkit3;
|
||||
extern cvar_t sk_scientist_heal1;
|
||||
extern cvar_t sk_scientist_heal2;
|
||||
extern cvar_t sk_scientist_heal3;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
||||
extern cvar_t maxmoney;
|
||||
extern cvar_t round_infinite;
|
||||
extern cvar_t hegrenade_penetration;
|
||||
extern cvar_t nadedrops;
|
||||
extern cvar_t roundrespawn_time;
|
||||
extern cvar_t auto_reload_weapons;
|
||||
extern cvar_t refill_bpammo_weapons;
|
||||
extern cvar_t freeforall;
|
||||
extern cvar_t auto_join_team;
|
||||
extern cvar_t max_teamkills;
|
||||
extern cvar_t fraglimit;
|
||||
extern cvar_t round_restart_delay;
|
||||
|
||||
extern cvar_t showtriggers;
|
||||
extern cvar_t hostagehurtable;
|
||||
extern cvar_t roundover;
|
||||
extern cvar_t forcerespawn;
|
||||
extern cvar_t show_radioicon;
|
||||
extern cvar_t show_scenarioicon;
|
||||
extern cvar_t old_bomb_defused_sound;
|
||||
extern cvar_t item_staytime;
|
||||
extern cvar_t legacy_bombtarget_touch;
|
||||
extern cvar_t respawn_immunitytime;
|
||||
extern cvar_t respawn_immunity_effects;
|
||||
extern cvar_t kill_filled_spawn;
|
||||
extern cvar_t afk_bomb_drop_time;
|
||||
extern cvar_t buy_anywhere;
|
||||
extern cvar_t allow_point_servercommand;
|
||||
extern cvar_t hullbounds_sets;
|
||||
extern cvar_t unduck_method;
|
||||
extern cvar_t ff_damage_reduction_bullets;
|
||||
extern cvar_t ff_damage_reduction_grenade;
|
||||
extern cvar_t ff_damage_reduction_grenade_self;
|
||||
extern cvar_t ff_damage_reduction_other;
|
||||
extern cvar_t radio_timeout;
|
||||
extern cvar_t radio_maxinround;
|
||||
|
||||
#endif
|
||||
|
||||
extern cvar_t scoreboard_showmoney;
|
||||
extern cvar_t scoreboard_showhealth;
|
||||
|
||||
void GameDLLInit();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,14 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
const Vector g_vecZero(0, 0, 0);
|
||||
|
||||
int g_Language;
|
||||
int g_iSkillLevel;
|
||||
|
||||
Vector g_vecAttackDir;
|
||||
BOOL gDisplayTitle;
|
||||
|
||||
bool g_bIsBeta = false;
|
||||
bool g_bIsCzeroGame = false;
|
||||
bool g_bAllowedCSBot = false;
|
||||
bool g_bHostageImprov = false;
|
||||
#include "precompiled.h"
|
||||
|
||||
const Vector g_vecZero(0, 0, 0);
|
||||
|
||||
int g_Language;
|
||||
int g_iSkillLevel;
|
||||
|
||||
Vector g_vecAttackDir;
|
||||
BOOL gDisplayTitle;
|
||||
|
||||
bool g_bIsBeta = false;
|
||||
bool g_bIsCzeroGame = false;
|
||||
bool g_bAllowedCSBot = false;
|
||||
bool g_bHostageImprov = false;
|
||||
|
@ -1,41 +1,41 @@
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
extern const Vector g_vecZero;
|
||||
extern int g_Language;
|
||||
extern int g_iSkillLevel;
|
||||
|
||||
extern Vector g_vecAttackDir;
|
||||
|
||||
extern BOOL gDisplayTitle;
|
||||
extern bool g_bIsBeta;
|
||||
extern bool g_bIsCzeroGame;
|
||||
extern bool g_bAllowedCSBot;
|
||||
extern bool g_bHostageImprov;
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
extern const Vector g_vecZero;
|
||||
extern int g_Language;
|
||||
extern int g_iSkillLevel;
|
||||
|
||||
extern Vector g_vecAttackDir;
|
||||
|
||||
extern BOOL gDisplayTitle;
|
||||
extern bool g_bIsBeta;
|
||||
extern bool g_bIsCzeroGame;
|
||||
extern bool g_bAllowedCSBot;
|
||||
extern bool g_bHostageImprov;
|
||||
|
@ -1,220 +1,220 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
TYPEDESCRIPTION CRecharge::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CRecharge, m_flNextCharge, FIELD_TIME),
|
||||
DEFINE_FIELD(CRecharge, m_iReactivate, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CRecharge, m_iJuice, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CRecharge, m_iOn, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CRecharge, m_flSoundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CRecharge, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(func_recharge, CRecharge, CCSRecharge)
|
||||
|
||||
void CRecharge::KeyValue(KeyValueData *pkvd)
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "style")
|
||||
|| FStrEq(pkvd->szKeyName, "height")
|
||||
|| FStrEq(pkvd->szKeyName, "value1")
|
||||
|| FStrEq(pkvd->szKeyName, "value2")
|
||||
|| FStrEq(pkvd->szKeyName, "value3"))
|
||||
{
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "dmdelay"))
|
||||
{
|
||||
m_iReactivate = Q_atoi(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseToggle::KeyValue(pkvd);
|
||||
}
|
||||
}
|
||||
|
||||
void CRecharge::Spawn()
|
||||
{
|
||||
Precache();
|
||||
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->movetype = MOVETYPE_PUSH;
|
||||
|
||||
// set size and link into world
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
|
||||
int armorValue = (int)gSkillData.suitchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->armorvalue != 0.0f) {
|
||||
armorValue = (int)pev->armorvalue;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_iJuice = armorValue;
|
||||
pev->frame = 0;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
void CRecharge::Restart()
|
||||
{
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->movetype = MOVETYPE_PUSH;
|
||||
|
||||
// set size and link into world
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
|
||||
pev->nextthink = pev->ltime + 0.1f;
|
||||
SetThink(&CRecharge::Recharge);
|
||||
}
|
||||
|
||||
#endif
|
||||
void CRecharge::Precache()
|
||||
{
|
||||
PRECACHE_SOUND("items/suitcharge1.wav");
|
||||
PRECACHE_SOUND("items/suitchargeno1.wav");
|
||||
PRECACHE_SOUND("items/suitchargeok1.wav");
|
||||
}
|
||||
|
||||
void CRecharge::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// Make sure that we have a caller
|
||||
if (!pActivator)
|
||||
return;
|
||||
|
||||
// if it's not a player, ignore
|
||||
if (!pActivator->IsPlayer())
|
||||
return;
|
||||
#else
|
||||
if (!FClassnameIs(pActivator->pev, "player"))
|
||||
return;
|
||||
#endif // #ifdef REGAMEDLL_FIXES
|
||||
|
||||
// if there is no juice left, turn it off
|
||||
if (m_iJuice <= 0
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
&& pev->frame != 1.0f // recharging... don't reset think
|
||||
#endif
|
||||
)
|
||||
{
|
||||
pev->frame = 1.0f;
|
||||
Off();
|
||||
}
|
||||
|
||||
// if the player doesn't have the suit, or there is no juice left, make the deny noise
|
||||
if (m_iJuice <= 0 || !(pActivator->pev->weapons & (1 << WEAPON_SUIT))
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
|| pActivator->pev->armorvalue >= MAX_CHARGE_ARMOR // don't charge health if we can't more, prevent thinking entity
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (m_flSoundTime <= gpGlobals->time)
|
||||
{
|
||||
m_flSoundTime = gpGlobals->time + 0.62f;
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/suitchargeno1.wav", 0.85, ATTN_NORM);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pev->nextthink = pev->ltime + 0.25f;
|
||||
SetThink(&CRecharge::Off);
|
||||
|
||||
// Time to recharge yet?
|
||||
if (m_flNextCharge >= gpGlobals->time)
|
||||
return;
|
||||
|
||||
// Make sure that we have a caller
|
||||
if (!pActivator)
|
||||
return;
|
||||
|
||||
m_hActivator = pActivator;//EHANDLE::CBaseEntity *operator=
|
||||
|
||||
// only recharge the player
|
||||
if (!m_hActivator->IsPlayer())
|
||||
return;
|
||||
|
||||
// Play the on sound or the looping charging sound
|
||||
if (!m_iOn)
|
||||
{
|
||||
m_iOn++;
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/suitchargeok1.wav", 0.85, ATTN_NORM);
|
||||
m_flSoundTime = gpGlobals->time + 0.56f;
|
||||
}
|
||||
|
||||
if (m_iOn == 1 && m_flSoundTime <= gpGlobals->time)
|
||||
{
|
||||
m_iOn++;
|
||||
EMIT_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge1.wav", 0.85, ATTN_NORM);
|
||||
}
|
||||
|
||||
// charge the player
|
||||
if (m_hActivator->pev->armorvalue < MAX_CHARGE_ARMOR)
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
CBasePlayer *pPlayer = m_hActivator.Get<CBasePlayer>();
|
||||
if (pPlayer->m_iKevlar == ARMOR_NONE)
|
||||
pPlayer->m_iKevlar = ARMOR_KEVLAR;
|
||||
#endif
|
||||
|
||||
m_iJuice--;
|
||||
m_hActivator->pev->armorvalue += AMOUNT_CHARGE_ARMOR;
|
||||
|
||||
if (m_hActivator->pev->armorvalue > MAX_CHARGE_ARMOR)
|
||||
m_hActivator->pev->armorvalue = MAX_CHARGE_ARMOR;
|
||||
}
|
||||
|
||||
// govern the rate of charge
|
||||
m_flNextCharge = gpGlobals->time + 0.1f;
|
||||
}
|
||||
|
||||
void CRecharge::Recharge()
|
||||
{
|
||||
int armorValue = (int)gSkillData.suitchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->armorvalue != 0.0f) {
|
||||
armorValue = (int)pev->armorvalue;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_iJuice = armorValue;
|
||||
|
||||
pev->frame = 0;
|
||||
SetThink(&CRecharge::SUB_DoNothing);
|
||||
}
|
||||
|
||||
void CRecharge::Off()
|
||||
{
|
||||
// Stop looping sound.
|
||||
if (m_iOn > 1)
|
||||
STOP_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge1.wav");
|
||||
|
||||
m_iOn = 0;
|
||||
|
||||
if (!m_iJuice)
|
||||
{
|
||||
int iReactivate = m_iReactivate;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (iReactivate <= 0)
|
||||
#endif // #ifdef REGAMEDLL_FIXES
|
||||
{
|
||||
if ((iReactivate = g_pGameRules->FlHEVChargerRechargeTime()) <= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_iReactivate <= 0)
|
||||
m_iReactivate = iReactivate;
|
||||
|
||||
pev->nextthink = pev->ltime + m_iReactivate;
|
||||
SetThink(&CRecharge::Recharge);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink(&CRecharge::SUB_DoNothing);
|
||||
}
|
||||
}
|
||||
#include "precompiled.h"
|
||||
|
||||
TYPEDESCRIPTION CRecharge::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CRecharge, m_flNextCharge, FIELD_TIME),
|
||||
DEFINE_FIELD(CRecharge, m_iReactivate, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CRecharge, m_iJuice, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CRecharge, m_iOn, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CRecharge, m_flSoundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CRecharge, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(func_recharge, CRecharge, CCSRecharge)
|
||||
|
||||
void CRecharge::KeyValue(KeyValueData *pkvd)
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "style")
|
||||
|| FStrEq(pkvd->szKeyName, "height")
|
||||
|| FStrEq(pkvd->szKeyName, "value1")
|
||||
|| FStrEq(pkvd->szKeyName, "value2")
|
||||
|| FStrEq(pkvd->szKeyName, "value3"))
|
||||
{
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "dmdelay"))
|
||||
{
|
||||
m_iReactivate = Q_atoi(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseToggle::KeyValue(pkvd);
|
||||
}
|
||||
}
|
||||
|
||||
void CRecharge::Spawn()
|
||||
{
|
||||
Precache();
|
||||
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->movetype = MOVETYPE_PUSH;
|
||||
|
||||
// set size and link into world
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
|
||||
int armorValue = (int)gSkillData.suitchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->armorvalue != 0.0f) {
|
||||
armorValue = (int)pev->armorvalue;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_iJuice = armorValue;
|
||||
pev->frame = 0;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
void CRecharge::Restart()
|
||||
{
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->movetype = MOVETYPE_PUSH;
|
||||
|
||||
// set size and link into world
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
|
||||
pev->nextthink = pev->ltime + 0.1f;
|
||||
SetThink(&CRecharge::Recharge);
|
||||
}
|
||||
|
||||
#endif
|
||||
void CRecharge::Precache()
|
||||
{
|
||||
PRECACHE_SOUND("items/suitcharge1.wav");
|
||||
PRECACHE_SOUND("items/suitchargeno1.wav");
|
||||
PRECACHE_SOUND("items/suitchargeok1.wav");
|
||||
}
|
||||
|
||||
void CRecharge::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// Make sure that we have a caller
|
||||
if (!pActivator)
|
||||
return;
|
||||
|
||||
// if it's not a player, ignore
|
||||
if (!pActivator->IsPlayer())
|
||||
return;
|
||||
#else
|
||||
if (!FClassnameIs(pActivator->pev, "player"))
|
||||
return;
|
||||
#endif // #ifdef REGAMEDLL_FIXES
|
||||
|
||||
// if there is no juice left, turn it off
|
||||
if (m_iJuice <= 0
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
&& pev->frame != 1.0f // recharging... don't reset think
|
||||
#endif
|
||||
)
|
||||
{
|
||||
pev->frame = 1.0f;
|
||||
Off();
|
||||
}
|
||||
|
||||
// if the player doesn't have the suit, or there is no juice left, make the deny noise
|
||||
if (m_iJuice <= 0 || !(pActivator->pev->weapons & (1 << WEAPON_SUIT))
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
|| pActivator->pev->armorvalue >= MAX_CHARGE_ARMOR // don't charge health if we can't more, prevent thinking entity
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (m_flSoundTime <= gpGlobals->time)
|
||||
{
|
||||
m_flSoundTime = gpGlobals->time + 0.62f;
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/suitchargeno1.wav", 0.85, ATTN_NORM);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pev->nextthink = pev->ltime + 0.25f;
|
||||
SetThink(&CRecharge::Off);
|
||||
|
||||
// Time to recharge yet?
|
||||
if (m_flNextCharge >= gpGlobals->time)
|
||||
return;
|
||||
|
||||
// Make sure that we have a caller
|
||||
if (!pActivator)
|
||||
return;
|
||||
|
||||
m_hActivator = pActivator;//EHANDLE::CBaseEntity *operator=
|
||||
|
||||
// only recharge the player
|
||||
if (!m_hActivator->IsPlayer())
|
||||
return;
|
||||
|
||||
// Play the on sound or the looping charging sound
|
||||
if (!m_iOn)
|
||||
{
|
||||
m_iOn++;
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/suitchargeok1.wav", 0.85, ATTN_NORM);
|
||||
m_flSoundTime = gpGlobals->time + 0.56f;
|
||||
}
|
||||
|
||||
if (m_iOn == 1 && m_flSoundTime <= gpGlobals->time)
|
||||
{
|
||||
m_iOn++;
|
||||
EMIT_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge1.wav", 0.85, ATTN_NORM);
|
||||
}
|
||||
|
||||
// charge the player
|
||||
if (m_hActivator->pev->armorvalue < MAX_CHARGE_ARMOR)
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
CBasePlayer *pPlayer = m_hActivator.Get<CBasePlayer>();
|
||||
if (pPlayer->m_iKevlar == ARMOR_NONE)
|
||||
pPlayer->m_iKevlar = ARMOR_KEVLAR;
|
||||
#endif
|
||||
|
||||
m_iJuice--;
|
||||
m_hActivator->pev->armorvalue += AMOUNT_CHARGE_ARMOR;
|
||||
|
||||
if (m_hActivator->pev->armorvalue > MAX_CHARGE_ARMOR)
|
||||
m_hActivator->pev->armorvalue = MAX_CHARGE_ARMOR;
|
||||
}
|
||||
|
||||
// govern the rate of charge
|
||||
m_flNextCharge = gpGlobals->time + 0.1f;
|
||||
}
|
||||
|
||||
void CRecharge::Recharge()
|
||||
{
|
||||
int armorValue = (int)gSkillData.suitchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->armorvalue != 0.0f) {
|
||||
armorValue = (int)pev->armorvalue;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_iJuice = armorValue;
|
||||
|
||||
pev->frame = 0;
|
||||
SetThink(&CRecharge::SUB_DoNothing);
|
||||
}
|
||||
|
||||
void CRecharge::Off()
|
||||
{
|
||||
// Stop looping sound.
|
||||
if (m_iOn > 1)
|
||||
STOP_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge1.wav");
|
||||
|
||||
m_iOn = 0;
|
||||
|
||||
if (!m_iJuice)
|
||||
{
|
||||
int iReactivate = m_iReactivate;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (iReactivate <= 0)
|
||||
#endif // #ifdef REGAMEDLL_FIXES
|
||||
{
|
||||
if ((iReactivate = g_pGameRules->FlHEVChargerRechargeTime()) <= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_iReactivate <= 0)
|
||||
m_iReactivate = iReactivate;
|
||||
|
||||
pev->nextthink = pev->ltime + m_iReactivate;
|
||||
SetThink(&CRecharge::Recharge);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink(&CRecharge::SUB_DoNothing);
|
||||
}
|
||||
}
|
||||
|
@ -1,244 +1,244 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
LINK_ENTITY_TO_CLASS(item_healthkit, CHealthKit, CCSHealthKit)
|
||||
|
||||
void CHealthKit::Spawn()
|
||||
{
|
||||
Precache();
|
||||
SET_MODEL(ENT(pev), "models/w_medkit.mdl");
|
||||
|
||||
CItem::Spawn();
|
||||
}
|
||||
|
||||
void CHealthKit::Precache()
|
||||
{
|
||||
PRECACHE_MODEL("models/w_medkit.mdl");
|
||||
PRECACHE_SOUND("items/smallmedkit1.wav");
|
||||
}
|
||||
|
||||
BOOL CHealthKit::MyTouch(CBasePlayer *pPlayer)
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (pPlayer->HasRestrictItem(ITEM_HEALTHKIT, ITEM_TYPE_TOUCHED))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
auto healthValue = gSkillData.healthkitCapacity;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->health != 0.0f) {
|
||||
healthValue = pev->health;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pPlayer->TakeHealth(healthValue, DMG_GENERIC))
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, nullptr, pPlayer->pev);
|
||||
WRITE_STRING(pev->classname);
|
||||
MESSAGE_END();
|
||||
|
||||
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/smallmedkit1.wav", VOL_NORM, ATTN_NORM);
|
||||
|
||||
if (g_pGameRules->ItemShouldRespawn(this))
|
||||
Respawn();
|
||||
else
|
||||
UTIL_Remove(this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CWallHealth::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CWallHealth, m_flNextCharge, FIELD_TIME),
|
||||
DEFINE_FIELD(CWallHealth, m_iReactivate, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_iJuice, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_iOn, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_flSoundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CWallHealth, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(func_healthcharger, CWallHealth, CCSWallHealth)
|
||||
|
||||
void CWallHealth::KeyValue(KeyValueData *pkvd)
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "style") || FStrEq(pkvd->szKeyName, "height") || FStrEq(pkvd->szKeyName, "value1") || FStrEq(pkvd->szKeyName, "value2") || FStrEq(pkvd->szKeyName, "value3"))
|
||||
{
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "dmdelay"))
|
||||
{
|
||||
m_iReactivate = Q_atoi(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseToggle::KeyValue(pkvd);
|
||||
}
|
||||
}
|
||||
|
||||
void CWallHealth::Spawn()
|
||||
{
|
||||
Precache();
|
||||
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->movetype = MOVETYPE_PUSH;
|
||||
|
||||
// set size and link into world
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
|
||||
SET_MODEL(ENT(pev), pev->model);
|
||||
|
||||
int healthValue = (int)gSkillData.healthchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->health != 0.0f) {
|
||||
healthValue = (int)pev->health;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_iJuice = healthValue;
|
||||
pev->frame = 0.0f;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
void CWallHealth::Restart()
|
||||
{
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->movetype = MOVETYPE_PUSH;
|
||||
|
||||
// set size and link into world
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
|
||||
SET_MODEL(ENT(pev), pev->model);
|
||||
|
||||
pev->nextthink = pev->ltime + 0.1f;
|
||||
SetThink(&CWallHealth::Recharge);
|
||||
}
|
||||
#endif // #ifdef REGAMEDLL_FIXES
|
||||
|
||||
void CWallHealth::Precache()
|
||||
{
|
||||
PRECACHE_SOUND("items/medshot4.wav");
|
||||
PRECACHE_SOUND("items/medshotno1.wav");
|
||||
PRECACHE_SOUND("items/medcharge4.wav");
|
||||
}
|
||||
|
||||
void CWallHealth::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
|
||||
{
|
||||
// Make sure that we have a caller
|
||||
if (!pActivator)
|
||||
return;
|
||||
|
||||
// if it's not a player, ignore
|
||||
if (!pActivator->IsPlayer())
|
||||
return;
|
||||
|
||||
// if there is no juice left, turn it off
|
||||
if (m_iJuice <= 0
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
&& pev->frame != 1.0f // recharging... don't reset think
|
||||
#endif
|
||||
)
|
||||
{
|
||||
pev->frame = 1.0f;
|
||||
Off();
|
||||
}
|
||||
|
||||
// if the player doesn't have the suit, or there is no juice left, make the deny noise
|
||||
if (m_iJuice <= 0 || !(pActivator->pev->weapons & (1 << WEAPON_SUIT))
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
|| !pActivator->CanTakeHealth(AMOUNT_CHARGE_HEALTH) // don't charge health if we can't more, prevent thinking entity
|
||||
#endif // REGAMEDLL_FIXES
|
||||
)
|
||||
{
|
||||
if (gpGlobals->time >= m_flSoundTime)
|
||||
{
|
||||
m_flSoundTime = gpGlobals->time + 0.62f;
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshotno1.wav", VOL_NORM, ATTN_NORM);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pev->nextthink = pev->ltime + 0.25f;
|
||||
SetThink(&CWallHealth::Off);
|
||||
|
||||
// Time to recharge yet?
|
||||
|
||||
if (m_flNextCharge >= gpGlobals->time)
|
||||
return;
|
||||
|
||||
// Play the on sound or the looping charging sound
|
||||
if (!m_iOn)
|
||||
{
|
||||
m_iOn++;
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshot4.wav", VOL_NORM, ATTN_NORM);
|
||||
m_flSoundTime = gpGlobals->time + 0.56f;
|
||||
}
|
||||
|
||||
if (m_iOn == 1 && gpGlobals->time >= m_flSoundTime)
|
||||
{
|
||||
m_iOn++;
|
||||
EMIT_SOUND(ENT(pev), CHAN_STATIC, "items/medcharge4.wav", VOL_NORM, ATTN_NORM);
|
||||
}
|
||||
|
||||
// charge the player
|
||||
if (pActivator->TakeHealth(AMOUNT_CHARGE_HEALTH, DMG_GENERIC))
|
||||
m_iJuice--;
|
||||
|
||||
// govern the rate of charge
|
||||
m_flNextCharge = gpGlobals->time + 0.1f;
|
||||
}
|
||||
|
||||
void CWallHealth::Recharge()
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshot4.wav", VOL_NORM, ATTN_NORM);
|
||||
|
||||
int healthValue = (int)gSkillData.healthchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->health != 0.0f) {
|
||||
healthValue = (int)pev->health;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_iJuice = healthValue;
|
||||
|
||||
pev->frame = 0.0f;
|
||||
SetThink(&CWallHealth::SUB_DoNothing);
|
||||
}
|
||||
|
||||
void CWallHealth::Off()
|
||||
{
|
||||
// Stop looping sound.
|
||||
if (m_iOn > 1)
|
||||
STOP_SOUND(ENT(pev), CHAN_STATIC, "items/medcharge4.wav");
|
||||
|
||||
m_iOn = 0;
|
||||
|
||||
if (!m_iJuice)
|
||||
{
|
||||
int iReactivate = m_iReactivate;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (iReactivate <= 0)
|
||||
#endif // #ifdef REGAMEDLL_FIXES
|
||||
{
|
||||
if ((iReactivate = g_pGameRules->FlHealthChargerRechargeTime()) <= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_iReactivate <= 0)
|
||||
m_iReactivate = iReactivate;
|
||||
|
||||
pev->nextthink = pev->ltime + m_iReactivate;
|
||||
SetThink(&CWallHealth::Recharge);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink(&CWallHealth::SUB_DoNothing);
|
||||
}
|
||||
}
|
||||
#include "precompiled.h"
|
||||
|
||||
LINK_ENTITY_TO_CLASS(item_healthkit, CHealthKit, CCSHealthKit)
|
||||
|
||||
void CHealthKit::Spawn()
|
||||
{
|
||||
Precache();
|
||||
SET_MODEL(ENT(pev), "models/w_medkit.mdl");
|
||||
|
||||
CItem::Spawn();
|
||||
}
|
||||
|
||||
void CHealthKit::Precache()
|
||||
{
|
||||
PRECACHE_MODEL("models/w_medkit.mdl");
|
||||
PRECACHE_SOUND("items/smallmedkit1.wav");
|
||||
}
|
||||
|
||||
BOOL CHealthKit::MyTouch(CBasePlayer *pPlayer)
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (pPlayer->HasRestrictItem(ITEM_HEALTHKIT, ITEM_TYPE_TOUCHED))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
auto healthValue = gSkillData.healthkitCapacity;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->health != 0.0f) {
|
||||
healthValue = pev->health;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pPlayer->TakeHealth(healthValue, DMG_GENERIC))
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, nullptr, pPlayer->pev);
|
||||
WRITE_STRING(pev->classname);
|
||||
MESSAGE_END();
|
||||
|
||||
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/smallmedkit1.wav", VOL_NORM, ATTN_NORM);
|
||||
|
||||
if (g_pGameRules->ItemShouldRespawn(this))
|
||||
Respawn();
|
||||
else
|
||||
UTIL_Remove(this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CWallHealth::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CWallHealth, m_flNextCharge, FIELD_TIME),
|
||||
DEFINE_FIELD(CWallHealth, m_iReactivate, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_iJuice, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_iOn, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_flSoundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CWallHealth, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(func_healthcharger, CWallHealth, CCSWallHealth)
|
||||
|
||||
void CWallHealth::KeyValue(KeyValueData *pkvd)
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "style") || FStrEq(pkvd->szKeyName, "height") || FStrEq(pkvd->szKeyName, "value1") || FStrEq(pkvd->szKeyName, "value2") || FStrEq(pkvd->szKeyName, "value3"))
|
||||
{
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "dmdelay"))
|
||||
{
|
||||
m_iReactivate = Q_atoi(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseToggle::KeyValue(pkvd);
|
||||
}
|
||||
}
|
||||
|
||||
void CWallHealth::Spawn()
|
||||
{
|
||||
Precache();
|
||||
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->movetype = MOVETYPE_PUSH;
|
||||
|
||||
// set size and link into world
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
|
||||
SET_MODEL(ENT(pev), pev->model);
|
||||
|
||||
int healthValue = (int)gSkillData.healthchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->health != 0.0f) {
|
||||
healthValue = (int)pev->health;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_iJuice = healthValue;
|
||||
pev->frame = 0.0f;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
void CWallHealth::Restart()
|
||||
{
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->movetype = MOVETYPE_PUSH;
|
||||
|
||||
// set size and link into world
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
|
||||
SET_MODEL(ENT(pev), pev->model);
|
||||
|
||||
pev->nextthink = pev->ltime + 0.1f;
|
||||
SetThink(&CWallHealth::Recharge);
|
||||
}
|
||||
#endif // #ifdef REGAMEDLL_FIXES
|
||||
|
||||
void CWallHealth::Precache()
|
||||
{
|
||||
PRECACHE_SOUND("items/medshot4.wav");
|
||||
PRECACHE_SOUND("items/medshotno1.wav");
|
||||
PRECACHE_SOUND("items/medcharge4.wav");
|
||||
}
|
||||
|
||||
void CWallHealth::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
|
||||
{
|
||||
// Make sure that we have a caller
|
||||
if (!pActivator)
|
||||
return;
|
||||
|
||||
// if it's not a player, ignore
|
||||
if (!pActivator->IsPlayer())
|
||||
return;
|
||||
|
||||
// if there is no juice left, turn it off
|
||||
if (m_iJuice <= 0
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
&& pev->frame != 1.0f // recharging... don't reset think
|
||||
#endif
|
||||
)
|
||||
{
|
||||
pev->frame = 1.0f;
|
||||
Off();
|
||||
}
|
||||
|
||||
// if the player doesn't have the suit, or there is no juice left, make the deny noise
|
||||
if (m_iJuice <= 0 || !(pActivator->pev->weapons & (1 << WEAPON_SUIT))
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
|| !pActivator->CanTakeHealth(AMOUNT_CHARGE_HEALTH) // don't charge health if we can't more, prevent thinking entity
|
||||
#endif // REGAMEDLL_FIXES
|
||||
)
|
||||
{
|
||||
if (gpGlobals->time >= m_flSoundTime)
|
||||
{
|
||||
m_flSoundTime = gpGlobals->time + 0.62f;
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshotno1.wav", VOL_NORM, ATTN_NORM);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pev->nextthink = pev->ltime + 0.25f;
|
||||
SetThink(&CWallHealth::Off);
|
||||
|
||||
// Time to recharge yet?
|
||||
|
||||
if (m_flNextCharge >= gpGlobals->time)
|
||||
return;
|
||||
|
||||
// Play the on sound or the looping charging sound
|
||||
if (!m_iOn)
|
||||
{
|
||||
m_iOn++;
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshot4.wav", VOL_NORM, ATTN_NORM);
|
||||
m_flSoundTime = gpGlobals->time + 0.56f;
|
||||
}
|
||||
|
||||
if (m_iOn == 1 && gpGlobals->time >= m_flSoundTime)
|
||||
{
|
||||
m_iOn++;
|
||||
EMIT_SOUND(ENT(pev), CHAN_STATIC, "items/medcharge4.wav", VOL_NORM, ATTN_NORM);
|
||||
}
|
||||
|
||||
// charge the player
|
||||
if (pActivator->TakeHealth(AMOUNT_CHARGE_HEALTH, DMG_GENERIC))
|
||||
m_iJuice--;
|
||||
|
||||
// govern the rate of charge
|
||||
m_flNextCharge = gpGlobals->time + 0.1f;
|
||||
}
|
||||
|
||||
void CWallHealth::Recharge()
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshot4.wav", VOL_NORM, ATTN_NORM);
|
||||
|
||||
int healthValue = (int)gSkillData.healthchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->health != 0.0f) {
|
||||
healthValue = (int)pev->health;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_iJuice = healthValue;
|
||||
|
||||
pev->frame = 0.0f;
|
||||
SetThink(&CWallHealth::SUB_DoNothing);
|
||||
}
|
||||
|
||||
void CWallHealth::Off()
|
||||
{
|
||||
// Stop looping sound.
|
||||
if (m_iOn > 1)
|
||||
STOP_SOUND(ENT(pev), CHAN_STATIC, "items/medcharge4.wav");
|
||||
|
||||
m_iOn = 0;
|
||||
|
||||
if (!m_iJuice)
|
||||
{
|
||||
int iReactivate = m_iReactivate;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (iReactivate <= 0)
|
||||
#endif // #ifdef REGAMEDLL_FIXES
|
||||
{
|
||||
if ((iReactivate = g_pGameRules->FlHealthChargerRechargeTime()) <= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_iReactivate <= 0)
|
||||
m_iReactivate = iReactivate;
|
||||
|
||||
pev->nextthink = pev->ltime + m_iReactivate;
|
||||
SetThink(&CWallHealth::Recharge);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink(&CWallHealth::SUB_DoNothing);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,379 +1,379 @@
|
||||
/*
|
||||
*
|
||||
* 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 "shake.h"
|
||||
#include "activity.h"
|
||||
#include "enginecallback.h"
|
||||
#include "utlvector.h"
|
||||
|
||||
#define GROUP_OP_AND 0
|
||||
#define GROUP_OP_NAND 1
|
||||
|
||||
// Dot products for view cone checking
|
||||
#define VIEW_FIELD_FULL -1.0 // +-180 degrees
|
||||
#define VIEW_FIELD_WIDE -0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks
|
||||
#define VIEW_FIELD_NARROW 0.7 // +-45 degrees, more narrow check used to set up ranged attacks
|
||||
#define VIEW_FIELD_ULTRA_NARROW 0.9 // +-25 degrees, more narrow check used to set up ranged attacks
|
||||
|
||||
#define SND_STOP BIT(5) // duplicated in protocol.h stop sound
|
||||
#define SND_CHANGE_VOL BIT(6) // duplicated in protocol.h change sound vol
|
||||
#define SND_CHANGE_PITCH BIT(7) // duplicated in protocol.h change sound pitch
|
||||
#define SND_SPAWNING BIT(8) // duplicated in protocol.h we're spawing, used in some cases for ambients
|
||||
|
||||
// All monsters need this data
|
||||
#define DONT_BLEED -1
|
||||
#define BLOOD_COLOR_DARKRED (byte)223
|
||||
#define BLOOD_COLOR_RED (byte)247
|
||||
#define BLOOD_COLOR_YELLOW (byte)195
|
||||
#define BLOOD_COLOR_GREEN BLOOD_COLOR_YELLOW
|
||||
|
||||
#define GERMAN_GIB_COUNT 4
|
||||
#define HUMAN_GIB_COUNT 6
|
||||
#define ALIEN_GIB_COUNT 4
|
||||
|
||||
#define LANGUAGE_ENGLISH 0
|
||||
#define LANGUAGE_GERMAN 1
|
||||
#define LANGUAGE_FRENCH 2
|
||||
#define LANGUAGE_BRITISH 3
|
||||
|
||||
#define SVC_NOP 1
|
||||
#define SVC_SOUND 6
|
||||
#define SVC_TEMPENTITY 23
|
||||
#define SVC_INTERMISSION 30
|
||||
#define SVC_CDTRACK 32
|
||||
#define SVC_WEAPONANIM 35
|
||||
#define SVC_ROOMTYPE 37
|
||||
#define SVC_DIRECTOR 51
|
||||
|
||||
#define VEC_HULL_MIN_Z Vector(0, 0, -36)
|
||||
#define VEC_DUCK_HULL_MIN_Z Vector(0, 0, -18)
|
||||
|
||||
#define VEC_HULL_MIN Vector(-16, -16, -36)
|
||||
#define VEC_HULL_MAX Vector(16, 16, 36)
|
||||
|
||||
#define VEC_VIEW Vector(0, 0, 17)
|
||||
|
||||
#define VEC_SPOT_HULL_MIN Vector(-16, -16, 0)
|
||||
#define VEC_SPOT_HULL_MAX Vector(16, 16, 72)
|
||||
|
||||
#define VEC_DUCK_HULL_MIN Vector(-16, -16, -18)
|
||||
#define VEC_DUCK_HULL_MAX Vector(16, 16, 32)
|
||||
#define VEC_DUCK_VIEW Vector(0, 0, 12)
|
||||
|
||||
#define PRECACHE_SOUND_ARRAY(a) \
|
||||
{ for (int i = 0; i < ARRAYSIZE(a); i++) PRECACHE_SOUND((char *)a[i]); }
|
||||
|
||||
#define PLAYBACK_EVENT(flags, who, index)\
|
||||
PLAYBACK_EVENT_FULL(flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
|
||||
|
||||
#define PLAYBACK_EVENT_DELAY(flags, who, index, delay)\
|
||||
PLAYBACK_EVENT_FULL(flags, who, index, delay, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
|
||||
|
||||
#define LINK_ENTITY_TO_CLASS(mapClassName, DLLClassName, DLLClassWrapName)\
|
||||
C_DLLEXPORT void EXT_FUNC mapClassName(entvars_t *pev);\
|
||||
void mapClassName(entvars_t *pev)\
|
||||
{\
|
||||
GetClassPtr<DLLClassWrapName>((DLLClassName *)pev);\
|
||||
}
|
||||
|
||||
const EOFFSET eoNullEntity = (EOFFSET)0; // Testing the three types of "entity" for nullity
|
||||
|
||||
class UTIL_GroupTrace
|
||||
{
|
||||
public:
|
||||
UTIL_GroupTrace(int groupmask, int op);
|
||||
~UTIL_GroupTrace();
|
||||
private:
|
||||
int m_oldgroupmask;
|
||||
int m_oldgroupop;
|
||||
};
|
||||
|
||||
// Inlines
|
||||
inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "classname", pszName); }
|
||||
inline edict_t *FIND_ENTITY_BY_TARGETNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "targetname", pszName); }
|
||||
|
||||
inline edict_t *ENT(const entvars_t *pev) { return pev->pContainingEntity; }
|
||||
inline edict_t *ENT(EOFFSET eoffset) { return (*g_engfuncs.pfnPEntityOfEntOffset)(eoffset); }
|
||||
inline EOFFSET OFFSET(const edict_t *pent) { return (*g_engfuncs.pfnEntOffsetOfPEntity)(pent); }
|
||||
inline EOFFSET OFFSET(const entvars_t *pev) { return OFFSET(ENT(pev)); }
|
||||
|
||||
inline entvars_t *VARS(edict_t *pent)
|
||||
{
|
||||
if (!pent)
|
||||
return nullptr;
|
||||
|
||||
return &pent->v;
|
||||
}
|
||||
|
||||
inline entvars_t *VARS(EOFFSET eoffset)
|
||||
{
|
||||
return VARS(ENT(eoffset));
|
||||
}
|
||||
|
||||
#ifndef ENTINDEX
|
||||
inline int ENTINDEX(const edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
|
||||
inline int ENTINDEX(const entvars_t *pev) { return (*g_engfuncs.pfnIndexOfEdict)(ENT(pev)); }
|
||||
#endif // ENTINDEX
|
||||
|
||||
#ifndef INDEXENT
|
||||
inline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }
|
||||
#endif // INDEXENT
|
||||
|
||||
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent) { MESSAGE_BEGIN(msg_dest, msg_type, pOrigin, ENT(ent)); }
|
||||
inline bool FNullEnt(EOFFSET eoffset) { return (eoffset == 0); }
|
||||
inline bool FNullEnt(entvars_t *pev) { return (pev == nullptr || FNullEnt(OFFSET(pev))); }
|
||||
inline bool FNullEnt(const edict_t *pent) { return (pent == nullptr || pent->free || FNullEnt(OFFSET(pent))); }
|
||||
inline bool FStringNull(string_t iString) { return (iString == iStringNull); }
|
||||
inline bool FStrEq(const char *sz1, const char *sz2) { return (Q_strcmp(sz1, sz2) == 0); }
|
||||
inline bool FStrnEq(const char *sz1, const char *sz2, size_t elem) { return (Q_strncmp(sz1, sz2, elem) == 0); }
|
||||
|
||||
inline bool FClassnameIs(entvars_t *pev, const char *szClassname) { return FStrEq(STRING(pev->classname), szClassname); }
|
||||
inline bool FClassnameIs(edict_t *pent, const char *szClassname) { return FStrEq(STRING(VARS(pent)->classname), szClassname); }
|
||||
inline void UTIL_MakeVectorsPrivate(Vector vecAngles, float *p_vForward, float *p_vRight, float *p_vUp) { g_engfuncs.pfnAngleVectors(vecAngles, p_vForward, p_vRight, p_vUp); }
|
||||
|
||||
#include "ehandle.h"
|
||||
|
||||
extern void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch);
|
||||
|
||||
// NOTE: use EMIT_SOUND_DYN to set the pitch of a sound. Pitch of 100
|
||||
// is no pitch shift. Pitch > 100 up to 255 is a higher pitch, pitch < 100
|
||||
// down to 1 is a lower pitch. 150 to 70 is the realistic range.
|
||||
// EMIT_SOUND_DYN with pitch != 100 should be used sparingly, as it's not quite as
|
||||
// fast as EMIT_SOUND (the pitchshift mixer is not native coded).
|
||||
inline void EMIT_SOUND(edict_t *entity, int channel, const char *sample, float volume, float attenuation)
|
||||
{
|
||||
EMIT_SOUND_DYN(entity, channel, sample, volume, attenuation, 0, PITCH_NORM);
|
||||
}
|
||||
|
||||
inline void STOP_SOUND(edict_t *entity, int channel, const char *sample)
|
||||
{
|
||||
EMIT_SOUND_DYN(entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM);
|
||||
}
|
||||
|
||||
inline void EMIT_SOUND_MSG(edict_t *entity, int msg_type, int channel, const char *sample, float volume, float attenuation, int flags, int pitch = PITCH_NORM, Vector vecOrigin = g_vecZero, edict_t *player = nullptr)
|
||||
{
|
||||
BUILD_SOUND_MSG(entity, channel, sample, (volume * 255.0f), attenuation, flags, pitch, msg_type, SVC_NOP, vecOrigin, player);
|
||||
}
|
||||
|
||||
inline void STOP_SOUND_MSG(edict_t *entity, int msg_type, int channel, const char *sample, edict_t *player)
|
||||
{
|
||||
BUILD_SOUND_MSG(entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM, msg_type, SVC_NOP, g_vecZero, player);
|
||||
}
|
||||
|
||||
class CBaseEntity;
|
||||
class CBasePlayer;
|
||||
class CBasePlayerItem;
|
||||
|
||||
float UTIL_WeaponTimeBase();
|
||||
unsigned int U_Random();
|
||||
void U_Srand(unsigned int seed);
|
||||
int UTIL_SharedRandomLong(unsigned int seed, int low, int high);
|
||||
float UTIL_SharedRandomFloat(unsigned int seed, float low, float high);
|
||||
void UTIL_ParametricRocket(entvars_t *pev, Vector vecOrigin, Vector vecAngles, edict_t *owner);
|
||||
void UTIL_SetGroupTrace(int groupmask, int op);
|
||||
void UTIL_UnsetGroupTrace();
|
||||
BOOL UTIL_GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);
|
||||
float UTIL_AngleMod(float a);
|
||||
float UTIL_AngleDiff(float destAngle, float srcAngle);
|
||||
Vector UTIL_VecToAngles(const Vector &vec);
|
||||
void UTIL_MoveToOrigin(edict_t *pent, const Vector &vecGoal, float flDist, int iMoveType);
|
||||
int UTIL_EntitiesInBox(CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask);
|
||||
int UTIL_MonstersInSphere(CBaseEntity **pList, int listMax, const Vector ¢er, float radius);
|
||||
CBaseEntity *UTIL_FindEntityInSphere(CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius);
|
||||
CBaseEntity *UTIL_FindEntityByString_Old(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);
|
||||
CBaseEntity *UTIL_FindEntityByString(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);
|
||||
CBaseEntity *UTIL_FindEntityByClassname(CBaseEntity *pStartEntity, const char *szName);
|
||||
CBaseEntity *UTIL_FindEntityByTargetname(CBaseEntity *pStartEntity, const char *szName);
|
||||
CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc, float flRadius);
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
CBasePlayer *UTIL_PlayerByIndex(int playerIndex);
|
||||
#endif
|
||||
void UTIL_MakeVectors(const Vector &vecAngles);
|
||||
void UTIL_MakeAimVectors(const Vector &vecAngles);
|
||||
void UTIL_MakeInvVectors(const Vector &vec, globalvars_t *pgv);
|
||||
void UTIL_EmitAmbientSound(edict_t *entity, const Vector &vecOrigin, const char *samp, float vol, float attenuation, int fFlags, int pitch);
|
||||
unsigned short FixedUnsigned16(float value, float scale);
|
||||
short FixedSigned16(float value, float scale);
|
||||
void UTIL_ScreenShake(const Vector ¢er, float amplitude, float frequency, float duration, float radius);
|
||||
void UTIL_ScreenShakeAll(const Vector ¢er, float amplitude, float frequency, float duration);
|
||||
void UTIL_ScreenFadeBuild(ScreenFade &fade, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags);
|
||||
void UTIL_ScreenFadeWrite(const ScreenFade &fade, CBaseEntity *pEntity);
|
||||
void UTIL_ScreenFadeAll(const Vector &color, float fadeTime, float fadeHold, int alpha, int flags);
|
||||
void UTIL_ScreenFade(CBaseEntity *pEntity, const Vector &color, float fadeTime, float fadeHold = 0.0f, int alpha = 0, int flags = 0);
|
||||
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
void UTIL_HudMessageAll(const hudtextparms_t &textparms, const char *pMessage);
|
||||
void UTIL_ClientPrintAll(int msg_dest, const char *msg_name, const char *param1 = nullptr, const char *param2 = nullptr, const char *param3 = nullptr, const char *param4 = nullptr);
|
||||
void ClientPrint(entvars_t *client, int msg_dest, const char *msg_name, const char *param1 = nullptr, const char *param2 = nullptr, const char *param3 = nullptr, const char *param4 = nullptr);
|
||||
void UTIL_Log(const char *fmt, ...);
|
||||
void UTIL_ServerPrint(const char *fmt, ...);
|
||||
void UTIL_PrintConsole(edict_t *pEdict, const char *fmt, ...);
|
||||
void UTIL_SayText(CBaseEntity *pEntity, const char *fmt, ...);
|
||||
void UTIL_SayTextAll(const char *pText, CBaseEntity *pEntity);
|
||||
char *UTIL_dtos1(int d);
|
||||
char *UTIL_dtos2(int d);
|
||||
char *UTIL_dtos3(int d);
|
||||
char *UTIL_dtos4(int d);
|
||||
void UTIL_ShowMessageArgs(const char *pString, CBaseEntity *pPlayer, CUtlVector<char*> *args, bool isHint = false);
|
||||
void UTIL_ShowMessage(const char *pString, CBaseEntity *pEntity, bool isHint = false);
|
||||
void UTIL_ShowMessageAll(const char *pString, bool isHint = false);
|
||||
void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr);
|
||||
void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr);
|
||||
void UTIL_TraceHull(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr);
|
||||
void UTIL_TraceModel(const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr);
|
||||
TraceResult UTIL_GetGlobalTrace();
|
||||
void UTIL_SetSize(entvars_t *pev, const Vector &vecMin, const Vector &vecMax);
|
||||
float UTIL_VecToYaw(const Vector &vec);
|
||||
void UTIL_SetOrigin(entvars_t *pev, const Vector &vecOrigin);
|
||||
void UTIL_ParticleEffect(const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount);
|
||||
float UTIL_Approach(float target, float value, float speed);
|
||||
real_t UTIL_ApproachAngle(float target, float value, float speed);
|
||||
real_t UTIL_AngleDistance(float next, float cur);
|
||||
float UTIL_SplineFraction(float value, float scale);
|
||||
char *UTIL_VarArgs(char *format, ...);
|
||||
Vector UTIL_GetAimVector(edict_t *pent, float flSpeed);
|
||||
bool UTIL_IsMasterTriggered(string_t sMaster, CBaseEntity *pActivator);
|
||||
BOOL UTIL_ShouldShowBlood(int color);
|
||||
int UTIL_PointContents(const Vector &vec);
|
||||
void UTIL_BloodStream(const Vector &origin, const Vector &direction, int color, int amount);
|
||||
void UTIL_BloodDrips(const Vector &origin, const Vector &direction, int color, int amount);
|
||||
Vector UTIL_RandomBloodVector();
|
||||
void UTIL_BloodDecalTrace(TraceResult *pTrace, int bloodColor);
|
||||
void UTIL_DecalTrace(TraceResult *pTrace, int decalNumber);
|
||||
void UTIL_PlayerDecalTrace(TraceResult *pTrace, int playernum, int decalNumber, BOOL bIsCustom);
|
||||
void UTIL_GunshotDecalTrace(TraceResult *pTrace, int decalNumber, bool ClientOnly, entvars_t *pShooter);
|
||||
void UTIL_Sparks(const Vector &position);
|
||||
void UTIL_Ricochet(const Vector &position, float scale);
|
||||
bool UTIL_TeamsMatch(const char *pTeamName1, const char *pTeamName2);
|
||||
void UTIL_StringToVector(float *pVector, const char *pString);
|
||||
void UTIL_StringToVector(Vector &vecIn, const char *pString, char cSeparator);
|
||||
void UTIL_StringToVectorND(Vector &vecIn, int nCount, const char *pString, char cSeparator);
|
||||
void UTIL_StringToIntArray(int *pVector, int count, const char *pString);
|
||||
Vector UTIL_ClampVectorToBox(const Vector &input, const Vector &clampSize);
|
||||
float UTIL_WaterLevel(const Vector &position, float minz, float maxz);
|
||||
void UTIL_Bubbles(Vector mins, Vector maxs, int count);
|
||||
void UTIL_BubbleTrail(Vector from, Vector to, int count);
|
||||
void UTIL_Remove(CBaseEntity *pEntity);
|
||||
BOOL UTIL_IsValidEntity(edict_t *pent);
|
||||
void UTIL_PrecacheOther(const char *szClassname);
|
||||
void UTIL_RestartOther(const char *szClassname);
|
||||
void UTIL_ResetEntities();
|
||||
void UTIL_RemoveOther(const char *szClassname, int nCount = 0);
|
||||
void UTIL_LogPrintf(const char *fmt, ...);
|
||||
float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir);
|
||||
void EntvarsKeyvalue(entvars_t *pev, KeyValueData *pkvd);
|
||||
char UTIL_TextureHit(TraceResult *ptr, Vector vecSrc, Vector vecEnd);
|
||||
int GetPlayerTeam(int index);
|
||||
bool UTIL_IsGame(const char *pszGameName);
|
||||
real_t UTIL_GetPlayerGaitYaw(int playerIndex);
|
||||
int UTIL_ReadFlags(const char *c);
|
||||
bool UTIL_AreBotsAllowed();
|
||||
bool UTIL_IsBeta();
|
||||
bool UTIL_AreHostagesImprov();
|
||||
int UTIL_GetNumPlayers();
|
||||
bool UTIL_IsSpawnPointOccupied(CBaseEntity *pSpot);
|
||||
void MAKE_STRING_CLASS(const char *str, entvars_t *pev);
|
||||
void NORETURN Sys_Error(const char *error, ...);
|
||||
|
||||
// Inlines
|
||||
template <typename T = CBaseEntity>
|
||||
inline T *UTIL_FindEntityByClassname(T *pStartEntity, const char *szName)
|
||||
{
|
||||
return (T *)UTIL_FindEntityByString(pStartEntity, "classname", szName);
|
||||
}
|
||||
|
||||
template <typename T = CBaseEntity>
|
||||
inline T *UTIL_FindEntityByTargetname(T *pStartEntity, const char *szName)
|
||||
{
|
||||
return (T *)UTIL_FindEntityByString(pStartEntity, "targetname", szName);
|
||||
}
|
||||
|
||||
template <typename T = CBaseEntity>
|
||||
inline T *UTIL_FindEntityInSphere(T *pStartEntity, const Vector &vecCenter, float flRadius)
|
||||
{
|
||||
edict_t *pentEntity;
|
||||
if (pStartEntity)
|
||||
pentEntity = pStartEntity->edict();
|
||||
else
|
||||
pentEntity = nullptr;
|
||||
|
||||
pentEntity = FIND_ENTITY_IN_SPHERE(pentEntity, vecCenter, flRadius);
|
||||
if (!FNullEnt(pentEntity))
|
||||
{
|
||||
// a1ba: can't use CBaseEntity::Instance here, because circular dependency in cbase.h
|
||||
return GET_PRIVATE<T>(pentEntity);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <size_t nSize>
|
||||
void UTIL_StripToken(const char *pKey, char (&pDest)[nSize])
|
||||
{
|
||||
int i = 0;
|
||||
while (i < nSize && pKey[i] && pKey[i] != '#')
|
||||
{
|
||||
pDest[i] = pKey[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
pDest[i] = '\0';
|
||||
}
|
||||
|
||||
class CPlayerInVolumeAdapter
|
||||
{
|
||||
public:
|
||||
virtual ~CPlayerInVolumeAdapter() {};
|
||||
virtual void PlayerDetected(const bool fInVolume, CBasePlayer *pPlayer) = 0;
|
||||
};
|
||||
|
||||
int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, int &playersInCount, int &playersOutCount, CPlayerInVolumeAdapter *pAdapter = nullptr);
|
||||
|
||||
inline real_t UTIL_FixupAngle(real_t v)
|
||||
{
|
||||
real_t angle = v;
|
||||
|
||||
while (angle < 0)
|
||||
angle += 360;
|
||||
|
||||
while (angle > 360)
|
||||
angle -= 360;
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
inline void UTIL_FixupAngles(Vector &v)
|
||||
{
|
||||
v.x = UTIL_FixupAngle(v.x);
|
||||
v.y = UTIL_FixupAngle(v.y);
|
||||
v.z = UTIL_FixupAngle(v.z);
|
||||
}
|
||||
|
||||
extern int g_groupmask;
|
||||
extern int g_groupop;
|
||||
/*
|
||||
*
|
||||
* 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 "shake.h"
|
||||
#include "activity.h"
|
||||
#include "enginecallback.h"
|
||||
#include "utlvector.h"
|
||||
|
||||
#define GROUP_OP_AND 0
|
||||
#define GROUP_OP_NAND 1
|
||||
|
||||
// Dot products for view cone checking
|
||||
#define VIEW_FIELD_FULL -1.0 // +-180 degrees
|
||||
#define VIEW_FIELD_WIDE -0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks
|
||||
#define VIEW_FIELD_NARROW 0.7 // +-45 degrees, more narrow check used to set up ranged attacks
|
||||
#define VIEW_FIELD_ULTRA_NARROW 0.9 // +-25 degrees, more narrow check used to set up ranged attacks
|
||||
|
||||
#define SND_STOP BIT(5) // duplicated in protocol.h stop sound
|
||||
#define SND_CHANGE_VOL BIT(6) // duplicated in protocol.h change sound vol
|
||||
#define SND_CHANGE_PITCH BIT(7) // duplicated in protocol.h change sound pitch
|
||||
#define SND_SPAWNING BIT(8) // duplicated in protocol.h we're spawing, used in some cases for ambients
|
||||
|
||||
// All monsters need this data
|
||||
#define DONT_BLEED -1
|
||||
#define BLOOD_COLOR_DARKRED (byte)223
|
||||
#define BLOOD_COLOR_RED (byte)247
|
||||
#define BLOOD_COLOR_YELLOW (byte)195
|
||||
#define BLOOD_COLOR_GREEN BLOOD_COLOR_YELLOW
|
||||
|
||||
#define GERMAN_GIB_COUNT 4
|
||||
#define HUMAN_GIB_COUNT 6
|
||||
#define ALIEN_GIB_COUNT 4
|
||||
|
||||
#define LANGUAGE_ENGLISH 0
|
||||
#define LANGUAGE_GERMAN 1
|
||||
#define LANGUAGE_FRENCH 2
|
||||
#define LANGUAGE_BRITISH 3
|
||||
|
||||
#define SVC_NOP 1
|
||||
#define SVC_SOUND 6
|
||||
#define SVC_TEMPENTITY 23
|
||||
#define SVC_INTERMISSION 30
|
||||
#define SVC_CDTRACK 32
|
||||
#define SVC_WEAPONANIM 35
|
||||
#define SVC_ROOMTYPE 37
|
||||
#define SVC_DIRECTOR 51
|
||||
|
||||
#define VEC_HULL_MIN_Z Vector(0, 0, -36)
|
||||
#define VEC_DUCK_HULL_MIN_Z Vector(0, 0, -18)
|
||||
|
||||
#define VEC_HULL_MIN Vector(-16, -16, -36)
|
||||
#define VEC_HULL_MAX Vector(16, 16, 36)
|
||||
|
||||
#define VEC_VIEW Vector(0, 0, 17)
|
||||
|
||||
#define VEC_SPOT_HULL_MIN Vector(-16, -16, 0)
|
||||
#define VEC_SPOT_HULL_MAX Vector(16, 16, 72)
|
||||
|
||||
#define VEC_DUCK_HULL_MIN Vector(-16, -16, -18)
|
||||
#define VEC_DUCK_HULL_MAX Vector(16, 16, 32)
|
||||
#define VEC_DUCK_VIEW Vector(0, 0, 12)
|
||||
|
||||
#define PRECACHE_SOUND_ARRAY(a) \
|
||||
{ for (int i = 0; i < ARRAYSIZE(a); i++) PRECACHE_SOUND((char *)a[i]); }
|
||||
|
||||
#define PLAYBACK_EVENT(flags, who, index)\
|
||||
PLAYBACK_EVENT_FULL(flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
|
||||
|
||||
#define PLAYBACK_EVENT_DELAY(flags, who, index, delay)\
|
||||
PLAYBACK_EVENT_FULL(flags, who, index, delay, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
|
||||
|
||||
#define LINK_ENTITY_TO_CLASS(mapClassName, DLLClassName, DLLClassWrapName)\
|
||||
C_DLLEXPORT void EXT_FUNC mapClassName(entvars_t *pev);\
|
||||
void mapClassName(entvars_t *pev)\
|
||||
{\
|
||||
GetClassPtr<DLLClassWrapName>((DLLClassName *)pev);\
|
||||
}
|
||||
|
||||
const EOFFSET eoNullEntity = (EOFFSET)0; // Testing the three types of "entity" for nullity
|
||||
|
||||
class UTIL_GroupTrace
|
||||
{
|
||||
public:
|
||||
UTIL_GroupTrace(int groupmask, int op);
|
||||
~UTIL_GroupTrace();
|
||||
private:
|
||||
int m_oldgroupmask;
|
||||
int m_oldgroupop;
|
||||
};
|
||||
|
||||
// Inlines
|
||||
inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "classname", pszName); }
|
||||
inline edict_t *FIND_ENTITY_BY_TARGETNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "targetname", pszName); }
|
||||
|
||||
inline edict_t *ENT(const entvars_t *pev) { return pev->pContainingEntity; }
|
||||
inline edict_t *ENT(EOFFSET eoffset) { return (*g_engfuncs.pfnPEntityOfEntOffset)(eoffset); }
|
||||
inline EOFFSET OFFSET(const edict_t *pent) { return (*g_engfuncs.pfnEntOffsetOfPEntity)(pent); }
|
||||
inline EOFFSET OFFSET(const entvars_t *pev) { return OFFSET(ENT(pev)); }
|
||||
|
||||
inline entvars_t *VARS(edict_t *pent)
|
||||
{
|
||||
if (!pent)
|
||||
return nullptr;
|
||||
|
||||
return &pent->v;
|
||||
}
|
||||
|
||||
inline entvars_t *VARS(EOFFSET eoffset)
|
||||
{
|
||||
return VARS(ENT(eoffset));
|
||||
}
|
||||
|
||||
#ifndef ENTINDEX
|
||||
inline int ENTINDEX(const edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
|
||||
inline int ENTINDEX(const entvars_t *pev) { return (*g_engfuncs.pfnIndexOfEdict)(ENT(pev)); }
|
||||
#endif // ENTINDEX
|
||||
|
||||
#ifndef INDEXENT
|
||||
inline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }
|
||||
#endif // INDEXENT
|
||||
|
||||
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent) { MESSAGE_BEGIN(msg_dest, msg_type, pOrigin, ENT(ent)); }
|
||||
inline bool FNullEnt(EOFFSET eoffset) { return (eoffset == 0); }
|
||||
inline bool FNullEnt(entvars_t *pev) { return (pev == nullptr || FNullEnt(OFFSET(pev))); }
|
||||
inline bool FNullEnt(const edict_t *pent) { return (pent == nullptr || pent->free || FNullEnt(OFFSET(pent))); }
|
||||
inline bool FStringNull(string_t iString) { return (iString == iStringNull); }
|
||||
inline bool FStrEq(const char *sz1, const char *sz2) { return (Q_strcmp(sz1, sz2) == 0); }
|
||||
inline bool FStrnEq(const char *sz1, const char *sz2, size_t elem) { return (Q_strncmp(sz1, sz2, elem) == 0); }
|
||||
|
||||
inline bool FClassnameIs(entvars_t *pev, const char *szClassname) { return FStrEq(STRING(pev->classname), szClassname); }
|
||||
inline bool FClassnameIs(edict_t *pent, const char *szClassname) { return FStrEq(STRING(VARS(pent)->classname), szClassname); }
|
||||
inline void UTIL_MakeVectorsPrivate(Vector vecAngles, float *p_vForward, float *p_vRight, float *p_vUp) { g_engfuncs.pfnAngleVectors(vecAngles, p_vForward, p_vRight, p_vUp); }
|
||||
|
||||
#include "ehandle.h"
|
||||
|
||||
extern void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch);
|
||||
|
||||
// NOTE: use EMIT_SOUND_DYN to set the pitch of a sound. Pitch of 100
|
||||
// is no pitch shift. Pitch > 100 up to 255 is a higher pitch, pitch < 100
|
||||
// down to 1 is a lower pitch. 150 to 70 is the realistic range.
|
||||
// EMIT_SOUND_DYN with pitch != 100 should be used sparingly, as it's not quite as
|
||||
// fast as EMIT_SOUND (the pitchshift mixer is not native coded).
|
||||
inline void EMIT_SOUND(edict_t *entity, int channel, const char *sample, float volume, float attenuation)
|
||||
{
|
||||
EMIT_SOUND_DYN(entity, channel, sample, volume, attenuation, 0, PITCH_NORM);
|
||||
}
|
||||
|
||||
inline void STOP_SOUND(edict_t *entity, int channel, const char *sample)
|
||||
{
|
||||
EMIT_SOUND_DYN(entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM);
|
||||
}
|
||||
|
||||
inline void EMIT_SOUND_MSG(edict_t *entity, int msg_type, int channel, const char *sample, float volume, float attenuation, int flags, int pitch = PITCH_NORM, Vector vecOrigin = g_vecZero, edict_t *player = nullptr)
|
||||
{
|
||||
BUILD_SOUND_MSG(entity, channel, sample, (volume * 255.0f), attenuation, flags, pitch, msg_type, SVC_NOP, vecOrigin, player);
|
||||
}
|
||||
|
||||
inline void STOP_SOUND_MSG(edict_t *entity, int msg_type, int channel, const char *sample, edict_t *player)
|
||||
{
|
||||
BUILD_SOUND_MSG(entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM, msg_type, SVC_NOP, g_vecZero, player);
|
||||
}
|
||||
|
||||
class CBaseEntity;
|
||||
class CBasePlayer;
|
||||
class CBasePlayerItem;
|
||||
|
||||
float UTIL_WeaponTimeBase();
|
||||
unsigned int U_Random();
|
||||
void U_Srand(unsigned int seed);
|
||||
int UTIL_SharedRandomLong(unsigned int seed, int low, int high);
|
||||
float UTIL_SharedRandomFloat(unsigned int seed, float low, float high);
|
||||
void UTIL_ParametricRocket(entvars_t *pev, Vector vecOrigin, Vector vecAngles, edict_t *owner);
|
||||
void UTIL_SetGroupTrace(int groupmask, int op);
|
||||
void UTIL_UnsetGroupTrace();
|
||||
BOOL UTIL_GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);
|
||||
float UTIL_AngleMod(float a);
|
||||
float UTIL_AngleDiff(float destAngle, float srcAngle);
|
||||
Vector UTIL_VecToAngles(const Vector &vec);
|
||||
void UTIL_MoveToOrigin(edict_t *pent, const Vector &vecGoal, float flDist, int iMoveType);
|
||||
int UTIL_EntitiesInBox(CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask);
|
||||
int UTIL_MonstersInSphere(CBaseEntity **pList, int listMax, const Vector ¢er, float radius);
|
||||
CBaseEntity *UTIL_FindEntityInSphere(CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius);
|
||||
CBaseEntity *UTIL_FindEntityByString_Old(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);
|
||||
CBaseEntity *UTIL_FindEntityByString(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);
|
||||
CBaseEntity *UTIL_FindEntityByClassname(CBaseEntity *pStartEntity, const char *szName);
|
||||
CBaseEntity *UTIL_FindEntityByTargetname(CBaseEntity *pStartEntity, const char *szName);
|
||||
CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc, float flRadius);
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
CBasePlayer *UTIL_PlayerByIndex(int playerIndex);
|
||||
#endif
|
||||
void UTIL_MakeVectors(const Vector &vecAngles);
|
||||
void UTIL_MakeAimVectors(const Vector &vecAngles);
|
||||
void UTIL_MakeInvVectors(const Vector &vec, globalvars_t *pgv);
|
||||
void UTIL_EmitAmbientSound(edict_t *entity, const Vector &vecOrigin, const char *samp, float vol, float attenuation, int fFlags, int pitch);
|
||||
unsigned short FixedUnsigned16(float value, float scale);
|
||||
short FixedSigned16(float value, float scale);
|
||||
void UTIL_ScreenShake(const Vector ¢er, float amplitude, float frequency, float duration, float radius);
|
||||
void UTIL_ScreenShakeAll(const Vector ¢er, float amplitude, float frequency, float duration);
|
||||
void UTIL_ScreenFadeBuild(ScreenFade &fade, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags);
|
||||
void UTIL_ScreenFadeWrite(const ScreenFade &fade, CBaseEntity *pEntity);
|
||||
void UTIL_ScreenFadeAll(const Vector &color, float fadeTime, float fadeHold, int alpha, int flags);
|
||||
void UTIL_ScreenFade(CBaseEntity *pEntity, const Vector &color, float fadeTime, float fadeHold = 0.0f, int alpha = 0, int flags = 0);
|
||||
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
void UTIL_HudMessageAll(const hudtextparms_t &textparms, const char *pMessage);
|
||||
void UTIL_ClientPrintAll(int msg_dest, const char *msg_name, const char *param1 = nullptr, const char *param2 = nullptr, const char *param3 = nullptr, const char *param4 = nullptr);
|
||||
void ClientPrint(entvars_t *client, int msg_dest, const char *msg_name, const char *param1 = nullptr, const char *param2 = nullptr, const char *param3 = nullptr, const char *param4 = nullptr);
|
||||
void UTIL_Log(const char *fmt, ...);
|
||||
void UTIL_ServerPrint(const char *fmt, ...);
|
||||
void UTIL_PrintConsole(edict_t *pEdict, const char *fmt, ...);
|
||||
void UTIL_SayText(CBaseEntity *pEntity, const char *fmt, ...);
|
||||
void UTIL_SayTextAll(const char *pText, CBaseEntity *pEntity);
|
||||
char *UTIL_dtos1(int d);
|
||||
char *UTIL_dtos2(int d);
|
||||
char *UTIL_dtos3(int d);
|
||||
char *UTIL_dtos4(int d);
|
||||
void UTIL_ShowMessageArgs(const char *pString, CBaseEntity *pPlayer, CUtlVector<char*> *args, bool isHint = false);
|
||||
void UTIL_ShowMessage(const char *pString, CBaseEntity *pEntity, bool isHint = false);
|
||||
void UTIL_ShowMessageAll(const char *pString, bool isHint = false);
|
||||
void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr);
|
||||
void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr);
|
||||
void UTIL_TraceHull(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr);
|
||||
void UTIL_TraceModel(const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr);
|
||||
TraceResult UTIL_GetGlobalTrace();
|
||||
void UTIL_SetSize(entvars_t *pev, const Vector &vecMin, const Vector &vecMax);
|
||||
float UTIL_VecToYaw(const Vector &vec);
|
||||
void UTIL_SetOrigin(entvars_t *pev, const Vector &vecOrigin);
|
||||
void UTIL_ParticleEffect(const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount);
|
||||
float UTIL_Approach(float target, float value, float speed);
|
||||
real_t UTIL_ApproachAngle(float target, float value, float speed);
|
||||
real_t UTIL_AngleDistance(float next, float cur);
|
||||
float UTIL_SplineFraction(float value, float scale);
|
||||
char *UTIL_VarArgs(char *format, ...);
|
||||
Vector UTIL_GetAimVector(edict_t *pent, float flSpeed);
|
||||
bool UTIL_IsMasterTriggered(string_t sMaster, CBaseEntity *pActivator);
|
||||
BOOL UTIL_ShouldShowBlood(int color);
|
||||
int UTIL_PointContents(const Vector &vec);
|
||||
void UTIL_BloodStream(const Vector &origin, const Vector &direction, int color, int amount);
|
||||
void UTIL_BloodDrips(const Vector &origin, const Vector &direction, int color, int amount);
|
||||
Vector UTIL_RandomBloodVector();
|
||||
void UTIL_BloodDecalTrace(TraceResult *pTrace, int bloodColor);
|
||||
void UTIL_DecalTrace(TraceResult *pTrace, int decalNumber);
|
||||
void UTIL_PlayerDecalTrace(TraceResult *pTrace, int playernum, int decalNumber, BOOL bIsCustom);
|
||||
void UTIL_GunshotDecalTrace(TraceResult *pTrace, int decalNumber, bool ClientOnly, entvars_t *pShooter);
|
||||
void UTIL_Sparks(const Vector &position);
|
||||
void UTIL_Ricochet(const Vector &position, float scale);
|
||||
bool UTIL_TeamsMatch(const char *pTeamName1, const char *pTeamName2);
|
||||
void UTIL_StringToVector(float *pVector, const char *pString);
|
||||
void UTIL_StringToVector(Vector &vecIn, const char *pString, char cSeparator);
|
||||
void UTIL_StringToVectorND(Vector &vecIn, int nCount, const char *pString, char cSeparator);
|
||||
void UTIL_StringToIntArray(int *pVector, int count, const char *pString);
|
||||
Vector UTIL_ClampVectorToBox(const Vector &input, const Vector &clampSize);
|
||||
float UTIL_WaterLevel(const Vector &position, float minz, float maxz);
|
||||
void UTIL_Bubbles(Vector mins, Vector maxs, int count);
|
||||
void UTIL_BubbleTrail(Vector from, Vector to, int count);
|
||||
void UTIL_Remove(CBaseEntity *pEntity);
|
||||
BOOL UTIL_IsValidEntity(edict_t *pent);
|
||||
void UTIL_PrecacheOther(const char *szClassname);
|
||||
void UTIL_RestartOther(const char *szClassname);
|
||||
void UTIL_ResetEntities();
|
||||
void UTIL_RemoveOther(const char *szClassname, int nCount = 0);
|
||||
void UTIL_LogPrintf(const char *fmt, ...);
|
||||
float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir);
|
||||
void EntvarsKeyvalue(entvars_t *pev, KeyValueData *pkvd);
|
||||
char UTIL_TextureHit(TraceResult *ptr, Vector vecSrc, Vector vecEnd);
|
||||
int GetPlayerTeam(int index);
|
||||
bool UTIL_IsGame(const char *pszGameName);
|
||||
real_t UTIL_GetPlayerGaitYaw(int playerIndex);
|
||||
int UTIL_ReadFlags(const char *c);
|
||||
bool UTIL_AreBotsAllowed();
|
||||
bool UTIL_IsBeta();
|
||||
bool UTIL_AreHostagesImprov();
|
||||
int UTIL_GetNumPlayers();
|
||||
bool UTIL_IsSpawnPointOccupied(CBaseEntity *pSpot);
|
||||
void MAKE_STRING_CLASS(const char *str, entvars_t *pev);
|
||||
void NORETURN Sys_Error(const char *error, ...);
|
||||
|
||||
// Inlines
|
||||
template <typename T = CBaseEntity>
|
||||
inline T *UTIL_FindEntityByClassname(T *pStartEntity, const char *szName)
|
||||
{
|
||||
return (T *)UTIL_FindEntityByString(pStartEntity, "classname", szName);
|
||||
}
|
||||
|
||||
template <typename T = CBaseEntity>
|
||||
inline T *UTIL_FindEntityByTargetname(T *pStartEntity, const char *szName)
|
||||
{
|
||||
return (T *)UTIL_FindEntityByString(pStartEntity, "targetname", szName);
|
||||
}
|
||||
|
||||
template <typename T = CBaseEntity>
|
||||
inline T *UTIL_FindEntityInSphere(T *pStartEntity, const Vector &vecCenter, float flRadius)
|
||||
{
|
||||
edict_t *pentEntity;
|
||||
if (pStartEntity)
|
||||
pentEntity = pStartEntity->edict();
|
||||
else
|
||||
pentEntity = nullptr;
|
||||
|
||||
pentEntity = FIND_ENTITY_IN_SPHERE(pentEntity, vecCenter, flRadius);
|
||||
if (!FNullEnt(pentEntity))
|
||||
{
|
||||
// a1ba: can't use CBaseEntity::Instance here, because circular dependency in cbase.h
|
||||
return GET_PRIVATE<T>(pentEntity);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <size_t nSize>
|
||||
void UTIL_StripToken(const char *pKey, char (&pDest)[nSize])
|
||||
{
|
||||
int i = 0;
|
||||
while (i < nSize && pKey[i] && pKey[i] != '#')
|
||||
{
|
||||
pDest[i] = pKey[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
pDest[i] = '\0';
|
||||
}
|
||||
|
||||
class CPlayerInVolumeAdapter
|
||||
{
|
||||
public:
|
||||
virtual ~CPlayerInVolumeAdapter() {};
|
||||
virtual void PlayerDetected(const bool fInVolume, CBasePlayer *pPlayer) = 0;
|
||||
};
|
||||
|
||||
int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, int &playersInCount, int &playersOutCount, CPlayerInVolumeAdapter *pAdapter = nullptr);
|
||||
|
||||
inline real_t UTIL_FixupAngle(real_t v)
|
||||
{
|
||||
real_t angle = v;
|
||||
|
||||
while (angle < 0)
|
||||
angle += 360;
|
||||
|
||||
while (angle > 360)
|
||||
angle -= 360;
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
inline void UTIL_FixupAngles(Vector &v)
|
||||
{
|
||||
v.x = UTIL_FixupAngle(v.x);
|
||||
v.y = UTIL_FixupAngle(v.y);
|
||||
v.z = UTIL_FixupAngle(v.z);
|
||||
}
|
||||
|
||||
extern int g_groupmask;
|
||||
extern int g_groupop;
|
||||
|
@ -1,426 +1,426 @@
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
// Used for many pathfinding and many other operations that are treated as planar rather than 3D.
|
||||
class Vector2D
|
||||
{
|
||||
public:
|
||||
// Construction/destruction
|
||||
Vector2D() : x(), y() {}
|
||||
Vector2D(float X, float Y) : x(X), y(Y) {}
|
||||
Vector2D(const Vector2D &v) { *(int *)&x = *(int *)&v.x; *(int *)&y = *(int *)&v.y; }
|
||||
|
||||
// Operators
|
||||
decltype(auto) operator-() const { return Vector2D(-x, -y); }
|
||||
bool operator==(const Vector2D &v) const { return x == v.x && y == v.y; }
|
||||
bool operator!=(const Vector2D &v) const { return !(*this == v); }
|
||||
|
||||
decltype(auto) operator+(const Vector2D &v) const { return Vector2D(x + v.x, y + v.y); }
|
||||
decltype(auto) operator-(const Vector2D &v) const { return Vector2D(x - v.x, y - v.y); }
|
||||
decltype(auto) operator*(const Vector2D &v) const { return Vector2D(x * v.x, y * v.y); }
|
||||
decltype(auto) operator/(const Vector2D &v) const { return Vector2D(x / v.x, y / v.y); }
|
||||
|
||||
decltype(auto) operator+=(const Vector2D &v) { return (*this = *this + v); }
|
||||
decltype(auto) operator-=(const Vector2D &v) { return (*this = *this - v); }
|
||||
decltype(auto) operator*=(const Vector2D &v) { return (*this = *this * v); }
|
||||
decltype(auto) operator/=(const Vector2D &v) { return (*this = *this / v); }
|
||||
|
||||
decltype(auto) operator+(float fl) const { return Vector2D(x + fl, y + fl); }
|
||||
decltype(auto) operator-(float fl) const { return Vector2D(x - fl, y - fl); }
|
||||
|
||||
// TODO: FIX ME!!
|
||||
#ifdef PLAY_GAMEDLL
|
||||
decltype(auto) operator*(float fl) const { return Vector2D(vec_t(x * fl), vec_t(y * fl)); }
|
||||
decltype(auto) operator/(float fl) const { return Vector2D(vec_t(x / fl), vec_t(y / fl)); }
|
||||
#else
|
||||
decltype(auto) operator*(float fl) const { return Vector2D(x * fl, y * fl); }
|
||||
decltype(auto) operator/(float fl) const { return Vector2D(x / fl, y / fl); }
|
||||
#endif
|
||||
|
||||
decltype(auto) operator=(std::nullptr_t) { return Vector2D(0, 0); }
|
||||
decltype(auto) operator+=(float fl) { return (*this = *this + fl); }
|
||||
decltype(auto) operator-=(float fl) { return (*this = *this - fl); }
|
||||
decltype(auto) operator*=(float fl) { return (*this = *this * fl); }
|
||||
decltype(auto) operator/=(float fl) { return (*this = *this / fl); }
|
||||
|
||||
// Methods
|
||||
inline void Clear() { x = 0; y = 0; }
|
||||
inline void CopyToArray(float *rgfl) const { *(int *)&rgfl[0] = *(int *)&x; *(int *)&rgfl[1] = *(int *)&y; }
|
||||
inline real_t Length() const { return Q_sqrt(real_t(x * x + y * y)); } // Get the vector's magnitude
|
||||
inline float LengthSquared() const { return (x * x + y * y); } // Get the vector's magnitude squared
|
||||
|
||||
operator float*() { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
operator const float*() const { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
|
||||
Vector2D Normalize() const
|
||||
{
|
||||
real_t flLen = Length();
|
||||
if (!flLen)
|
||||
return Vector2D(0, 0);
|
||||
|
||||
flLen = 1 / flLen;
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
return Vector2D(vec_t(x * flLen), vec_t(y * flLen));
|
||||
#else
|
||||
return Vector2D(x * flLen, y * flLen);
|
||||
#endif // PLAY_GAMEDLL
|
||||
}
|
||||
inline bool IsLengthLessThan (float length) const { return (LengthSquared() < length * length); }
|
||||
inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); }
|
||||
real_t NormalizeInPlace()
|
||||
{
|
||||
real_t flLen = Length();
|
||||
if (flLen > 0.0)
|
||||
{
|
||||
x = vec_t(1 / flLen * x);
|
||||
y = vec_t(1 / flLen * y);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 1.0;
|
||||
y = 0.0;
|
||||
}
|
||||
return flLen;
|
||||
}
|
||||
bool IsZero(float tolerance = 0.01f) const
|
||||
{
|
||||
return (x > -tolerance && x < tolerance &&
|
||||
y > -tolerance && y < tolerance);
|
||||
}
|
||||
|
||||
// Members
|
||||
vec_t x, y;
|
||||
};
|
||||
|
||||
inline real_t DotProduct(const Vector2D &a, const Vector2D &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y);
|
||||
}
|
||||
|
||||
inline Vector2D operator*(float fl, const Vector2D &v)
|
||||
{
|
||||
return v * fl;
|
||||
}
|
||||
|
||||
// 3D Vector
|
||||
// Same data-layout as engine's vec3_t, which is a vec_t[3]
|
||||
class Vector
|
||||
{
|
||||
public:
|
||||
// Construction/destruction
|
||||
Vector() : x(), y(), z() {}
|
||||
Vector(float X, float Y, float Z) : x(X), y(Y), z(Z) {}
|
||||
Vector(const Vector &v) { *(int *)&x = *(int *)&v.x; *(int *)&y = *(int *)&v.y; *(int *)&z = *(int *)&v.z; }
|
||||
Vector(const float rgfl[3]) { *(int *)&x = *(int *)&rgfl[0]; *(int *)&y = *(int *)&rgfl[1]; *(int *)&z = *(int *)&rgfl[2]; }
|
||||
|
||||
// Operators
|
||||
decltype(auto) operator-() const { return Vector(-x, -y, -z); }
|
||||
bool operator==(const Vector &v) const { return x == v.x && y == v.y && z == v.z; }
|
||||
bool operator!=(const Vector &v) const { return !(*this == v); }
|
||||
|
||||
decltype(auto) operator+(const Vector &v) const { return Vector(x + v.x, y + v.y, z + v.z); }
|
||||
decltype(auto) operator-(const Vector &v) const { return Vector(x - v.x, y - v.y, z - v.z); }
|
||||
decltype(auto) operator*(const Vector &v) const { return Vector(x * v.x, y * v.y, z * v.z); }
|
||||
decltype(auto) operator/(const Vector &v) const { return Vector(x / v.x, y / v.y, z / v.z); }
|
||||
|
||||
decltype(auto) operator+=(const Vector &v) { return (*this = *this + v); }
|
||||
decltype(auto) operator-=(const Vector &v) { return (*this = *this - v); }
|
||||
decltype(auto) operator*=(const Vector &v) { return (*this = *this * v); }
|
||||
decltype(auto) operator/=(const Vector &v) { return (*this = *this / v); }
|
||||
|
||||
decltype(auto) operator+(float fl) const { return Vector(x + fl, y + fl, z + fl); }
|
||||
decltype(auto) operator-(float fl) const { return Vector(x - fl, y - fl, z - fl); }
|
||||
|
||||
// TODO: FIX ME!!
|
||||
#ifdef PLAY_GAMEDLL
|
||||
decltype(auto) operator*(float fl) const { return Vector(vec_t(x * fl), vec_t(y * fl), vec_t(z * fl)); }
|
||||
decltype(auto) operator/(float fl) const { return Vector(vec_t(x / fl), vec_t(y / fl), vec_t(z / fl)); }
|
||||
#else
|
||||
decltype(auto) operator*(float fl) const { return Vector(x * fl, y * fl, z * fl); }
|
||||
decltype(auto) operator/(float fl) const { return Vector(x / fl, y / fl, z / fl); }
|
||||
#endif
|
||||
|
||||
decltype(auto) operator=(std::nullptr_t) { return Vector(0, 0, 0); }
|
||||
decltype(auto) operator+=(float fl) { return (*this = *this + fl); }
|
||||
decltype(auto) operator-=(float fl) { return (*this = *this - fl); }
|
||||
decltype(auto) operator*=(float fl) { return (*this = *this * fl); }
|
||||
decltype(auto) operator/=(float fl) { return (*this = *this / fl); }
|
||||
|
||||
// Methods
|
||||
void Clear()
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
void CopyToArray(float *rgfl) const
|
||||
{
|
||||
*(int *)&rgfl[0] = *(int *)&x;
|
||||
*(int *)&rgfl[1] = *(int *)&y;
|
||||
*(int *)&rgfl[2] = *(int *)&z;
|
||||
}
|
||||
|
||||
// Get the vector's magnitude
|
||||
real_t Length() const
|
||||
{
|
||||
real_t x1 = real_t(x);
|
||||
real_t y1 = real_t(y);
|
||||
real_t z1 = real_t(z);
|
||||
|
||||
return Q_sqrt(x1 * x1 + y1 * y1 + z1 * z1);
|
||||
}
|
||||
|
||||
// Get the vector's magnitude squared
|
||||
real_t LengthSquared() const { return (x * x + y * y + z * z); }
|
||||
|
||||
operator float*() { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
operator const float*() const { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
|
||||
#ifndef PLAY_GAMEDLL
|
||||
Vector Normalize() const
|
||||
{
|
||||
float flLen = Length();
|
||||
if (flLen == 0)
|
||||
return Vector(0, 0, 1);
|
||||
|
||||
flLen = 1 / flLen;
|
||||
return Vector(x * flLen, y * flLen, z * flLen);
|
||||
}
|
||||
#else
|
||||
Vector Normalize()
|
||||
{
|
||||
real_t flLen = Length();
|
||||
if (flLen == 0)
|
||||
return Vector(0, 0, 1);
|
||||
|
||||
vec_t fTemp = vec_t(1 / flLen);
|
||||
return Vector(x * fTemp, y * fTemp, z * fTemp);
|
||||
}
|
||||
#endif // PLAY_GAMEDLL
|
||||
// for out precision normalize
|
||||
Vector NormalizePrecision() const
|
||||
{
|
||||
#ifndef PLAY_GAMEDLL
|
||||
return Normalize();
|
||||
#else
|
||||
real_t flLen = Length();
|
||||
if (flLen == 0)
|
||||
return Vector(0, 0, 1);
|
||||
|
||||
flLen = 1 / flLen;
|
||||
return Vector(vec_t(x * flLen), vec_t(y * flLen), vec_t(z * flLen));
|
||||
#endif // PLAY_GAMEDLL
|
||||
}
|
||||
Vector2D Make2D() const
|
||||
{
|
||||
Vector2D Vec2;
|
||||
*(int *)&Vec2.x = *(int *)&x;
|
||||
*(int *)&Vec2.y = *(int *)&y;
|
||||
return Vec2;
|
||||
}
|
||||
|
||||
real_t Length2D() const { return Q_sqrt(real_t(x * x + y * y)); }
|
||||
|
||||
inline bool IsLengthLessThan (float length) const { return (LengthSquared() < length * length); }
|
||||
inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); }
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
template<typename T = real_t>
|
||||
real_t NormalizeInPlace()
|
||||
{
|
||||
T flLen = Length();
|
||||
|
||||
if (flLen > 0)
|
||||
{
|
||||
x = vec_t(1 / flLen * x);
|
||||
y = vec_t(1 / flLen * y);
|
||||
z = vec_t(1 / flLen * z);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 1;
|
||||
}
|
||||
|
||||
return flLen;
|
||||
}
|
||||
#else // PLAY_GAMEDLL
|
||||
float NormalizeInPlace()
|
||||
{
|
||||
float flLen = Length();
|
||||
if (flLen > 0)
|
||||
{
|
||||
x /= flLen;
|
||||
y /= flLen;
|
||||
z /= flLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 1;
|
||||
}
|
||||
return flLen;
|
||||
}
|
||||
#endif // PLAY_GAMEDLL
|
||||
bool IsZero(float tolerance = 0.01f) const
|
||||
{
|
||||
return (x > -tolerance && x < tolerance &&
|
||||
y > -tolerance && y < tolerance &&
|
||||
z > -tolerance && z < tolerance);
|
||||
}
|
||||
|
||||
// Members
|
||||
vec_t x, y, z;
|
||||
};
|
||||
|
||||
inline Vector operator*(float fl, const Vector &v)
|
||||
{
|
||||
return v * fl;
|
||||
}
|
||||
|
||||
inline real_t DotProduct(const Vector &a, const Vector &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y + a.z * b.z);
|
||||
}
|
||||
|
||||
inline real_t DotProduct2D(const Vector &a, const Vector &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y);
|
||||
}
|
||||
|
||||
inline Vector CrossProduct(const Vector &a, const Vector &b)
|
||||
{
|
||||
return Vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
|
||||
}
|
||||
|
||||
template<
|
||||
typename X,
|
||||
typename Y,
|
||||
typename Z,
|
||||
typename LenType
|
||||
>
|
||||
inline LenType LengthSubtract(Vector vecStart, Vector vecDest)
|
||||
{
|
||||
X floatX = (vecDest.x - vecStart.x);
|
||||
Y floatY = (vecDest.y - vecStart.y);
|
||||
Z floatZ = (vecDest.z - vecStart.z);
|
||||
|
||||
return Q_sqrt(real_t(floatX * floatX + floatY * floatY + floatZ * floatZ));
|
||||
}
|
||||
|
||||
template<
|
||||
typename X,
|
||||
typename Y,
|
||||
typename Z,
|
||||
typename LenType
|
||||
>
|
||||
inline Vector NormalizeSubtract(Vector vecStart, Vector vecDest)
|
||||
{
|
||||
Vector dir;
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
|
||||
X floatX = (vecDest.x - vecStart.x);
|
||||
Y floatY = (vecDest.y - vecStart.y);
|
||||
Z floatZ = (vecDest.z - vecStart.z);
|
||||
|
||||
LenType flLen = Q_sqrt(real_t(floatX * floatX + floatY * floatY + floatZ * floatZ));
|
||||
|
||||
if (flLen == 0.0)
|
||||
{
|
||||
dir = Vector(0, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
flLen = 1.0 / flLen;
|
||||
|
||||
dir.x = vec_t(floatX * flLen);
|
||||
dir.y = vec_t(floatY * flLen);
|
||||
dir.z = vec_t(floatZ * flLen);
|
||||
}
|
||||
#else
|
||||
dir = (vecDest - vecStart).Normalize();
|
||||
#endif // PLAY_GAMEDLL
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
template<typename X, typename Y, typename LenType>
|
||||
inline Vector NormalizeMulScalar(Vector2D vec, float scalar)
|
||||
{
|
||||
LenType flLen;
|
||||
X floatX;
|
||||
Y floatY;
|
||||
|
||||
flLen = (LenType)vec.Length();
|
||||
|
||||
if (flLen <= 0.0)
|
||||
{
|
||||
floatX = 1;
|
||||
floatY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
flLen = 1 / flLen;
|
||||
|
||||
floatX = vec.x * flLen;
|
||||
floatY = vec.y * flLen;
|
||||
}
|
||||
|
||||
return Vector(vec_t(floatX * scalar), vec_t(floatY * scalar), 0);
|
||||
}
|
||||
template<typename X, typename Y, typename LenType, typename LenCast>
|
||||
inline Vector NormalizeMulScalar(Vector vec, float scalar)
|
||||
{
|
||||
LenType flLen;
|
||||
X floatX = vec.x;
|
||||
Y floatY = vec.y;
|
||||
|
||||
flLen = (LenType)vec.Length();
|
||||
|
||||
if (flLen <= 0.0)
|
||||
{
|
||||
floatX = 1;
|
||||
floatY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
floatX = floatX * LenCast(1 / flLen);
|
||||
floatY = floatY * LenCast(1 / flLen);
|
||||
}
|
||||
|
||||
return Vector(vec_t(floatX * scalar), vec_t(floatY * scalar), 0);
|
||||
}
|
||||
#endif // PLAY_GAMEDLL
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
// Used for many pathfinding and many other operations that are treated as planar rather than 3D.
|
||||
class Vector2D
|
||||
{
|
||||
public:
|
||||
// Construction/destruction
|
||||
Vector2D() : x(), y() {}
|
||||
Vector2D(float X, float Y) : x(X), y(Y) {}
|
||||
Vector2D(const Vector2D &v) { *(int *)&x = *(int *)&v.x; *(int *)&y = *(int *)&v.y; }
|
||||
|
||||
// Operators
|
||||
decltype(auto) operator-() const { return Vector2D(-x, -y); }
|
||||
bool operator==(const Vector2D &v) const { return x == v.x && y == v.y; }
|
||||
bool operator!=(const Vector2D &v) const { return !(*this == v); }
|
||||
|
||||
decltype(auto) operator+(const Vector2D &v) const { return Vector2D(x + v.x, y + v.y); }
|
||||
decltype(auto) operator-(const Vector2D &v) const { return Vector2D(x - v.x, y - v.y); }
|
||||
decltype(auto) operator*(const Vector2D &v) const { return Vector2D(x * v.x, y * v.y); }
|
||||
decltype(auto) operator/(const Vector2D &v) const { return Vector2D(x / v.x, y / v.y); }
|
||||
|
||||
decltype(auto) operator+=(const Vector2D &v) { return (*this = *this + v); }
|
||||
decltype(auto) operator-=(const Vector2D &v) { return (*this = *this - v); }
|
||||
decltype(auto) operator*=(const Vector2D &v) { return (*this = *this * v); }
|
||||
decltype(auto) operator/=(const Vector2D &v) { return (*this = *this / v); }
|
||||
|
||||
decltype(auto) operator+(float fl) const { return Vector2D(x + fl, y + fl); }
|
||||
decltype(auto) operator-(float fl) const { return Vector2D(x - fl, y - fl); }
|
||||
|
||||
// TODO: FIX ME!!
|
||||
#ifdef PLAY_GAMEDLL
|
||||
decltype(auto) operator*(float fl) const { return Vector2D(vec_t(x * fl), vec_t(y * fl)); }
|
||||
decltype(auto) operator/(float fl) const { return Vector2D(vec_t(x / fl), vec_t(y / fl)); }
|
||||
#else
|
||||
decltype(auto) operator*(float fl) const { return Vector2D(x * fl, y * fl); }
|
||||
decltype(auto) operator/(float fl) const { return Vector2D(x / fl, y / fl); }
|
||||
#endif
|
||||
|
||||
decltype(auto) operator=(std::nullptr_t) { return Vector2D(0, 0); }
|
||||
decltype(auto) operator+=(float fl) { return (*this = *this + fl); }
|
||||
decltype(auto) operator-=(float fl) { return (*this = *this - fl); }
|
||||
decltype(auto) operator*=(float fl) { return (*this = *this * fl); }
|
||||
decltype(auto) operator/=(float fl) { return (*this = *this / fl); }
|
||||
|
||||
// Methods
|
||||
inline void Clear() { x = 0; y = 0; }
|
||||
inline void CopyToArray(float *rgfl) const { *(int *)&rgfl[0] = *(int *)&x; *(int *)&rgfl[1] = *(int *)&y; }
|
||||
inline real_t Length() const { return Q_sqrt(real_t(x * x + y * y)); } // Get the vector's magnitude
|
||||
inline float LengthSquared() const { return (x * x + y * y); } // Get the vector's magnitude squared
|
||||
|
||||
operator float*() { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
operator const float*() const { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
|
||||
Vector2D Normalize() const
|
||||
{
|
||||
real_t flLen = Length();
|
||||
if (!flLen)
|
||||
return Vector2D(0, 0);
|
||||
|
||||
flLen = 1 / flLen;
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
return Vector2D(vec_t(x * flLen), vec_t(y * flLen));
|
||||
#else
|
||||
return Vector2D(x * flLen, y * flLen);
|
||||
#endif // PLAY_GAMEDLL
|
||||
}
|
||||
inline bool IsLengthLessThan (float length) const { return (LengthSquared() < length * length); }
|
||||
inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); }
|
||||
real_t NormalizeInPlace()
|
||||
{
|
||||
real_t flLen = Length();
|
||||
if (flLen > 0.0)
|
||||
{
|
||||
x = vec_t(1 / flLen * x);
|
||||
y = vec_t(1 / flLen * y);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 1.0;
|
||||
y = 0.0;
|
||||
}
|
||||
return flLen;
|
||||
}
|
||||
bool IsZero(float tolerance = 0.01f) const
|
||||
{
|
||||
return (x > -tolerance && x < tolerance &&
|
||||
y > -tolerance && y < tolerance);
|
||||
}
|
||||
|
||||
// Members
|
||||
vec_t x, y;
|
||||
};
|
||||
|
||||
inline real_t DotProduct(const Vector2D &a, const Vector2D &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y);
|
||||
}
|
||||
|
||||
inline Vector2D operator*(float fl, const Vector2D &v)
|
||||
{
|
||||
return v * fl;
|
||||
}
|
||||
|
||||
// 3D Vector
|
||||
// Same data-layout as engine's vec3_t, which is a vec_t[3]
|
||||
class Vector
|
||||
{
|
||||
public:
|
||||
// Construction/destruction
|
||||
Vector() : x(), y(), z() {}
|
||||
Vector(float X, float Y, float Z) : x(X), y(Y), z(Z) {}
|
||||
Vector(const Vector &v) { *(int *)&x = *(int *)&v.x; *(int *)&y = *(int *)&v.y; *(int *)&z = *(int *)&v.z; }
|
||||
Vector(const float rgfl[3]) { *(int *)&x = *(int *)&rgfl[0]; *(int *)&y = *(int *)&rgfl[1]; *(int *)&z = *(int *)&rgfl[2]; }
|
||||
|
||||
// Operators
|
||||
decltype(auto) operator-() const { return Vector(-x, -y, -z); }
|
||||
bool operator==(const Vector &v) const { return x == v.x && y == v.y && z == v.z; }
|
||||
bool operator!=(const Vector &v) const { return !(*this == v); }
|
||||
|
||||
decltype(auto) operator+(const Vector &v) const { return Vector(x + v.x, y + v.y, z + v.z); }
|
||||
decltype(auto) operator-(const Vector &v) const { return Vector(x - v.x, y - v.y, z - v.z); }
|
||||
decltype(auto) operator*(const Vector &v) const { return Vector(x * v.x, y * v.y, z * v.z); }
|
||||
decltype(auto) operator/(const Vector &v) const { return Vector(x / v.x, y / v.y, z / v.z); }
|
||||
|
||||
decltype(auto) operator+=(const Vector &v) { return (*this = *this + v); }
|
||||
decltype(auto) operator-=(const Vector &v) { return (*this = *this - v); }
|
||||
decltype(auto) operator*=(const Vector &v) { return (*this = *this * v); }
|
||||
decltype(auto) operator/=(const Vector &v) { return (*this = *this / v); }
|
||||
|
||||
decltype(auto) operator+(float fl) const { return Vector(x + fl, y + fl, z + fl); }
|
||||
decltype(auto) operator-(float fl) const { return Vector(x - fl, y - fl, z - fl); }
|
||||
|
||||
// TODO: FIX ME!!
|
||||
#ifdef PLAY_GAMEDLL
|
||||
decltype(auto) operator*(float fl) const { return Vector(vec_t(x * fl), vec_t(y * fl), vec_t(z * fl)); }
|
||||
decltype(auto) operator/(float fl) const { return Vector(vec_t(x / fl), vec_t(y / fl), vec_t(z / fl)); }
|
||||
#else
|
||||
decltype(auto) operator*(float fl) const { return Vector(x * fl, y * fl, z * fl); }
|
||||
decltype(auto) operator/(float fl) const { return Vector(x / fl, y / fl, z / fl); }
|
||||
#endif
|
||||
|
||||
decltype(auto) operator=(std::nullptr_t) { return Vector(0, 0, 0); }
|
||||
decltype(auto) operator+=(float fl) { return (*this = *this + fl); }
|
||||
decltype(auto) operator-=(float fl) { return (*this = *this - fl); }
|
||||
decltype(auto) operator*=(float fl) { return (*this = *this * fl); }
|
||||
decltype(auto) operator/=(float fl) { return (*this = *this / fl); }
|
||||
|
||||
// Methods
|
||||
void Clear()
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
void CopyToArray(float *rgfl) const
|
||||
{
|
||||
*(int *)&rgfl[0] = *(int *)&x;
|
||||
*(int *)&rgfl[1] = *(int *)&y;
|
||||
*(int *)&rgfl[2] = *(int *)&z;
|
||||
}
|
||||
|
||||
// Get the vector's magnitude
|
||||
real_t Length() const
|
||||
{
|
||||
real_t x1 = real_t(x);
|
||||
real_t y1 = real_t(y);
|
||||
real_t z1 = real_t(z);
|
||||
|
||||
return Q_sqrt(x1 * x1 + y1 * y1 + z1 * z1);
|
||||
}
|
||||
|
||||
// Get the vector's magnitude squared
|
||||
real_t LengthSquared() const { return (x * x + y * y + z * z); }
|
||||
|
||||
operator float*() { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
operator const float*() const { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
|
||||
#ifndef PLAY_GAMEDLL
|
||||
Vector Normalize() const
|
||||
{
|
||||
float flLen = Length();
|
||||
if (flLen == 0)
|
||||
return Vector(0, 0, 1);
|
||||
|
||||
flLen = 1 / flLen;
|
||||
return Vector(x * flLen, y * flLen, z * flLen);
|
||||
}
|
||||
#else
|
||||
Vector Normalize()
|
||||
{
|
||||
real_t flLen = Length();
|
||||
if (flLen == 0)
|
||||
return Vector(0, 0, 1);
|
||||
|
||||
vec_t fTemp = vec_t(1 / flLen);
|
||||
return Vector(x * fTemp, y * fTemp, z * fTemp);
|
||||
}
|
||||
#endif // PLAY_GAMEDLL
|
||||
// for out precision normalize
|
||||
Vector NormalizePrecision() const
|
||||
{
|
||||
#ifndef PLAY_GAMEDLL
|
||||
return Normalize();
|
||||
#else
|
||||
real_t flLen = Length();
|
||||
if (flLen == 0)
|
||||
return Vector(0, 0, 1);
|
||||
|
||||
flLen = 1 / flLen;
|
||||
return Vector(vec_t(x * flLen), vec_t(y * flLen), vec_t(z * flLen));
|
||||
#endif // PLAY_GAMEDLL
|
||||
}
|
||||
Vector2D Make2D() const
|
||||
{
|
||||
Vector2D Vec2;
|
||||
*(int *)&Vec2.x = *(int *)&x;
|
||||
*(int *)&Vec2.y = *(int *)&y;
|
||||
return Vec2;
|
||||
}
|
||||
|
||||
real_t Length2D() const { return Q_sqrt(real_t(x * x + y * y)); }
|
||||
|
||||
inline bool IsLengthLessThan (float length) const { return (LengthSquared() < length * length); }
|
||||
inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); }
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
template<typename T = real_t>
|
||||
real_t NormalizeInPlace()
|
||||
{
|
||||
T flLen = Length();
|
||||
|
||||
if (flLen > 0)
|
||||
{
|
||||
x = vec_t(1 / flLen * x);
|
||||
y = vec_t(1 / flLen * y);
|
||||
z = vec_t(1 / flLen * z);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 1;
|
||||
}
|
||||
|
||||
return flLen;
|
||||
}
|
||||
#else // PLAY_GAMEDLL
|
||||
float NormalizeInPlace()
|
||||
{
|
||||
float flLen = Length();
|
||||
if (flLen > 0)
|
||||
{
|
||||
x /= flLen;
|
||||
y /= flLen;
|
||||
z /= flLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 1;
|
||||
}
|
||||
return flLen;
|
||||
}
|
||||
#endif // PLAY_GAMEDLL
|
||||
bool IsZero(float tolerance = 0.01f) const
|
||||
{
|
||||
return (x > -tolerance && x < tolerance &&
|
||||
y > -tolerance && y < tolerance &&
|
||||
z > -tolerance && z < tolerance);
|
||||
}
|
||||
|
||||
// Members
|
||||
vec_t x, y, z;
|
||||
};
|
||||
|
||||
inline Vector operator*(float fl, const Vector &v)
|
||||
{
|
||||
return v * fl;
|
||||
}
|
||||
|
||||
inline real_t DotProduct(const Vector &a, const Vector &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y + a.z * b.z);
|
||||
}
|
||||
|
||||
inline real_t DotProduct2D(const Vector &a, const Vector &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y);
|
||||
}
|
||||
|
||||
inline Vector CrossProduct(const Vector &a, const Vector &b)
|
||||
{
|
||||
return Vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
|
||||
}
|
||||
|
||||
template<
|
||||
typename X,
|
||||
typename Y,
|
||||
typename Z,
|
||||
typename LenType
|
||||
>
|
||||
inline LenType LengthSubtract(Vector vecStart, Vector vecDest)
|
||||
{
|
||||
X floatX = (vecDest.x - vecStart.x);
|
||||
Y floatY = (vecDest.y - vecStart.y);
|
||||
Z floatZ = (vecDest.z - vecStart.z);
|
||||
|
||||
return Q_sqrt(real_t(floatX * floatX + floatY * floatY + floatZ * floatZ));
|
||||
}
|
||||
|
||||
template<
|
||||
typename X,
|
||||
typename Y,
|
||||
typename Z,
|
||||
typename LenType
|
||||
>
|
||||
inline Vector NormalizeSubtract(Vector vecStart, Vector vecDest)
|
||||
{
|
||||
Vector dir;
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
|
||||
X floatX = (vecDest.x - vecStart.x);
|
||||
Y floatY = (vecDest.y - vecStart.y);
|
||||
Z floatZ = (vecDest.z - vecStart.z);
|
||||
|
||||
LenType flLen = Q_sqrt(real_t(floatX * floatX + floatY * floatY + floatZ * floatZ));
|
||||
|
||||
if (flLen == 0.0)
|
||||
{
|
||||
dir = Vector(0, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
flLen = 1.0 / flLen;
|
||||
|
||||
dir.x = vec_t(floatX * flLen);
|
||||
dir.y = vec_t(floatY * flLen);
|
||||
dir.z = vec_t(floatZ * flLen);
|
||||
}
|
||||
#else
|
||||
dir = (vecDest - vecStart).Normalize();
|
||||
#endif // PLAY_GAMEDLL
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
template<typename X, typename Y, typename LenType>
|
||||
inline Vector NormalizeMulScalar(Vector2D vec, float scalar)
|
||||
{
|
||||
LenType flLen;
|
||||
X floatX;
|
||||
Y floatY;
|
||||
|
||||
flLen = (LenType)vec.Length();
|
||||
|
||||
if (flLen <= 0.0)
|
||||
{
|
||||
floatX = 1;
|
||||
floatY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
flLen = 1 / flLen;
|
||||
|
||||
floatX = vec.x * flLen;
|
||||
floatY = vec.y * flLen;
|
||||
}
|
||||
|
||||
return Vector(vec_t(floatX * scalar), vec_t(floatY * scalar), 0);
|
||||
}
|
||||
template<typename X, typename Y, typename LenType, typename LenCast>
|
||||
inline Vector NormalizeMulScalar(Vector vec, float scalar)
|
||||
{
|
||||
LenType flLen;
|
||||
X floatX = vec.x;
|
||||
Y floatY = vec.y;
|
||||
|
||||
flLen = (LenType)vec.Length();
|
||||
|
||||
if (flLen <= 0.0)
|
||||
{
|
||||
floatX = 1;
|
||||
floatY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
floatX = floatX * LenCast(1 / flLen);
|
||||
floatY = floatY * LenCast(1 / flLen);
|
||||
}
|
||||
|
||||
return Vector(vec_t(floatX * scalar), vec_t(floatY * scalar), 0);
|
||||
}
|
||||
#endif // PLAY_GAMEDLL
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,464 +1,464 @@
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
enum WeaponIdType
|
||||
{
|
||||
WEAPON_NONE,
|
||||
WEAPON_P228,
|
||||
WEAPON_GLOCK,
|
||||
WEAPON_SCOUT,
|
||||
WEAPON_HEGRENADE,
|
||||
WEAPON_XM1014,
|
||||
WEAPON_C4,
|
||||
WEAPON_MAC10,
|
||||
WEAPON_AUG,
|
||||
WEAPON_SMOKEGRENADE,
|
||||
WEAPON_ELITE,
|
||||
WEAPON_FIVESEVEN,
|
||||
WEAPON_UMP45,
|
||||
WEAPON_SG550,
|
||||
WEAPON_GALIL,
|
||||
WEAPON_FAMAS,
|
||||
WEAPON_USP,
|
||||
WEAPON_GLOCK18,
|
||||
WEAPON_AWP,
|
||||
WEAPON_MP5N,
|
||||
WEAPON_M249,
|
||||
WEAPON_M3,
|
||||
WEAPON_M4A1,
|
||||
WEAPON_TMP,
|
||||
WEAPON_G3SG1,
|
||||
WEAPON_FLASHBANG,
|
||||
WEAPON_DEAGLE,
|
||||
WEAPON_SG552,
|
||||
WEAPON_AK47,
|
||||
WEAPON_KNIFE,
|
||||
WEAPON_P90,
|
||||
WEAPON_SHIELDGUN = 99
|
||||
};
|
||||
|
||||
enum AutoBuyClassType
|
||||
{
|
||||
AUTOBUYCLASS_NONE = 0,
|
||||
AUTOBUYCLASS_PRIMARY = BIT(0),
|
||||
AUTOBUYCLASS_SECONDARY = BIT(1),
|
||||
AUTOBUYCLASS_AMMO = BIT(2),
|
||||
AUTOBUYCLASS_ARMOR = BIT(3),
|
||||
AUTOBUYCLASS_DEFUSER = BIT(4),
|
||||
AUTOBUYCLASS_PISTOL = BIT(5),
|
||||
AUTOBUYCLASS_SMG = BIT(6),
|
||||
AUTOBUYCLASS_RIFLE = BIT(7),
|
||||
AUTOBUYCLASS_SNIPERRIFLE = BIT(8),
|
||||
AUTOBUYCLASS_SHOTGUN = BIT(9),
|
||||
AUTOBUYCLASS_MACHINEGUN = BIT(10),
|
||||
AUTOBUYCLASS_GRENADE = BIT(11),
|
||||
AUTOBUYCLASS_NIGHTVISION = BIT(12),
|
||||
AUTOBUYCLASS_SHIELD = BIT(13),
|
||||
};
|
||||
|
||||
enum ItemCostType
|
||||
{
|
||||
ASSAULTSUIT_PRICE = 1000,
|
||||
FLASHBANG_PRICE = 200,
|
||||
HEGRENADE_PRICE = 300,
|
||||
SMOKEGRENADE_PRICE = 300,
|
||||
KEVLAR_PRICE = 650,
|
||||
HELMET_PRICE = 350,
|
||||
NVG_PRICE = 1250,
|
||||
DEFUSEKIT_PRICE = 200,
|
||||
};
|
||||
|
||||
enum AmmoCostType
|
||||
{
|
||||
AMMO_338MAG_PRICE = 125,
|
||||
AMMO_357SIG_PRICE = 50,
|
||||
AMMO_45ACP_PRICE = 25,
|
||||
AMMO_50AE_PRICE = 40,
|
||||
AMMO_556MM_PRICE = 60,
|
||||
AMMO_57MM_PRICE = 50,
|
||||
AMMO_762MM_PRICE = 80,
|
||||
AMMO_9MM_PRICE = 20,
|
||||
AMMO_BUCKSHOT_PRICE = 65,
|
||||
AMMO_FLASHBANG_PRICE = FLASHBANG_PRICE,
|
||||
AMMO_HEGRENADE_PRICE = HEGRENADE_PRICE,
|
||||
AMMO_SMOKEGRENADE_PRICE = SMOKEGRENADE_PRICE,
|
||||
};
|
||||
|
||||
enum WeaponCostType
|
||||
{
|
||||
AK47_PRICE = 2500,
|
||||
AWP_PRICE = 4750,
|
||||
DEAGLE_PRICE = 650,
|
||||
G3SG1_PRICE = 5000,
|
||||
SG550_PRICE = 4200,
|
||||
GLOCK18_PRICE = 400,
|
||||
M249_PRICE = 5750,
|
||||
M3_PRICE = 1700,
|
||||
M4A1_PRICE = 3100,
|
||||
AUG_PRICE = 3500,
|
||||
MP5NAVY_PRICE = 1500,
|
||||
P228_PRICE = 600,
|
||||
P90_PRICE = 2350,
|
||||
UMP45_PRICE = 1700,
|
||||
MAC10_PRICE = 1400,
|
||||
SCOUT_PRICE = 2750,
|
||||
SG552_PRICE = 3500,
|
||||
TMP_PRICE = 1250,
|
||||
USP_PRICE = 500,
|
||||
ELITE_PRICE = 800,
|
||||
FIVESEVEN_PRICE = 750,
|
||||
XM1014_PRICE = 3000,
|
||||
GALIL_PRICE = 2000,
|
||||
FAMAS_PRICE = 2250,
|
||||
SHIELDGUN_PRICE = 2200,
|
||||
};
|
||||
|
||||
enum WeaponState
|
||||
{
|
||||
WPNSTATE_USP_SILENCED = BIT(0),
|
||||
WPNSTATE_GLOCK18_BURST_MODE = BIT(1),
|
||||
WPNSTATE_M4A1_SILENCED = BIT(2),
|
||||
WPNSTATE_ELITE_LEFT = BIT(3),
|
||||
WPNSTATE_FAMAS_BURST_MODE = BIT(4),
|
||||
WPNSTATE_SHIELD_DRAWN = BIT(5),
|
||||
};
|
||||
|
||||
// custom enum
|
||||
// the default amount of ammo that comes with each gun when it spawns
|
||||
enum ClipGiveDefault
|
||||
{
|
||||
P228_DEFAULT_GIVE = 13,
|
||||
GLOCK18_DEFAULT_GIVE = 20,
|
||||
SCOUT_DEFAULT_GIVE = 10,
|
||||
HEGRENADE_DEFAULT_GIVE = 1,
|
||||
XM1014_DEFAULT_GIVE = 7,
|
||||
C4_DEFAULT_GIVE = 1,
|
||||
MAC10_DEFAULT_GIVE = 30,
|
||||
AUG_DEFAULT_GIVE = 30,
|
||||
SMOKEGRENADE_DEFAULT_GIVE = 1,
|
||||
ELITE_DEFAULT_GIVE = 30,
|
||||
FIVESEVEN_DEFAULT_GIVE = 20,
|
||||
UMP45_DEFAULT_GIVE = 25,
|
||||
SG550_DEFAULT_GIVE = 30,
|
||||
GALIL_DEFAULT_GIVE = 35,
|
||||
FAMAS_DEFAULT_GIVE = 25,
|
||||
USP_DEFAULT_GIVE = 12,
|
||||
AWP_DEFAULT_GIVE = 10,
|
||||
MP5NAVY_DEFAULT_GIVE = 30,
|
||||
M249_DEFAULT_GIVE = 100,
|
||||
M3_DEFAULT_GIVE = 8,
|
||||
M4A1_DEFAULT_GIVE = 30,
|
||||
TMP_DEFAULT_GIVE = 30,
|
||||
G3SG1_DEFAULT_GIVE = 20,
|
||||
FLASHBANG_DEFAULT_GIVE = 1,
|
||||
DEAGLE_DEFAULT_GIVE = 7,
|
||||
SG552_DEFAULT_GIVE = 30,
|
||||
AK47_DEFAULT_GIVE = 30,
|
||||
//KNIFE_DEFAULT_GIVE = 1,
|
||||
P90_DEFAULT_GIVE = 50,
|
||||
};
|
||||
|
||||
enum ClipSizeType
|
||||
{
|
||||
P228_MAX_CLIP = 13,
|
||||
GLOCK18_MAX_CLIP = 20,
|
||||
SCOUT_MAX_CLIP = 10,
|
||||
XM1014_MAX_CLIP = 7,
|
||||
MAC10_MAX_CLIP = 30,
|
||||
AUG_MAX_CLIP = 30,
|
||||
ELITE_MAX_CLIP = 30,
|
||||
FIVESEVEN_MAX_CLIP = 20,
|
||||
UMP45_MAX_CLIP = 25,
|
||||
SG550_MAX_CLIP = 30,
|
||||
GALIL_MAX_CLIP = 35,
|
||||
FAMAS_MAX_CLIP = 25,
|
||||
USP_MAX_CLIP = 12,
|
||||
AWP_MAX_CLIP = 10,
|
||||
MP5N_MAX_CLIP = 30,
|
||||
M249_MAX_CLIP = 100,
|
||||
M3_MAX_CLIP = 8,
|
||||
M4A1_MAX_CLIP = 30,
|
||||
TMP_MAX_CLIP = 30,
|
||||
G3SG1_MAX_CLIP = 20,
|
||||
DEAGLE_MAX_CLIP = 7,
|
||||
SG552_MAX_CLIP = 30,
|
||||
AK47_MAX_CLIP = 30,
|
||||
P90_MAX_CLIP = 50,
|
||||
};
|
||||
|
||||
enum WeightWeapon
|
||||
{
|
||||
P228_WEIGHT = 5,
|
||||
GLOCK18_WEIGHT = 5,
|
||||
SCOUT_WEIGHT = 30,
|
||||
HEGRENADE_WEIGHT = 2,
|
||||
XM1014_WEIGHT = 20,
|
||||
C4_WEIGHT = 3,
|
||||
MAC10_WEIGHT = 25,
|
||||
AUG_WEIGHT = 25,
|
||||
SMOKEGRENADE_WEIGHT = 1,
|
||||
ELITE_WEIGHT = 5,
|
||||
FIVESEVEN_WEIGHT = 5,
|
||||
UMP45_WEIGHT = 25,
|
||||
SG550_WEIGHT = 20,
|
||||
GALIL_WEIGHT = 25,
|
||||
FAMAS_WEIGHT = 75,
|
||||
USP_WEIGHT = 5,
|
||||
AWP_WEIGHT = 30,
|
||||
MP5NAVY_WEIGHT = 25,
|
||||
M249_WEIGHT = 25,
|
||||
M3_WEIGHT = 20,
|
||||
M4A1_WEIGHT = 25,
|
||||
TMP_WEIGHT = 25,
|
||||
G3SG1_WEIGHT = 20,
|
||||
FLASHBANG_WEIGHT = 1,
|
||||
DEAGLE_WEIGHT = 7,
|
||||
SG552_WEIGHT = 25,
|
||||
AK47_WEIGHT = 25,
|
||||
P90_WEIGHT = 26,
|
||||
KNIFE_WEIGHT = 0,
|
||||
};
|
||||
|
||||
enum MaxAmmoType
|
||||
{
|
||||
MAX_AMMO_BUCKSHOT = 32,
|
||||
MAX_AMMO_9MM = 120,
|
||||
MAX_AMMO_556NATO = 90,
|
||||
MAX_AMMO_556NATOBOX = 200,
|
||||
MAX_AMMO_762NATO = 90,
|
||||
MAX_AMMO_45ACP = 100,
|
||||
MAX_AMMO_50AE = 35,
|
||||
MAX_AMMO_338MAGNUM = 30,
|
||||
MAX_AMMO_57MM = 100,
|
||||
MAX_AMMO_357SIG = 52,
|
||||
|
||||
// custom
|
||||
MAX_AMMO_SMOKEGRENADE = 1,
|
||||
MAX_AMMO_HEGRENADE = 1,
|
||||
MAX_AMMO_FLASHBANG = 2,
|
||||
};
|
||||
|
||||
enum AmmoType
|
||||
{
|
||||
AMMO_NONE,
|
||||
AMMO_338MAGNUM,
|
||||
AMMO_762NATO,
|
||||
AMMO_556NATOBOX,
|
||||
AMMO_556NATO,
|
||||
AMMO_BUCKSHOT,
|
||||
AMMO_45ACP,
|
||||
AMMO_57MM,
|
||||
AMMO_50AE,
|
||||
AMMO_357SIG,
|
||||
AMMO_9MM,
|
||||
AMMO_FLASHBANG,
|
||||
AMMO_HEGRENADE,
|
||||
AMMO_SMOKEGRENADE,
|
||||
AMMO_C4,
|
||||
|
||||
AMMO_MAX_TYPES
|
||||
};
|
||||
|
||||
enum WeaponClassType
|
||||
{
|
||||
WEAPONCLASS_NONE,
|
||||
WEAPONCLASS_KNIFE,
|
||||
WEAPONCLASS_PISTOL,
|
||||
WEAPONCLASS_GRENADE,
|
||||
WEAPONCLASS_SUBMACHINEGUN,
|
||||
WEAPONCLASS_SHOTGUN,
|
||||
WEAPONCLASS_MACHINEGUN,
|
||||
WEAPONCLASS_RIFLE,
|
||||
WEAPONCLASS_SNIPERRIFLE,
|
||||
WEAPONCLASS_MAX,
|
||||
};
|
||||
|
||||
enum AmmoBuyAmount
|
||||
{
|
||||
AMMO_338MAG_BUY = 10,
|
||||
AMMO_357SIG_BUY = 13,
|
||||
AMMO_45ACP_BUY = 12,
|
||||
AMMO_50AE_BUY = 7,
|
||||
AMMO_556NATO_BUY = 30,
|
||||
AMMO_556NATOBOX_BUY = 30,
|
||||
AMMO_57MM_BUY = 50,
|
||||
AMMO_762NATO_BUY = 30,
|
||||
AMMO_9MM_BUY = 30,
|
||||
AMMO_BUCKSHOT_BUY = 8,
|
||||
AMMO_FLASHBANG_BUY = 1,
|
||||
AMMO_HEGRENADE_BUY = 1,
|
||||
AMMO_SMOKEGRENADE_BUY = 1,
|
||||
};
|
||||
|
||||
enum shieldgun_e
|
||||
{
|
||||
SHIELDGUN_IDLE,
|
||||
SHIELDGUN_SHOOT1,
|
||||
SHIELDGUN_SHOOT2,
|
||||
SHIELDGUN_SHOOT_EMPTY,
|
||||
SHIELDGUN_RELOAD,
|
||||
SHIELDGUN_DRAW,
|
||||
SHIELDGUN_DRAWN_IDLE,
|
||||
SHIELDGUN_UP,
|
||||
SHIELDGUN_DOWN,
|
||||
};
|
||||
|
||||
// custom
|
||||
enum shieldgren_e
|
||||
{
|
||||
SHIELDREN_IDLE = 4,
|
||||
SHIELDREN_UP,
|
||||
SHIELDREN_DOWN
|
||||
};
|
||||
|
||||
enum InventorySlotType
|
||||
{
|
||||
NONE_SLOT,
|
||||
PRIMARY_WEAPON_SLOT,
|
||||
PISTOL_SLOT,
|
||||
KNIFE_SLOT,
|
||||
GRENADE_SLOT,
|
||||
C4_SLOT,
|
||||
};
|
||||
|
||||
enum Bullet
|
||||
{
|
||||
BULLET_NONE,
|
||||
BULLET_PLAYER_9MM,
|
||||
BULLET_PLAYER_MP5,
|
||||
BULLET_PLAYER_357,
|
||||
BULLET_PLAYER_BUCKSHOT,
|
||||
BULLET_PLAYER_CROWBAR,
|
||||
BULLET_MONSTER_9MM,
|
||||
BULLET_MONSTER_MP5,
|
||||
BULLET_MONSTER_12MM,
|
||||
BULLET_PLAYER_45ACP,
|
||||
BULLET_PLAYER_338MAG,
|
||||
BULLET_PLAYER_762MM,
|
||||
BULLET_PLAYER_556MM,
|
||||
BULLET_PLAYER_50AE,
|
||||
BULLET_PLAYER_57MM,
|
||||
BULLET_PLAYER_357SIG,
|
||||
};
|
||||
|
||||
struct WeaponStruct
|
||||
{
|
||||
int m_type;
|
||||
int m_price;
|
||||
int m_side;
|
||||
int m_slot;
|
||||
int m_ammoPrice;
|
||||
};
|
||||
|
||||
struct AutoBuyInfoStruct
|
||||
{
|
||||
int m_class;
|
||||
char *m_command;
|
||||
char *m_classname;
|
||||
};
|
||||
|
||||
struct WeaponAliasInfo
|
||||
{
|
||||
char *alias;
|
||||
WeaponIdType id;
|
||||
};
|
||||
|
||||
struct WeaponBuyAliasInfo
|
||||
{
|
||||
char *alias;
|
||||
WeaponIdType id;
|
||||
char *failName;
|
||||
};
|
||||
|
||||
struct WeaponClassAliasInfo
|
||||
{
|
||||
char *alias;
|
||||
WeaponClassType id;
|
||||
};
|
||||
|
||||
struct WeaponInfoStruct
|
||||
{
|
||||
int id;
|
||||
int cost;
|
||||
int clipCost;
|
||||
int buyClipSize;
|
||||
int gunClipSize;
|
||||
int maxRounds;
|
||||
AmmoType ammoType;
|
||||
char *entityName;
|
||||
|
||||
// custom
|
||||
const char *ammoName1;
|
||||
const char *ammoName2;
|
||||
};
|
||||
|
||||
struct AmmoInfoStruct
|
||||
{
|
||||
AmmoType ammoType;
|
||||
|
||||
int clipCost;
|
||||
int buyClipSize;
|
||||
int maxRounds;
|
||||
|
||||
const char *ammoName1;
|
||||
const char *ammoName2;
|
||||
};
|
||||
|
||||
struct WeaponSlotInfo
|
||||
{
|
||||
WeaponIdType id;
|
||||
InventorySlotType slot;
|
||||
const char *weaponName;
|
||||
};
|
||||
|
||||
extern AutoBuyInfoStruct g_autoBuyInfo[35];
|
||||
extern WeaponStruct g_weaponStruct[MAX_WEAPONS];
|
||||
|
||||
// WeaponType
|
||||
WeaponIdType AliasToWeaponID(const char *alias);
|
||||
const char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id);
|
||||
const char *WeaponIDToAlias(int id);
|
||||
WeaponClassType AliasToWeaponClass(const char *alias);
|
||||
WeaponClassType WeaponIDToWeaponClass(int id);
|
||||
WeaponClassType WeaponIDToWeaponClass(ArmouryItemPack id);
|
||||
bool IsPrimaryWeapon(int id);
|
||||
bool IsSecondaryWeapon(int id);
|
||||
bool IsGrenadeWeapon(int id);
|
||||
bool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions);
|
||||
void WeaponInfoReset();
|
||||
|
||||
WeaponInfoStruct *GetWeaponInfo(int weaponID);
|
||||
WeaponInfoStruct *GetWeaponInfo(const char *weaponName);
|
||||
|
||||
AmmoInfoStruct *GetAmmoInfo(AmmoType ammoID);
|
||||
AmmoInfoStruct *GetAmmoInfo(const char *ammoName);
|
||||
|
||||
WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID);
|
||||
WeaponSlotInfo *GetWeaponSlot(const char *weaponName);
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
|
||||
enum WeaponIdType
|
||||
{
|
||||
WEAPON_NONE,
|
||||
WEAPON_P228,
|
||||
WEAPON_GLOCK,
|
||||
WEAPON_SCOUT,
|
||||
WEAPON_HEGRENADE,
|
||||
WEAPON_XM1014,
|
||||
WEAPON_C4,
|
||||
WEAPON_MAC10,
|
||||
WEAPON_AUG,
|
||||
WEAPON_SMOKEGRENADE,
|
||||
WEAPON_ELITE,
|
||||
WEAPON_FIVESEVEN,
|
||||
WEAPON_UMP45,
|
||||
WEAPON_SG550,
|
||||
WEAPON_GALIL,
|
||||
WEAPON_FAMAS,
|
||||
WEAPON_USP,
|
||||
WEAPON_GLOCK18,
|
||||
WEAPON_AWP,
|
||||
WEAPON_MP5N,
|
||||
WEAPON_M249,
|
||||
WEAPON_M3,
|
||||
WEAPON_M4A1,
|
||||
WEAPON_TMP,
|
||||
WEAPON_G3SG1,
|
||||
WEAPON_FLASHBANG,
|
||||
WEAPON_DEAGLE,
|
||||
WEAPON_SG552,
|
||||
WEAPON_AK47,
|
||||
WEAPON_KNIFE,
|
||||
WEAPON_P90,
|
||||
WEAPON_SHIELDGUN = 99
|
||||
};
|
||||
|
||||
enum AutoBuyClassType
|
||||
{
|
||||
AUTOBUYCLASS_NONE = 0,
|
||||
AUTOBUYCLASS_PRIMARY = BIT(0),
|
||||
AUTOBUYCLASS_SECONDARY = BIT(1),
|
||||
AUTOBUYCLASS_AMMO = BIT(2),
|
||||
AUTOBUYCLASS_ARMOR = BIT(3),
|
||||
AUTOBUYCLASS_DEFUSER = BIT(4),
|
||||
AUTOBUYCLASS_PISTOL = BIT(5),
|
||||
AUTOBUYCLASS_SMG = BIT(6),
|
||||
AUTOBUYCLASS_RIFLE = BIT(7),
|
||||
AUTOBUYCLASS_SNIPERRIFLE = BIT(8),
|
||||
AUTOBUYCLASS_SHOTGUN = BIT(9),
|
||||
AUTOBUYCLASS_MACHINEGUN = BIT(10),
|
||||
AUTOBUYCLASS_GRENADE = BIT(11),
|
||||
AUTOBUYCLASS_NIGHTVISION = BIT(12),
|
||||
AUTOBUYCLASS_SHIELD = BIT(13),
|
||||
};
|
||||
|
||||
enum ItemCostType
|
||||
{
|
||||
ASSAULTSUIT_PRICE = 1000,
|
||||
FLASHBANG_PRICE = 200,
|
||||
HEGRENADE_PRICE = 300,
|
||||
SMOKEGRENADE_PRICE = 300,
|
||||
KEVLAR_PRICE = 650,
|
||||
HELMET_PRICE = 350,
|
||||
NVG_PRICE = 1250,
|
||||
DEFUSEKIT_PRICE = 200,
|
||||
};
|
||||
|
||||
enum AmmoCostType
|
||||
{
|
||||
AMMO_338MAG_PRICE = 125,
|
||||
AMMO_357SIG_PRICE = 50,
|
||||
AMMO_45ACP_PRICE = 25,
|
||||
AMMO_50AE_PRICE = 40,
|
||||
AMMO_556MM_PRICE = 60,
|
||||
AMMO_57MM_PRICE = 50,
|
||||
AMMO_762MM_PRICE = 80,
|
||||
AMMO_9MM_PRICE = 20,
|
||||
AMMO_BUCKSHOT_PRICE = 65,
|
||||
AMMO_FLASHBANG_PRICE = FLASHBANG_PRICE,
|
||||
AMMO_HEGRENADE_PRICE = HEGRENADE_PRICE,
|
||||
AMMO_SMOKEGRENADE_PRICE = SMOKEGRENADE_PRICE,
|
||||
};
|
||||
|
||||
enum WeaponCostType
|
||||
{
|
||||
AK47_PRICE = 2500,
|
||||
AWP_PRICE = 4750,
|
||||
DEAGLE_PRICE = 650,
|
||||
G3SG1_PRICE = 5000,
|
||||
SG550_PRICE = 4200,
|
||||
GLOCK18_PRICE = 400,
|
||||
M249_PRICE = 5750,
|
||||
M3_PRICE = 1700,
|
||||
M4A1_PRICE = 3100,
|
||||
AUG_PRICE = 3500,
|
||||
MP5NAVY_PRICE = 1500,
|
||||
P228_PRICE = 600,
|
||||
P90_PRICE = 2350,
|
||||
UMP45_PRICE = 1700,
|
||||
MAC10_PRICE = 1400,
|
||||
SCOUT_PRICE = 2750,
|
||||
SG552_PRICE = 3500,
|
||||
TMP_PRICE = 1250,
|
||||
USP_PRICE = 500,
|
||||
ELITE_PRICE = 800,
|
||||
FIVESEVEN_PRICE = 750,
|
||||
XM1014_PRICE = 3000,
|
||||
GALIL_PRICE = 2000,
|
||||
FAMAS_PRICE = 2250,
|
||||
SHIELDGUN_PRICE = 2200,
|
||||
};
|
||||
|
||||
enum WeaponState
|
||||
{
|
||||
WPNSTATE_USP_SILENCED = BIT(0),
|
||||
WPNSTATE_GLOCK18_BURST_MODE = BIT(1),
|
||||
WPNSTATE_M4A1_SILENCED = BIT(2),
|
||||
WPNSTATE_ELITE_LEFT = BIT(3),
|
||||
WPNSTATE_FAMAS_BURST_MODE = BIT(4),
|
||||
WPNSTATE_SHIELD_DRAWN = BIT(5),
|
||||
};
|
||||
|
||||
// custom enum
|
||||
// the default amount of ammo that comes with each gun when it spawns
|
||||
enum ClipGiveDefault
|
||||
{
|
||||
P228_DEFAULT_GIVE = 13,
|
||||
GLOCK18_DEFAULT_GIVE = 20,
|
||||
SCOUT_DEFAULT_GIVE = 10,
|
||||
HEGRENADE_DEFAULT_GIVE = 1,
|
||||
XM1014_DEFAULT_GIVE = 7,
|
||||
C4_DEFAULT_GIVE = 1,
|
||||
MAC10_DEFAULT_GIVE = 30,
|
||||
AUG_DEFAULT_GIVE = 30,
|
||||
SMOKEGRENADE_DEFAULT_GIVE = 1,
|
||||
ELITE_DEFAULT_GIVE = 30,
|
||||
FIVESEVEN_DEFAULT_GIVE = 20,
|
||||
UMP45_DEFAULT_GIVE = 25,
|
||||
SG550_DEFAULT_GIVE = 30,
|
||||
GALIL_DEFAULT_GIVE = 35,
|
||||
FAMAS_DEFAULT_GIVE = 25,
|
||||
USP_DEFAULT_GIVE = 12,
|
||||
AWP_DEFAULT_GIVE = 10,
|
||||
MP5NAVY_DEFAULT_GIVE = 30,
|
||||
M249_DEFAULT_GIVE = 100,
|
||||
M3_DEFAULT_GIVE = 8,
|
||||
M4A1_DEFAULT_GIVE = 30,
|
||||
TMP_DEFAULT_GIVE = 30,
|
||||
G3SG1_DEFAULT_GIVE = 20,
|
||||
FLASHBANG_DEFAULT_GIVE = 1,
|
||||
DEAGLE_DEFAULT_GIVE = 7,
|
||||
SG552_DEFAULT_GIVE = 30,
|
||||
AK47_DEFAULT_GIVE = 30,
|
||||
//KNIFE_DEFAULT_GIVE = 1,
|
||||
P90_DEFAULT_GIVE = 50,
|
||||
};
|
||||
|
||||
enum ClipSizeType
|
||||
{
|
||||
P228_MAX_CLIP = 13,
|
||||
GLOCK18_MAX_CLIP = 20,
|
||||
SCOUT_MAX_CLIP = 10,
|
||||
XM1014_MAX_CLIP = 7,
|
||||
MAC10_MAX_CLIP = 30,
|
||||
AUG_MAX_CLIP = 30,
|
||||
ELITE_MAX_CLIP = 30,
|
||||
FIVESEVEN_MAX_CLIP = 20,
|
||||
UMP45_MAX_CLIP = 25,
|
||||
SG550_MAX_CLIP = 30,
|
||||
GALIL_MAX_CLIP = 35,
|
||||
FAMAS_MAX_CLIP = 25,
|
||||
USP_MAX_CLIP = 12,
|
||||
AWP_MAX_CLIP = 10,
|
||||
MP5N_MAX_CLIP = 30,
|
||||
M249_MAX_CLIP = 100,
|
||||
M3_MAX_CLIP = 8,
|
||||
M4A1_MAX_CLIP = 30,
|
||||
TMP_MAX_CLIP = 30,
|
||||
G3SG1_MAX_CLIP = 20,
|
||||
DEAGLE_MAX_CLIP = 7,
|
||||
SG552_MAX_CLIP = 30,
|
||||
AK47_MAX_CLIP = 30,
|
||||
P90_MAX_CLIP = 50,
|
||||
};
|
||||
|
||||
enum WeightWeapon
|
||||
{
|
||||
P228_WEIGHT = 5,
|
||||
GLOCK18_WEIGHT = 5,
|
||||
SCOUT_WEIGHT = 30,
|
||||
HEGRENADE_WEIGHT = 2,
|
||||
XM1014_WEIGHT = 20,
|
||||
C4_WEIGHT = 3,
|
||||
MAC10_WEIGHT = 25,
|
||||
AUG_WEIGHT = 25,
|
||||
SMOKEGRENADE_WEIGHT = 1,
|
||||
ELITE_WEIGHT = 5,
|
||||
FIVESEVEN_WEIGHT = 5,
|
||||
UMP45_WEIGHT = 25,
|
||||
SG550_WEIGHT = 20,
|
||||
GALIL_WEIGHT = 25,
|
||||
FAMAS_WEIGHT = 75,
|
||||
USP_WEIGHT = 5,
|
||||
AWP_WEIGHT = 30,
|
||||
MP5NAVY_WEIGHT = 25,
|
||||
M249_WEIGHT = 25,
|
||||
M3_WEIGHT = 20,
|
||||
M4A1_WEIGHT = 25,
|
||||
TMP_WEIGHT = 25,
|
||||
G3SG1_WEIGHT = 20,
|
||||
FLASHBANG_WEIGHT = 1,
|
||||
DEAGLE_WEIGHT = 7,
|
||||
SG552_WEIGHT = 25,
|
||||
AK47_WEIGHT = 25,
|
||||
P90_WEIGHT = 26,
|
||||
KNIFE_WEIGHT = 0,
|
||||
};
|
||||
|
||||
enum MaxAmmoType
|
||||
{
|
||||
MAX_AMMO_BUCKSHOT = 32,
|
||||
MAX_AMMO_9MM = 120,
|
||||
MAX_AMMO_556NATO = 90,
|
||||
MAX_AMMO_556NATOBOX = 200,
|
||||
MAX_AMMO_762NATO = 90,
|
||||
MAX_AMMO_45ACP = 100,
|
||||
MAX_AMMO_50AE = 35,
|
||||
MAX_AMMO_338MAGNUM = 30,
|
||||
MAX_AMMO_57MM = 100,
|
||||
MAX_AMMO_357SIG = 52,
|
||||
|
||||
// custom
|
||||
MAX_AMMO_SMOKEGRENADE = 1,
|
||||
MAX_AMMO_HEGRENADE = 1,
|
||||
MAX_AMMO_FLASHBANG = 2,
|
||||
};
|
||||
|
||||
enum AmmoType
|
||||
{
|
||||
AMMO_NONE,
|
||||
AMMO_338MAGNUM,
|
||||
AMMO_762NATO,
|
||||
AMMO_556NATOBOX,
|
||||
AMMO_556NATO,
|
||||
AMMO_BUCKSHOT,
|
||||
AMMO_45ACP,
|
||||
AMMO_57MM,
|
||||
AMMO_50AE,
|
||||
AMMO_357SIG,
|
||||
AMMO_9MM,
|
||||
AMMO_FLASHBANG,
|
||||
AMMO_HEGRENADE,
|
||||
AMMO_SMOKEGRENADE,
|
||||
AMMO_C4,
|
||||
|
||||
AMMO_MAX_TYPES
|
||||
};
|
||||
|
||||
enum WeaponClassType
|
||||
{
|
||||
WEAPONCLASS_NONE,
|
||||
WEAPONCLASS_KNIFE,
|
||||
WEAPONCLASS_PISTOL,
|
||||
WEAPONCLASS_GRENADE,
|
||||
WEAPONCLASS_SUBMACHINEGUN,
|
||||
WEAPONCLASS_SHOTGUN,
|
||||
WEAPONCLASS_MACHINEGUN,
|
||||
WEAPONCLASS_RIFLE,
|
||||
WEAPONCLASS_SNIPERRIFLE,
|
||||
WEAPONCLASS_MAX,
|
||||
};
|
||||
|
||||
enum AmmoBuyAmount
|
||||
{
|
||||
AMMO_338MAG_BUY = 10,
|
||||
AMMO_357SIG_BUY = 13,
|
||||
AMMO_45ACP_BUY = 12,
|
||||
AMMO_50AE_BUY = 7,
|
||||
AMMO_556NATO_BUY = 30,
|
||||
AMMO_556NATOBOX_BUY = 30,
|
||||
AMMO_57MM_BUY = 50,
|
||||
AMMO_762NATO_BUY = 30,
|
||||
AMMO_9MM_BUY = 30,
|
||||
AMMO_BUCKSHOT_BUY = 8,
|
||||
AMMO_FLASHBANG_BUY = 1,
|
||||
AMMO_HEGRENADE_BUY = 1,
|
||||
AMMO_SMOKEGRENADE_BUY = 1,
|
||||
};
|
||||
|
||||
enum shieldgun_e
|
||||
{
|
||||
SHIELDGUN_IDLE,
|
||||
SHIELDGUN_SHOOT1,
|
||||
SHIELDGUN_SHOOT2,
|
||||
SHIELDGUN_SHOOT_EMPTY,
|
||||
SHIELDGUN_RELOAD,
|
||||
SHIELDGUN_DRAW,
|
||||
SHIELDGUN_DRAWN_IDLE,
|
||||
SHIELDGUN_UP,
|
||||
SHIELDGUN_DOWN,
|
||||
};
|
||||
|
||||
// custom
|
||||
enum shieldgren_e
|
||||
{
|
||||
SHIELDREN_IDLE = 4,
|
||||
SHIELDREN_UP,
|
||||
SHIELDREN_DOWN
|
||||
};
|
||||
|
||||
enum InventorySlotType
|
||||
{
|
||||
NONE_SLOT,
|
||||
PRIMARY_WEAPON_SLOT,
|
||||
PISTOL_SLOT,
|
||||
KNIFE_SLOT,
|
||||
GRENADE_SLOT,
|
||||
C4_SLOT,
|
||||
};
|
||||
|
||||
enum Bullet
|
||||
{
|
||||
BULLET_NONE,
|
||||
BULLET_PLAYER_9MM,
|
||||
BULLET_PLAYER_MP5,
|
||||
BULLET_PLAYER_357,
|
||||
BULLET_PLAYER_BUCKSHOT,
|
||||
BULLET_PLAYER_CROWBAR,
|
||||
BULLET_MONSTER_9MM,
|
||||
BULLET_MONSTER_MP5,
|
||||
BULLET_MONSTER_12MM,
|
||||
BULLET_PLAYER_45ACP,
|
||||
BULLET_PLAYER_338MAG,
|
||||
BULLET_PLAYER_762MM,
|
||||
BULLET_PLAYER_556MM,
|
||||
BULLET_PLAYER_50AE,
|
||||
BULLET_PLAYER_57MM,
|
||||
BULLET_PLAYER_357SIG,
|
||||
};
|
||||
|
||||
struct WeaponStruct
|
||||
{
|
||||
int m_type;
|
||||
int m_price;
|
||||
int m_side;
|
||||
int m_slot;
|
||||
int m_ammoPrice;
|
||||
};
|
||||
|
||||
struct AutoBuyInfoStruct
|
||||
{
|
||||
int m_class;
|
||||
char *m_command;
|
||||
char *m_classname;
|
||||
};
|
||||
|
||||
struct WeaponAliasInfo
|
||||
{
|
||||
char *alias;
|
||||
WeaponIdType id;
|
||||
};
|
||||
|
||||
struct WeaponBuyAliasInfo
|
||||
{
|
||||
char *alias;
|
||||
WeaponIdType id;
|
||||
char *failName;
|
||||
};
|
||||
|
||||
struct WeaponClassAliasInfo
|
||||
{
|
||||
char *alias;
|
||||
WeaponClassType id;
|
||||
};
|
||||
|
||||
struct WeaponInfoStruct
|
||||
{
|
||||
int id;
|
||||
int cost;
|
||||
int clipCost;
|
||||
int buyClipSize;
|
||||
int gunClipSize;
|
||||
int maxRounds;
|
||||
AmmoType ammoType;
|
||||
char *entityName;
|
||||
|
||||
// custom
|
||||
const char *ammoName1;
|
||||
const char *ammoName2;
|
||||
};
|
||||
|
||||
struct AmmoInfoStruct
|
||||
{
|
||||
AmmoType ammoType;
|
||||
|
||||
int clipCost;
|
||||
int buyClipSize;
|
||||
int maxRounds;
|
||||
|
||||
const char *ammoName1;
|
||||
const char *ammoName2;
|
||||
};
|
||||
|
||||
struct WeaponSlotInfo
|
||||
{
|
||||
WeaponIdType id;
|
||||
InventorySlotType slot;
|
||||
const char *weaponName;
|
||||
};
|
||||
|
||||
extern AutoBuyInfoStruct g_autoBuyInfo[35];
|
||||
extern WeaponStruct g_weaponStruct[MAX_WEAPONS];
|
||||
|
||||
// WeaponType
|
||||
WeaponIdType AliasToWeaponID(const char *alias);
|
||||
const char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id);
|
||||
const char *WeaponIDToAlias(int id);
|
||||
WeaponClassType AliasToWeaponClass(const char *alias);
|
||||
WeaponClassType WeaponIDToWeaponClass(int id);
|
||||
WeaponClassType WeaponIDToWeaponClass(ArmouryItemPack id);
|
||||
bool IsPrimaryWeapon(int id);
|
||||
bool IsSecondaryWeapon(int id);
|
||||
bool IsGrenadeWeapon(int id);
|
||||
bool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions);
|
||||
void WeaponInfoReset();
|
||||
|
||||
WeaponInfoStruct *GetWeaponInfo(int weaponID);
|
||||
WeaponInfoStruct *GetWeaponInfo(const char *weaponName);
|
||||
|
||||
AmmoInfoStruct *GetAmmoInfo(AmmoType ammoID);
|
||||
AmmoInfoStruct *GetAmmoInfo(const char *ammoName);
|
||||
|
||||
WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID);
|
||||
WeaponSlotInfo *GetWeaponSlot(const char *weaponName);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,76 +1,76 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MAINTYPES_H
|
||||
#define MAINTYPES_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "osconfig.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
// Has no references on multiplayer library CS.
|
||||
#define NOXREF
|
||||
// Function body is not implemented.
|
||||
#define NOBODY
|
||||
// Function is not tested at all.
|
||||
#define UNTESTED
|
||||
// Function is doubt reversed
|
||||
#define TODOBODY
|
||||
|
||||
#define BIT(n) (1<<(n))
|
||||
|
||||
#ifdef HAVE_STRONG_TYPEDEF
|
||||
enum class string_t: unsigned int {};
|
||||
#else
|
||||
typedef unsigned int string_t;
|
||||
#endif
|
||||
|
||||
typedef int EOFFSET;
|
||||
typedef int BOOL;
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
#define _DEF_BYTE_
|
||||
|
||||
#ifndef __cplusplus
|
||||
#undef true
|
||||
#undef false
|
||||
typedef enum {false, true} qboolean;
|
||||
#else
|
||||
typedef int qboolean;
|
||||
#endif // #ifndef __cplusplus
|
||||
|
||||
// From engine/server.h
|
||||
typedef enum sv_delta_s
|
||||
{
|
||||
sv_packet_nodelta,
|
||||
sv_packet_delta,
|
||||
} sv_delta_t;
|
||||
|
||||
#endif // MAINTYPES_H
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MAINTYPES_H
|
||||
#define MAINTYPES_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "osconfig.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
// Has no references on multiplayer library CS.
|
||||
#define NOXREF
|
||||
// Function body is not implemented.
|
||||
#define NOBODY
|
||||
// Function is not tested at all.
|
||||
#define UNTESTED
|
||||
// Function is doubt reversed
|
||||
#define TODOBODY
|
||||
|
||||
#define BIT(n) (1<<(n))
|
||||
|
||||
#ifdef HAVE_STRONG_TYPEDEF
|
||||
enum class string_t: unsigned int {};
|
||||
#else
|
||||
typedef unsigned int string_t;
|
||||
#endif
|
||||
|
||||
typedef int EOFFSET;
|
||||
typedef int BOOL;
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
#define _DEF_BYTE_
|
||||
|
||||
#ifndef __cplusplus
|
||||
#undef true
|
||||
#undef false
|
||||
typedef enum {false, true} qboolean;
|
||||
#else
|
||||
typedef int qboolean;
|
||||
#endif // #ifndef __cplusplus
|
||||
|
||||
// From engine/server.h
|
||||
typedef enum sv_delta_s
|
||||
{
|
||||
sv_packet_nodelta,
|
||||
sv_packet_delta,
|
||||
} sv_delta_t;
|
||||
|
||||
#endif // MAINTYPES_H
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user