fixed some warnings from pvs-studio

bot's don't change enemy to teamkiller if currently busy with real enemy
checks for user rendering (invisibility, got from podbot_mm)
no hunting of seek cover when escaping from bomb
This commit is contained in:
jeefo 2015-06-28 19:43:31 +03:00
commit b6159188bd
12 changed files with 442 additions and 366 deletions

View file

@ -48,7 +48,7 @@ using namespace Math;
#include <direct.h>
#define DLL_ENTRYPOINT int STDCALL DllMain (HINSTANCE hModule, DWORD dwReason, LPVOID)
#define DLL_ENTRYPOINT int STDCALL DllMain (HINSTANCE, DWORD dwReason, LPVOID)
#define DLL_DETACHING (dwReason == DLL_PROCESS_DETACH)
#define DLL_RETENTRY return TRUE
@ -657,15 +657,15 @@ struct ChatterItem
// language config structure definition
struct LanguageItem
{
char *original; // original string
char *translated; // string to replace for
const char *original; // original string
const char *translated; // string to replace for
};
struct WeaponSelect
{
int id; // the weapon id value
char *weaponName; // name of the weapon when selecting it
char *modelName; // model name to separate cs weapons
const char *weaponName; // name of the weapon when selecting it
const char *modelName; // model name to separate cs weapons
int price; // price when buying
int minPrimaryAmmo; // minimum primary ammo
int teamStandard; // used by team (number) (standard map)
@ -696,7 +696,7 @@ struct FireDelay
struct MenuText
{
int validSlots; // ored together bits for valid keys
char *menuText; // ptr to actual string
const char *menuText; // ptr to actual string
};
// array of clients struct
@ -898,7 +898,6 @@ private:
float m_followWaitTime; // wait to follow time
edict_t *m_targetEntity; // the entity that the bot is trying to reach
edict_t *m_LeaderEntity; // the entity that the bot is picking as a leader
edict_t *m_hostages[MAX_HOSTAGES]; // pointer to used hostage entities
bool m_isStuck; // bot is stuck
@ -967,12 +966,19 @@ private:
bool CanDuckUnder (const Vector &normal);
bool CanJumpUp (const Vector &normal);
bool CanStrafeLeft (TraceResult *tr);
bool CanStrafeRight (TraceResult *tr);
bool CantMoveForward (const Vector &normal, TraceResult *tr);
#ifdef DEAD_CODE
bool CanStrafeRight (TraceResult *tr);
bool CanStrafeLeft (TraceResult *tr);
bool IsBlockedLeft (void);
bool IsBlockedRight (void);
void ChangePitch (float speed);
void ChangeYaw (float speed);
#endif
void CheckMessageQueue (void);
void CheckRadioCommands (void);
void CheckReload (void);
@ -1016,8 +1022,6 @@ private:
int InFieldOfView (const Vector &dest);
bool IsBombDefusing (const Vector &bombOrigin);
bool IsBlockedLeft (void);
bool IsBlockedRight (void);
bool IsPointOccupied (int index);
inline bool IsOnLadder (void) { return pev->movetype == MOVETYPE_FLY; }
@ -1028,7 +1032,6 @@ private:
bool ItemIsVisible (const Vector &dest, char *itemName);
bool LastEnemyShootable (void);
bool IsLastEnemyViewable (void);
bool IsBehindSmokeClouds (edict_t *ent);
void RunTask (void);
@ -1067,6 +1070,7 @@ private:
bool IsWeaponBadInDistance (int weaponIndex, float distance);
bool DoFirePause (float distance, FireDelay *fireDelay);
bool LookupEnemy (void);
bool IsEnemyHiddenByRendering (edict_t *enemy);
void FireWeapon (void);
void FocusEnemy (void);
@ -1316,7 +1320,7 @@ public:
void Think (void);
void Free (void);
void Free (int index);
void CheckAutoVacate (edict_t *ent);
void CheckAutoVacate (void);
void AddRandom (void) { AddBot ("", -1, -1, -1, -1); }
void AddBot (const String &name, int difficulty, int personality, int team, int member);
@ -1495,7 +1499,7 @@ public:
int GetPathDistance (int srcIndex, int destIndex);
Path *GetPath (int id);
char *GetWaypointInfo (int id);
const char *GetWaypointInfo (int id);
char *GetInfo (void) { return m_infoBuffer; }
int AddGoalScore (int index, int other[4]);
@ -1639,7 +1643,8 @@ extern bool IsInViewCone (const Vector &origin, edict_t *ent);
extern int GetWeaponPenetrationPower (int id);
extern bool IsValidBot (edict_t *ent);
extern bool IsValidPlayer (edict_t *ent);
extern bool OpenConfig (const char *fileName, char *errorIfNotExists, File *outFile, bool languageDependant = false);
extern bool IsPlayerVIP (edict_t *ent);
extern bool OpenConfig (const char *fileName, const char *errorIfNotExists, File *outFile, bool languageDependant = false);
extern bool FindNearestPlayer (void **holder, edict_t *to, float searchDistance = 4096.0, bool sameTeam = false, bool needBot = false, bool needAlive = false, bool needDrawn = false);
extern const char *GetMapName (void);
@ -1657,7 +1662,7 @@ extern void FakeClientCommand (edict_t *fakeClient, const char *format, ...);
extern void strtrim (char *string);
extern void CreatePath (char *path);
extern void ServerCommand (const char *format, ...);
extern void RegisterCommand (char *command, void funcPtr (void));
extern void RegisterCommand (const char *command, void funcPtr (void));
extern void CheckWelcomeMessage (void);
extern void DetectCSVersion (void);
extern void PlaySound (edict_t *ent, const char *soundName);

View file

@ -3932,14 +3932,6 @@ public:
}
};
//
// Class: RandomGenerator
// Random number generator.
//
class RandomGenerator
{
};
//
// Type: StrVec
// Array of strings.
@ -4080,6 +4072,6 @@ public:
// See Also:
// <Array>
//
#define IterateArray(arrayName, iteratorName) \
#define FOR_EACH_AE(arrayName, iteratorName) \
for (int iteratorName = 0; iteratorName != arrayName.GetElementNumber (); iteratorName++)

View file

@ -81,6 +81,7 @@
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
<EmbedManifest>false</EmbedManifest>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\release\</OutDir>

View file

@ -100,6 +100,14 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
{
// this function checks visibility of a bot target.
if (IsEnemyHiddenByRendering (target))
{
*bodyPart = 0;
*origin = nullvec;
return false;
}
const Vector &botHead = EyePosition ();
TraceResult tr;
@ -347,7 +355,7 @@ void Bot::CheckGrenadeThrow (void)
g_waypoint->FindInRadius (inRadius, 256, m_lastEnemy->v.origin + (m_lastEnemy->v.velocity * 0.5).Get2D ());
IterateArray (inRadius, i)
FOR_EACH_AE (inRadius, i)
{
Path *path = g_waypoint->GetPath (i);
@ -407,7 +415,7 @@ void Bot::AvoidGrenades (void)
Array <entity_t> activeGrenades = g_botManager->GetActiveGrenades ();
// find all grenades on the map
IterateArray (activeGrenades, it)
FOR_EACH_AE (activeGrenades, it)
{
edict_t *ent = activeGrenades[it];
@ -419,7 +427,7 @@ void Bot::AvoidGrenades (void)
continue;
// TODO: should be done once for grenade, instead of checking several times
if (m_difficulty == 4 && strcmp (STRING (ent->v.model) + 9, "flashbang.mdl") == 0)
if (m_personality == PERSONALITY_RUSHER && m_difficulty == 4 && strcmp (STRING (ent->v.model) + 9, "flashbang.mdl") == 0)
{
const Vector &position = (GetEntityOrigin (ent) - EyePosition ()).ToAngles ();
@ -471,7 +479,7 @@ bool Bot::IsBehindSmokeClouds (edict_t *ent)
Array <entity_t> activeGrenades = g_botManager->GetActiveGrenades ();
// find all grenades on the map
IterateArray (activeGrenades, it)
FOR_EACH_AE (activeGrenades, it)
{
edict_t *grenade = activeGrenades[it];
@ -488,7 +496,7 @@ bool Bot::IsBehindSmokeClouds (edict_t *ent)
const Vector &entityOrigin = GetEntityOrigin (grenade);
const Vector &betweenNade = (entityOrigin - pev->origin).Normalize ();
const Vector &betweenResult = ((Vector (betweenNade.y, betweenNade.x, 0) * 150.0 + entityOrigin) - pev->origin).Normalize ();
const Vector &betweenResult = ((betweenNade.Get2D () * 150.0f + entityOrigin) - pev->origin).Normalize ();
if ((betweenNade | betweenUs) > (betweenNade | betweenResult))
return true;
@ -726,11 +734,9 @@ void Bot::FindItem (void)
m_pickupItem = NULL;
m_pickupType = PICKUP_NONE;
bool allowPickup = false;
while (!IsEntityNull (ent = FIND_ENTITY_IN_SPHERE (ent, pev->origin, searchRadius)))
{
allowPickup = false; // assume can't use it until known otherwise
bool allowPickup = false; // assume can't use it until known otherwise
if ((ent->v.effects & EF_NODRAW) || ent == m_itemIgnore)
continue; // someone owns this weapon or it hasn't respawned yet
@ -1231,7 +1237,7 @@ void Bot::CheckMessageQueue (void)
}
// prevent vip from buying
if ((g_mapType & MAP_AS) && *(INFOKEY_VALUE (GET_INFOKEYBUFFER (GetEntity ()), "model")) == 'v')
if (IsPlayerVIP (GetEntity ()))
{
m_isVIP = true;
m_buyState = 6;
@ -1415,7 +1421,7 @@ bool Bot::IsRestricted (int weaponIndex)
Array <String> bannedWeapons = String (yb_restricted_weapons.GetString ()).Split (';');
IterateArray (bannedWeapons, i)
FOR_EACH_AE (bannedWeapons, i)
{
const char *banned = STRING (GetWeaponReturn (true, NULL, weaponIndex));
@ -1483,7 +1489,7 @@ bool Bot::IsMorePowerfulWeaponCanBeBought (void)
Array <String> bannedWeapons = String (yb_restricted_weapons.GetString ()).Split (';');
// check if its banned
IterateArray (bannedWeapons, i)
FOR_EACH_AE (bannedWeapons, i)
{
if (m_currentWeapon == GetWeaponReturn (false, bannedWeapons[i].GetBuffer ()))
return true;
@ -2105,7 +2111,7 @@ void Bot::SetConditions (void)
// if half of the round is over, allow hunting
// FIXME: it probably should be also team/map dependant
if (IsEntityNull (m_enemy) && g_timeRoundMid < GetWorldTime () && !m_isUsingGrenade && m_currentWaypointIndex != g_waypoint->FindNearest (m_lastEnemyOrigin) && m_personality != PERSONALITY_CAREFUL)
if (GetTaskId () != TASK_ESCAPEFROMBOMB && IsEntityNull (m_enemy) && g_timeRoundMid < GetWorldTime () && !m_isUsingGrenade && m_currentWaypointIndex != g_waypoint->FindNearest (m_lastEnemyOrigin) && m_personality != PERSONALITY_CAREFUL)
{
float desireLevel = 4096.0 - ((1.0 - tempAgression) * distance);
@ -2272,7 +2278,7 @@ void Bot::RemoveCertainTask (TaskId_t id)
return;
}
IterateArray (m_tasks, i)
FOR_EACH_AE (m_tasks, i)
{
if (m_tasks[i].id == id)
m_tasks.RemoveAt (i);
@ -2345,26 +2351,6 @@ bool Bot::ReactOnEnemy (void)
return false;
}
bool Bot::IsLastEnemyViewable (void)
{
// this function checks if line of sight established to last enemy
if (IsEntityNull (m_lastEnemy) || m_lastEnemyOrigin == nullvec)
{
m_lastEnemy = NULL;
m_lastEnemyOrigin = nullvec;
return false;
}
// trace a line from bot's eyes to destination...
TraceResult tr;
TraceLine (EyePosition (), m_lastEnemyOrigin, true, GetEntity (), &tr);
// check if line of sight to object is not blocked (i.e. visible)
return tr.flFraction >= 1.0;
}
bool Bot::LastEnemyShootable (void)
{
// don't allow shooting through walls
@ -2706,10 +2692,10 @@ void Bot::CheckRadioCommands (void)
{
if (g_timeNextBombUpdate < GetWorldTime ())
{
float minDistance = 4096.0f;
float minDistance = FLT_MAX;
// find nearest bomb waypoint to player
IterateArray (g_waypoint->m_goalPoints, i)
FOR_EACH_AE (g_waypoint->m_goalPoints, i)
{
distance = (g_waypoint->GetPath (g_waypoint->m_goalPoints[i])->origin - m_radioEntity->v.origin).GetLengthSquared ();
@ -2722,11 +2708,7 @@ void Bot::CheckRadioCommands (void)
// mark this waypoint as restricted point
if (bombPoint != -1 && !g_waypoint->IsGoalVisited (bombPoint))
g_waypoint->SetGoalVisited (bombPoint);
g_timeNextBombUpdate = GetWorldTime () + 0.5;
}
{
// does this bot want to defuse?
if (GetTaskId () == TASK_NORMAL)
{
@ -2738,6 +2720,10 @@ void Bot::CheckRadioCommands (void)
}
}
g_waypoint->SetGoalVisited (bombPoint);
}
g_timeNextBombUpdate = GetWorldTime () + 0.5;
}
}
}
break;
@ -2942,6 +2928,13 @@ void Bot::ChooseAimDirection (void)
else if (m_lastEnemyOrigin == nullvec)
m_aimFlags &= ~(AIM_LAST_ENEMY | AIM_PREDICT_PATH);
// if in battle, and enemy is behind something for short period of time, look at that origin!
if (m_seeEnemyTime + 2.0f < GetWorldTime () && (m_aimFlags & AIM_NAVPOINT) && !(m_aimFlags & AIM_ENEMY) && m_lastEnemyOrigin != nullvec && IsAlive (m_enemy))
{
m_aimFlags |= AIM_LAST_ENEMY;
m_canChooseAimDirection = false;
}
unsigned int flags = m_aimFlags;
// don't allow bot to look at danger positions under certain circumstances
@ -3061,6 +3054,7 @@ void Bot::ChooseAimDirection (void)
}
}
}
if (m_lookAt == nullvec)
m_lookAt = m_destOrigin;
}
@ -3122,7 +3116,7 @@ void Bot::Think (void)
bool sayBufferExists = false;
// search for last messages, sayed
IterateArray (m_sayTextBuffer.lastUsedSentences, i)
FOR_EACH_AE (m_sayTextBuffer.lastUsedSentences, i)
{
if (strncmp (m_sayTextBuffer.lastUsedSentences[i].GetBuffer (), pickedPhrase, m_sayTextBuffer.lastUsedSentences[i].GetLength ()) == 0)
sayBufferExists = true;
@ -3260,7 +3254,7 @@ void Bot::RunTask (void)
}
// don't allow vip on as_ maps to camp + don't allow terrorist carrying c4 to camp
if (((g_mapType & MAP_AS) && *(INFOKEY_VALUE (GET_INFOKEYBUFFER (GetEntity ()), "model")) == 'v') || ((g_mapType & MAP_DE) && m_team == TEAM_TF && !g_bombPlanted && m_hasC4))
if (IsPlayerVIP (GetEntity ()) || ((g_mapType & MAP_DE) && m_team == TEAM_TF && !g_bombPlanted && m_hasC4))
campingAllowed = false;
// check if another bot is already camping here
@ -4866,7 +4860,7 @@ void Bot::BotAI (void)
if (Random.Long (0, 100) < 45 && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && (m_enemy->v.weapons & (1 << WEAPON_C4)))
ChatterMessage (Chatter_SpotTheBomber);
if (Random.Long (0, 100) < 45 && m_team == TEAM_TF && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && *g_engfuncs.pfnInfoKeyValue (g_engfuncs.pfnGetInfoKeyBuffer (m_enemy), "model") == 'v')
if (Random.Long (0, 100) < 45 && m_team == TEAM_TF && GetNearbyFriendsNearPosition (pev->origin, 512) == 0 && IsPlayerVIP (m_enemy))
ChatterMessage (Chatter_VIPSpotted);
if (Random.Long (0, 100) < 50 && GetNearbyFriendsNearPosition (pev->origin, 450) == 0 && GetTeam (m_enemy) != m_team && IsGroupOfEnemies (m_enemy->v.origin, 2, 384))
@ -5304,12 +5298,12 @@ void Bot::TakeDamage (edict_t *inflictor, int damage, int armor, int bits)
m_lastDamageType = bits;
CollectGoalExperience (damage, m_team);
if (IsValidPlayer (inflictor))
if (m_seeEnemyTime + 4.0f < GetWorldTime () && IsValidPlayer (inflictor))
{
if (GetTeam (inflictor) == m_team && yb_tkpunish.GetBool () && !g_botManager->GetBot (inflictor))
{
// alright, die you teamkiller!!!
m_actualReactionTime = 0.0;
m_actualReactionTime = 0.0f;
m_seeEnemyTime = GetWorldTime();
m_enemy = inflictor;
@ -6009,7 +6003,7 @@ void Bot::ReactOnSound (void)
}
// did the bot hear someone ?
if (!IsEntityNull (player))
if (IsValidPlayer (player))
{
// change to best weapon if heard something
if (!(m_states & STATE_SEEING_ENEMY) && m_seeEnemyTime + 2.5 < GetWorldTime () && IsOnFloor () && m_currentWeapon != WEAPON_C4 && m_currentWeapon != WEAPON_EXPLOSIVE && m_currentWeapon != WEAPON_SMOKE && m_currentWeapon != WEAPON_FLASHBANG && !yb_jasonmode.GetBool ())

View file

@ -324,12 +324,15 @@ void Bot::PrepareChatMessage (char *text)
}
}
if (textStart != NULL)
{
// let the bots make some mistakes...
char tempString[160];
strncpy (tempString, textStart, 159);
HumanizeChat (tempString);
strcat (m_tempStrings, tempString);
}
}
bool CheckKeywords (char *tempMessage, char *reply)
@ -339,9 +342,9 @@ bool CheckKeywords (char *tempMessage, char *reply)
if (!yb_chat.GetBool () || IsNullString (tempMessage))
return false;
IterateArray (g_replyFactory, i)
FOR_EACH_AE (g_replyFactory, i)
{
IterateArray (g_replyFactory[i].keywords, j)
FOR_EACH_AE (g_replyFactory[i].keywords, j)
{
// check is keyword has occurred in message
if (strstr (tempMessage, g_replyFactory[i].keywords[j].GetBuffer ()) != NULL)
@ -355,7 +358,7 @@ bool CheckKeywords (char *tempMessage, char *reply)
const char *generatedReply = g_replyFactory[i].replies.GetRandomElement ();
// don't say this twice
IterateArray (replies, k)
FOR_EACH_AE (replies, k)
{
if (strstr (replies[k].GetBuffer (), generatedReply) != NULL)
replyUsed = true;

View file

@ -12,6 +12,7 @@
ConVar yb_shoots_thru_walls ("yb_shoots_thru_walls", "2");
ConVar yb_ignore_enemies ("yb_ignore_enemies", "0");
ConVar yb_csdm_mode ("yb_csdm_mode", "0", VT_NOSERVER);
ConVar yb_check_enemy_rendering ("yb_check_enemy_rendering", "0", VT_NOSERVER);
ConVar mp_friendlyfire ("mp_friendlyfire", NULL, VT_NOREGISTER);
@ -45,6 +46,47 @@ int Bot::GetNearbyEnemiesNearPosition (const Vector &origin, int radius)
return count;
}
bool Bot::IsEnemyHiddenByRendering (edict_t *enemy)
{
if (IsEntityNull (enemy) || !yb_check_enemy_rendering.GetBool ())
return false;
entvars_t &v = enemy->v;
bool enemyHasGun = (v.weapons & WEAPON_SECONDARY) || (v.weapons & WEAPON_SECONDARY);
if ((v.renderfx == kRenderFxExplode || (v.effects & EF_NODRAW)) && !(v.oldbuttons & IN_ATTACK) || !enemyHasGun)
return true;
else if ((v.renderfx == kRenderFxExplode || (v.effects & EF_NODRAW)) && (v.oldbuttons & IN_ATTACK) && enemyHasGun)
return false;
else if (v.renderfx != kRenderFxHologram && v.renderfx != kRenderFxExplode && v.rendermode != kRenderNormal)
{
if (v.renderfx == kRenderFxGlowShell)
{
if (v.renderamt <= 20.0f && v.rendercolor.x <= 20.0f && v.rendercolor.y <= 20.f && v.rendercolor.z <= 20.f)
{
if (!(v.oldbuttons & IN_ATTACK) || !enemyHasGun)
return true;
return false;
}
else if (v.renderamt <= 60.0f && v.rendercolor.x <= 60.f && v.rendercolor.y <= 60.0f && v.rendercolor.z <= 60.0f)
return true;
}
else if (v.renderamt <= 20.0f)
{
if (!(v.oldbuttons & IN_ATTACK) || !enemyHasGun)
return true;
return false;
}
else if (v.renderamt <= 60.0f)
return true;
}
return false;
}
bool Bot::LookupEnemy (void)
{
// this function tries to find the best suitable enemy for the bot
@ -140,7 +182,7 @@ bool Bot::LookupEnemy (void)
newEnemy = player;
// aim VIP first on AS maps...
if ((g_mapType & MAP_AS) && *(INFOKEY_VALUE (GET_INFOKEYBUFFER (player), "model")) == 'v')
if (IsPlayerVIP (newEnemy))
break;
}
}
@ -842,11 +884,11 @@ bool Bot::IsWeaponBadInDistance (int weaponIndex, float distance)
return false;
// better use pistol in short range distances, when using sniper weapons
if ((weaponID == WEAPON_SCOUT || weaponID == WEAPON_AWP || weaponID == WEAPON_G3SG1 || weaponID == WEAPON_SG550) && distance < 300.0)
if ((weaponID == WEAPON_SCOUT || weaponID == WEAPON_AWP || weaponID == WEAPON_G3SG1 || weaponID == WEAPON_SG550) && distance < 500.0f)
return true;
// shotguns is too inaccurate at long distances, so weapon is bad
if ((weaponID == WEAPON_M3 || weaponID == WEAPON_XM1014) && distance > 750.0)
if ((weaponID == WEAPON_M3 || weaponID == WEAPON_XM1014) && distance > 750.0f)
return true;
return false;

View file

@ -25,7 +25,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c
g_botManager->AddBot (arg4, arg1, arg2, arg3, arg5);
// adding one bot with high difficulty parameters to random team
if (stricmp (arg0, "addbot_hs") == 0 || stricmp (arg0, "addhs") == 0)
else if (stricmp (arg0, "addbot_hs") == 0 || stricmp (arg0, "addhs") == 0)
g_botManager->AddBot (arg4, "4", "1", arg3, arg5);
// adding one bot with random parameters to terrorist team
@ -448,7 +448,7 @@ void ParseVoiceEvent (const String &base, int type, float timeToRepeat)
Array <String> temp = String (base).Split (',');
ChatterItem chatterItem;
IterateArray (temp, i)
FOR_EACH_AE (temp, i)
{
temp[i].Trim ().TrimQuotes ();
@ -590,7 +590,7 @@ void InitConfig (void)
replyKey.keywords.RemoveAll ();
replyKey.keywords = String (&line[4]).Split (',');
IterateArray (replyKey.keywords, i)
FOR_EACH_AE (replyKey.keywords, i)
replyKey.keywords[i].Trim ().TrimQuotes ();
}
else if (!replyKey.keywords.IsEmpty ())
@ -721,7 +721,7 @@ void InitConfig (void)
if (array.GetElementNumber () != 2)
AddLogEntry (true, LL_FATAL, "Error in chatter config file syntax... Please correct all Errors.");
IterateArray (array, i)
FOR_EACH_AE (array, i)
array[i].Trim ().Trim (); // double trim
// just to be more unique :)
@ -755,37 +755,37 @@ void InitConfig (void)
PARSE_VOICE_EVENT (Radio_EnemyDown, FLT_MAX);
// voice system
PARSE_VOICE_EVENT (Chatter_SpotTheBomber, 4.3);
PARSE_VOICE_EVENT (Chatter_VIPSpotted, 5.3);
PARSE_VOICE_EVENT (Chatter_FriendlyFire, 2.1);
PARSE_VOICE_EVENT (Chatter_SpotTheBomber, 4.3f);
PARSE_VOICE_EVENT (Chatter_VIPSpotted, 5.3f);
PARSE_VOICE_EVENT (Chatter_FriendlyFire, 2.1f);
PARSE_VOICE_EVENT (Chatter_DiePain, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_GotBlinded, 5.0);
PARSE_VOICE_EVENT (Chatter_GotBlinded, 5.0f);
PARSE_VOICE_EVENT (Chatter_GoingToPlantBomb, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_GoingToGuardVIPSafety, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_RescuingHostages, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_GoingToCamp, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_TeamKill, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_ReportingIn, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_GuardDroppedC4, 3.0);
PARSE_VOICE_EVENT (Chatter_GuardDroppedC4, 3.0f);
PARSE_VOICE_EVENT (Chatter_Camp, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_GuardingVipSafety, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_PlantingC4, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_DefusingC4, 3.0);
PARSE_VOICE_EVENT (Chatter_DefusingC4, 3.0f);
PARSE_VOICE_EVENT (Chatter_InCombat, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_SeeksEnemy, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_Nothing, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_EnemyDown, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_UseHostage, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_FoundC4, 5.5);
PARSE_VOICE_EVENT (Chatter_FoundC4, 5.5f);
PARSE_VOICE_EVENT (Chatter_WonTheRound, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_ScaredEmotion, 6.1);
PARSE_VOICE_EVENT (Chatter_HeardEnemy, 12.2);
PARSE_VOICE_EVENT (Chatter_SniperWarning, 4.3);
PARSE_VOICE_EVENT (Chatter_SniperKilled, 2.1);
PARSE_VOICE_EVENT (Chatter_ScaredEmotion, 6.1f);
PARSE_VOICE_EVENT (Chatter_HeardEnemy, 12.2f);
PARSE_VOICE_EVENT (Chatter_SniperWarning, 4.3f);
PARSE_VOICE_EVENT (Chatter_SniperKilled, 2.1f);
PARSE_VOICE_EVENT (Chatter_QuicklyWonTheRound, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_OneEnemyLeft, 2.5);
PARSE_VOICE_EVENT (Chatter_TwoEnemiesLeft, 2.5);
PARSE_VOICE_EVENT (Chatter_ThreeEnemiesLeft, 2.5);
PARSE_VOICE_EVENT (Chatter_OneEnemyLeft, 2.5f);
PARSE_VOICE_EVENT (Chatter_TwoEnemiesLeft, 2.5f);
PARSE_VOICE_EVENT (Chatter_ThreeEnemiesLeft, 2.5f);
PARSE_VOICE_EVENT (Chatter_NoEnemiesLeft, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_FoundBombPlace, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_WhereIsTheBomb, FLT_MAX);
@ -793,18 +793,18 @@ void InitConfig (void)
PARSE_VOICE_EVENT (Chatter_BarelyDefused, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_NiceshotCommander, FLT_MAX);
PARSE_VOICE_EVENT (Chatter_NiceshotPall, 2.0);
PARSE_VOICE_EVENT (Chatter_GoingToGuardHostages, 3.0);
PARSE_VOICE_EVENT (Chatter_GoingToGuardDoppedBomb, 3.0);
PARSE_VOICE_EVENT (Chatter_OnMyWay, 1.5);
PARSE_VOICE_EVENT (Chatter_LeadOnSir, 5.0);
PARSE_VOICE_EVENT (Chatter_Pinned_Down, 5.0);
PARSE_VOICE_EVENT (Chatter_GottaFindTheBomb, 3.0);
PARSE_VOICE_EVENT (Chatter_You_Heard_The_Man, 3.0);
PARSE_VOICE_EVENT (Chatter_Lost_The_Commander, 4.5);
PARSE_VOICE_EVENT (Chatter_NewRound, 3.5);
PARSE_VOICE_EVENT (Chatter_CoverMe, 3.5);
PARSE_VOICE_EVENT (Chatter_BehindSmoke, 3.5);
PARSE_VOICE_EVENT (Chatter_BombSiteSecured, 3.5);
PARSE_VOICE_EVENT (Chatter_GoingToGuardHostages, 3.0f);
PARSE_VOICE_EVENT (Chatter_GoingToGuardDoppedBomb, 3.0f);
PARSE_VOICE_EVENT (Chatter_OnMyWay, 1.5f);
PARSE_VOICE_EVENT (Chatter_LeadOnSir, 5.0f);
PARSE_VOICE_EVENT (Chatter_Pinned_Down, 5.0f);
PARSE_VOICE_EVENT (Chatter_GottaFindTheBomb, 3.0f);
PARSE_VOICE_EVENT (Chatter_You_Heard_The_Man, 3.0f);
PARSE_VOICE_EVENT (Chatter_Lost_The_Commander, 4.5f);
PARSE_VOICE_EVENT (Chatter_NewRound, 3.5f);
PARSE_VOICE_EVENT (Chatter_CoverMe, 3.5f);
PARSE_VOICE_EVENT (Chatter_BehindSmoke, 3.5f);
PARSE_VOICE_EVENT (Chatter_BombSiteSecured, 3.5f);
}
}
fp.Close ();
@ -835,7 +835,7 @@ void InitConfig (void)
if (!IsNullString (buffer))
{
strtrim (buffer);
temp.translated = strdup (buffer);
temp.translated = _strdup (buffer);
buffer[0] = 0x0;
}
@ -845,7 +845,7 @@ void InitConfig (void)
else if (strncmp (line, "[TRANSLATED]", 12) == 0)
{
strtrim (buffer);
temp.original = strdup (buffer);
temp.original = _strdup (buffer);
buffer[0] = 0x0;
langState = Lang_Translate;
@ -1046,7 +1046,7 @@ void UpdateClientData (const struct edict_s *ent, int sendweapons, struct client
void ClientPutInServer (edict_t *ent)
{
g_botManager->CheckAutoVacate (ent);
g_botManager->CheckAutoVacate ();
if (g_isMetamod)
RETURN_META (MRES_IGNORED);
@ -1565,7 +1565,7 @@ void ClientCommand (edict_t *ent)
{
case 1:
case 2:
if (FindNearestPlayer (reinterpret_cast <void **> (&bot), client->ent, 4096.0, true, true, true))
if (FindNearestPlayer (reinterpret_cast <void **> (&bot), client->ent, 300.0f, true, true, true))
{
if (!bot->m_hasC4 && !bot->HasHostage () )
{
@ -1588,7 +1588,7 @@ void ClientCommand (edict_t *ent)
case 3:
case 4:
if (FindNearestPlayer (reinterpret_cast <void **> (&bot), ent, 300.0, true, true, true))
if (FindNearestPlayer (reinterpret_cast <void **> (&bot), ent, 300.0f, true, true, true))
bot->DiscardWeaponForUser (ent, selection == 4 ? false : true);
break;
@ -1967,7 +1967,7 @@ void ClientCommand (edict_t *ent)
if (FStrEq (arg1, "dropme") || FStrEq (arg1, "dropc4"))
{
if (FindNearestPlayer (reinterpret_cast <void **> (&bot), ent, 300.0, true, true, true))
if (FindNearestPlayer (reinterpret_cast <void **> (&bot), ent, 300.0f, true, true, true))
bot->DiscardWeaponForUser (ent, IsNullString (strstr (arg1, "c4")) ? false : true);
return;
@ -2241,7 +2241,7 @@ int Spawn_Post (edict_t *ent)
RETURN_META_VALUE (MRES_IGNORED, 0);
}
void ServerActivate_Post (edict_t *pentEdictList, int edictCount, int clientMax)
void ServerActivate_Post (edict_t *, int, int)
{
// this function is called when the server has fully loaded and is about to manifest itself
// on the network as such. Since a mapchange is actually a server shutdown followed by a
@ -2758,7 +2758,7 @@ void pfnAlertMessage (ALERT_TYPE alertType, char *format, ...)
gamedll_funcs_t gameDLLFunc;
export int GetEntityAPI2 (gamefuncs_t *functionTable, int *interfaceVersion)
export int GetEntityAPI2 (gamefuncs_t *functionTable, int *)
{
// this function is called right after FuncPointers_t() by the engine in the game DLL (or
// what it BELIEVES to be the game DLL), in order to copy the list of MOD functions that can
@ -2803,7 +2803,7 @@ export int GetEntityAPI2 (gamefuncs_t *functionTable, int *interfaceVersion)
return TRUE;
}
export int GetEntityAPI2_Post (gamefuncs_t *functionTable, int *interfaceVersion)
export int GetEntityAPI2_Post (gamefuncs_t *functionTable, int *)
{
// this function is called right after FuncPointers_t() by the engine in the game DLL (or
// what it BELIEVES to be the game DLL), in order to copy the list of MOD functions that can
@ -2845,7 +2845,7 @@ export int GetNewDLLFunctions (newgamefuncs_t *functionTable, int *interfaceVers
return TRUE;
}
export int GetEngineFunctions (enginefuncs_t *functionTable, int *interfaceVersion)
export int GetEngineFunctions (enginefuncs_t *functionTable, int *)
{
if (g_isMetamod)
memset (functionTable, 0, sizeof (enginefuncs_t));
@ -2875,7 +2875,7 @@ export int GetEngineFunctions (enginefuncs_t *functionTable, int *interfaceVersi
return TRUE;
}
export int GetEngineFunctions_Post (enginefuncs_t *functionTable, int *interfaceVersion)
export int GetEngineFunctions_Post (enginefuncs_t *functionTable, int *)
{
memset (functionTable, 0, sizeof (enginefuncs_t));
@ -3027,7 +3027,7 @@ void FixDirectoryStructure (void)
directories.Push (DirectoryTransition ("config", "conf"));
directories.Push (DirectoryTransition ("conf/language", "conf/lang"));
IterateArray (directories, it)
FOR_EACH_AE (directories, it)
directories[it].TryToRename ();
directories.RemoveAll ();
@ -3227,7 +3227,7 @@ export void entityFunction (entvars_t *pev) \
static EntityPtr_t funcPtr = NULL; \
\
if (funcPtr == NULL) \
funcPtr = (EntityPtr_t) g_gameLib->GetFunctionAddr (#entityFunction); \
funcPtr = reinterpret_cast <EntityPtr_t> (g_gameLib->GetFunctionAddr (#entityFunction)); \
\
if (funcPtr == NULL) \
return; \
@ -3236,199 +3236,199 @@ export void entityFunction (entvars_t *pev) \
} \
// entities in counter-strike...
LINK_ENTITY (DelayedUse);
LINK_ENTITY (ambient_generic);
LINK_ENTITY (ammo_338magnum);
LINK_ENTITY (ammo_357sig);
LINK_ENTITY (ammo_45acp);
LINK_ENTITY (ammo_50ae);
LINK_ENTITY (ammo_556nato);
LINK_ENTITY (ammo_556natobox);
LINK_ENTITY (ammo_57mm);
LINK_ENTITY (ammo_762nato);
LINK_ENTITY (ammo_9mm);
LINK_ENTITY (ammo_buckshot);
LINK_ENTITY (armoury_entity);
LINK_ENTITY (beam);
LINK_ENTITY (bodyque);
LINK_ENTITY (button_target);
LINK_ENTITY (cycler);
LINK_ENTITY (cycler_prdroid);
LINK_ENTITY (cycler_sprite);
LINK_ENTITY (cycler_weapon);
LINK_ENTITY (cycler_wreckage);
LINK_ENTITY (env_beam);
LINK_ENTITY (env_beverage);
LINK_ENTITY (env_blood);
LINK_ENTITY (env_bombglow);
LINK_ENTITY (env_bubbles);
LINK_ENTITY (env_debris);
LINK_ENTITY (env_explosion);
LINK_ENTITY (env_fade);
LINK_ENTITY (env_funnel);
LINK_ENTITY (env_global);
LINK_ENTITY (env_glow);
LINK_ENTITY (env_laser);
LINK_ENTITY (env_lightning);
LINK_ENTITY (env_message);
LINK_ENTITY (env_rain);
LINK_ENTITY (env_render);
LINK_ENTITY (env_shake);
LINK_ENTITY (env_shooter);
LINK_ENTITY (env_snow);
LINK_ENTITY (env_sound);
LINK_ENTITY (env_spark);
LINK_ENTITY (env_sprite);
LINK_ENTITY (fireanddie);
LINK_ENTITY (func_bomb_target);
LINK_ENTITY (func_breakable);
LINK_ENTITY (func_button);
LINK_ENTITY (func_buyzone);
LINK_ENTITY (func_conveyor);
LINK_ENTITY (func_door);
LINK_ENTITY (func_door_rotating);
LINK_ENTITY (func_escapezone);
LINK_ENTITY (func_friction);
LINK_ENTITY (func_grencatch);
LINK_ENTITY (func_guntarget);
LINK_ENTITY (func_healthcharger);
LINK_ENTITY (func_hostage_rescue);
LINK_ENTITY (func_illusionary);
LINK_ENTITY (func_ladder);
LINK_ENTITY (func_monsterclip);
LINK_ENTITY (func_mortar_field);
LINK_ENTITY (func_pendulum);
LINK_ENTITY (func_plat);
LINK_ENTITY (func_platrot);
LINK_ENTITY (func_pushable);
LINK_ENTITY (func_rain);
LINK_ENTITY (func_recharge);
LINK_ENTITY (func_rot_button);
LINK_ENTITY (func_rotating);
LINK_ENTITY (func_snow);
LINK_ENTITY (func_tank);
LINK_ENTITY (func_tankcontrols);
LINK_ENTITY (func_tanklaser);
LINK_ENTITY (func_tankmortar);
LINK_ENTITY (func_tankrocket);
LINK_ENTITY (func_trackautochange);
LINK_ENTITY (func_trackchange);
LINK_ENTITY (func_tracktrain);
LINK_ENTITY (func_train);
LINK_ENTITY (func_traincontrols);
LINK_ENTITY (func_vehicle);
LINK_ENTITY (func_vehiclecontrols);
LINK_ENTITY (func_vip_safetyzone);
LINK_ENTITY (func_wall);
LINK_ENTITY (func_wall_toggle);
LINK_ENTITY (func_water);
LINK_ENTITY (func_weaponcheck);
LINK_ENTITY (game_counter);
LINK_ENTITY (game_counter_set);
LINK_ENTITY (game_end);
LINK_ENTITY (game_player_equip);
LINK_ENTITY (game_player_hurt);
LINK_ENTITY (game_player_team);
LINK_ENTITY (game_score);
LINK_ENTITY (game_team_master);
LINK_ENTITY (game_team_set);
LINK_ENTITY (game_text);
LINK_ENTITY (game_zone_player);
LINK_ENTITY (gibshooter);
LINK_ENTITY (grenade);
LINK_ENTITY (hostage_entity);
LINK_ENTITY (info_bomb_target);
LINK_ENTITY (info_hostage_rescue);
LINK_ENTITY (info_intermission);
LINK_ENTITY (info_landmark);
LINK_ENTITY (info_map_parameters);
LINK_ENTITY (info_null);
LINK_ENTITY (info_player_deathmatch);
LINK_ENTITY (info_player_start);
LINK_ENTITY (info_target);
LINK_ENTITY (info_teleport_destination);
LINK_ENTITY (info_vip_start);
LINK_ENTITY (infodecal);
LINK_ENTITY (item_airtank);
LINK_ENTITY (item_antidote);
LINK_ENTITY (item_assaultsuit);
LINK_ENTITY (item_battery);
LINK_ENTITY (item_healthkit);
LINK_ENTITY (item_kevlar);
LINK_ENTITY (item_longjump);
LINK_ENTITY (item_security);
LINK_ENTITY (item_sodacan);
LINK_ENTITY (item_suit);
LINK_ENTITY (item_thighpack);
LINK_ENTITY (light);
LINK_ENTITY (light_environment);
LINK_ENTITY (light_spot);
LINK_ENTITY (momentary_door);
LINK_ENTITY (momentary_rot_button);
LINK_ENTITY (monster_hevsuit_dead);
LINK_ENTITY (monster_mortar);
LINK_ENTITY (monster_scientist);
LINK_ENTITY (multi_manager);
LINK_ENTITY (multisource);
LINK_ENTITY (path_corner);
LINK_ENTITY (path_track);
LINK_ENTITY (player);
LINK_ENTITY (player_loadsaved);
LINK_ENTITY (player_weaponstrip);
LINK_ENTITY (soundent);
LINK_ENTITY (spark_shower);
LINK_ENTITY (speaker);
LINK_ENTITY (target_cdaudio);
LINK_ENTITY (test_effect);
LINK_ENTITY (trigger);
LINK_ENTITY (trigger_auto);
LINK_ENTITY (trigger_autosave);
LINK_ENTITY (trigger_camera);
LINK_ENTITY (trigger_cdaudio);
LINK_ENTITY (trigger_changelevel);
LINK_ENTITY (trigger_changetarget);
LINK_ENTITY (trigger_counter);
LINK_ENTITY (trigger_endsection);
LINK_ENTITY (trigger_gravity);
LINK_ENTITY (trigger_hurt);
LINK_ENTITY (trigger_monsterjump);
LINK_ENTITY (trigger_multiple);
LINK_ENTITY (trigger_once);
LINK_ENTITY (trigger_push);
LINK_ENTITY (trigger_relay);
LINK_ENTITY (trigger_teleport);
LINK_ENTITY (trigger_transition);
LINK_ENTITY (weapon_ak47);
LINK_ENTITY (weapon_aug);
LINK_ENTITY (weapon_awp);
LINK_ENTITY (weapon_c4);
LINK_ENTITY (weapon_deagle);
LINK_ENTITY (weapon_elite);
LINK_ENTITY (weapon_famas);
LINK_ENTITY (weapon_fiveseven);
LINK_ENTITY (weapon_flashbang);
LINK_ENTITY (weapon_g3sg1);
LINK_ENTITY (weapon_galil);
LINK_ENTITY (weapon_glock18);
LINK_ENTITY (weapon_hegrenade);
LINK_ENTITY (weapon_knife);
LINK_ENTITY (weapon_m249);
LINK_ENTITY (weapon_m3);
LINK_ENTITY (weapon_m4a1);
LINK_ENTITY (weapon_mac10);
LINK_ENTITY (weapon_mp5navy);
LINK_ENTITY (weapon_p228);
LINK_ENTITY (weapon_p90);
LINK_ENTITY (weapon_scout);
LINK_ENTITY (weapon_sg550);
LINK_ENTITY (weapon_sg552);
LINK_ENTITY (weapon_shield);
LINK_ENTITY (weapon_shieldgun);
LINK_ENTITY (weapon_smokegrenade);
LINK_ENTITY (weapon_tmp);
LINK_ENTITY (weapon_ump45);
LINK_ENTITY (weapon_usp);
LINK_ENTITY (weapon_xm1014);
LINK_ENTITY (weaponbox);
LINK_ENTITY (world_items);
LINK_ENTITY (worldspawn);
LINK_ENTITY (DelayedUse)
LINK_ENTITY (ambient_generic)
LINK_ENTITY (ammo_338magnum)
LINK_ENTITY (ammo_357sig)
LINK_ENTITY (ammo_45acp)
LINK_ENTITY (ammo_50ae)
LINK_ENTITY (ammo_556nato)
LINK_ENTITY (ammo_556natobox)
LINK_ENTITY (ammo_57mm)
LINK_ENTITY (ammo_762nato)
LINK_ENTITY (ammo_9mm)
LINK_ENTITY (ammo_buckshot)
LINK_ENTITY (armoury_entity)
LINK_ENTITY (beam)
LINK_ENTITY (bodyque)
LINK_ENTITY (button_target)
LINK_ENTITY (cycler)
LINK_ENTITY (cycler_prdroid)
LINK_ENTITY (cycler_sprite)
LINK_ENTITY (cycler_weapon)
LINK_ENTITY (cycler_wreckage)
LINK_ENTITY (env_beam)
LINK_ENTITY (env_beverage)
LINK_ENTITY (env_blood)
LINK_ENTITY (env_bombglow)
LINK_ENTITY (env_bubbles)
LINK_ENTITY (env_debris)
LINK_ENTITY (env_explosion)
LINK_ENTITY (env_fade)
LINK_ENTITY (env_funnel)
LINK_ENTITY (env_global)
LINK_ENTITY (env_glow)
LINK_ENTITY (env_laser)
LINK_ENTITY (env_lightning)
LINK_ENTITY (env_message)
LINK_ENTITY (env_rain)
LINK_ENTITY (env_render)
LINK_ENTITY (env_shake)
LINK_ENTITY (env_shooter)
LINK_ENTITY (env_snow)
LINK_ENTITY (env_sound)
LINK_ENTITY (env_spark)
LINK_ENTITY (env_sprite)
LINK_ENTITY (fireanddie)
LINK_ENTITY (func_bomb_target)
LINK_ENTITY (func_breakable)
LINK_ENTITY (func_button)
LINK_ENTITY (func_buyzone)
LINK_ENTITY (func_conveyor)
LINK_ENTITY (func_door)
LINK_ENTITY (func_door_rotating)
LINK_ENTITY (func_escapezone)
LINK_ENTITY (func_friction)
LINK_ENTITY (func_grencatch)
LINK_ENTITY (func_guntarget)
LINK_ENTITY (func_healthcharger)
LINK_ENTITY (func_hostage_rescue)
LINK_ENTITY (func_illusionary)
LINK_ENTITY (func_ladder)
LINK_ENTITY (func_monsterclip)
LINK_ENTITY (func_mortar_field)
LINK_ENTITY (func_pendulum)
LINK_ENTITY (func_plat)
LINK_ENTITY (func_platrot)
LINK_ENTITY (func_pushable)
LINK_ENTITY (func_rain)
LINK_ENTITY (func_recharge)
LINK_ENTITY (func_rot_button)
LINK_ENTITY (func_rotating)
LINK_ENTITY (func_snow)
LINK_ENTITY (func_tank)
LINK_ENTITY (func_tankcontrols)
LINK_ENTITY (func_tanklaser)
LINK_ENTITY (func_tankmortar)
LINK_ENTITY (func_tankrocket)
LINK_ENTITY (func_trackautochange)
LINK_ENTITY (func_trackchange)
LINK_ENTITY (func_tracktrain)
LINK_ENTITY (func_train)
LINK_ENTITY (func_traincontrols)
LINK_ENTITY (func_vehicle)
LINK_ENTITY (func_vehiclecontrols)
LINK_ENTITY (func_vip_safetyzone)
LINK_ENTITY (func_wall)
LINK_ENTITY (func_wall_toggle)
LINK_ENTITY (func_water)
LINK_ENTITY (func_weaponcheck)
LINK_ENTITY (game_counter)
LINK_ENTITY (game_counter_set)
LINK_ENTITY (game_end)
LINK_ENTITY (game_player_equip)
LINK_ENTITY (game_player_hurt)
LINK_ENTITY (game_player_team)
LINK_ENTITY (game_score)
LINK_ENTITY (game_team_master)
LINK_ENTITY (game_team_set)
LINK_ENTITY (game_text)
LINK_ENTITY (game_zone_player)
LINK_ENTITY (gibshooter)
LINK_ENTITY (grenade)
LINK_ENTITY (hostage_entity)
LINK_ENTITY (info_bomb_target)
LINK_ENTITY (info_hostage_rescue)
LINK_ENTITY (info_intermission)
LINK_ENTITY (info_landmark)
LINK_ENTITY (info_map_parameters)
LINK_ENTITY (info_null)
LINK_ENTITY (info_player_deathmatch)
LINK_ENTITY (info_player_start)
LINK_ENTITY (info_target)
LINK_ENTITY (info_teleport_destination)
LINK_ENTITY (info_vip_start)
LINK_ENTITY (infodecal)
LINK_ENTITY (item_airtank)
LINK_ENTITY (item_antidote)
LINK_ENTITY (item_assaultsuit)
LINK_ENTITY (item_battery)
LINK_ENTITY (item_healthkit)
LINK_ENTITY (item_kevlar)
LINK_ENTITY (item_longjump)
LINK_ENTITY (item_security)
LINK_ENTITY (item_sodacan)
LINK_ENTITY (item_suit)
LINK_ENTITY (item_thighpack)
LINK_ENTITY (light)
LINK_ENTITY (light_environment)
LINK_ENTITY (light_spot)
LINK_ENTITY (momentary_door)
LINK_ENTITY (momentary_rot_button)
LINK_ENTITY (monster_hevsuit_dead)
LINK_ENTITY (monster_mortar)
LINK_ENTITY (monster_scientist)
LINK_ENTITY (multi_manager)
LINK_ENTITY (multisource)
LINK_ENTITY (path_corner)
LINK_ENTITY (path_track)
LINK_ENTITY (player)
LINK_ENTITY (player_loadsaved)
LINK_ENTITY (player_weaponstrip)
LINK_ENTITY (soundent)
LINK_ENTITY (spark_shower)
LINK_ENTITY (speaker)
LINK_ENTITY (target_cdaudio)
LINK_ENTITY (test_effect)
LINK_ENTITY (trigger)
LINK_ENTITY (trigger_auto)
LINK_ENTITY (trigger_autosave)
LINK_ENTITY (trigger_camera)
LINK_ENTITY (trigger_cdaudio)
LINK_ENTITY (trigger_changelevel)
LINK_ENTITY (trigger_changetarget)
LINK_ENTITY (trigger_counter)
LINK_ENTITY (trigger_endsection)
LINK_ENTITY (trigger_gravity)
LINK_ENTITY (trigger_hurt)
LINK_ENTITY (trigger_monsterjump)
LINK_ENTITY (trigger_multiple)
LINK_ENTITY (trigger_once)
LINK_ENTITY (trigger_push)
LINK_ENTITY (trigger_relay)
LINK_ENTITY (trigger_teleport)
LINK_ENTITY (trigger_transition)
LINK_ENTITY (weapon_ak47)
LINK_ENTITY (weapon_aug)
LINK_ENTITY (weapon_awp)
LINK_ENTITY (weapon_c4)
LINK_ENTITY (weapon_deagle)
LINK_ENTITY (weapon_elite)
LINK_ENTITY (weapon_famas)
LINK_ENTITY (weapon_fiveseven)
LINK_ENTITY (weapon_flashbang)
LINK_ENTITY (weapon_g3sg1)
LINK_ENTITY (weapon_galil)
LINK_ENTITY (weapon_glock18)
LINK_ENTITY (weapon_hegrenade)
LINK_ENTITY (weapon_knife)
LINK_ENTITY (weapon_m249)
LINK_ENTITY (weapon_m3)
LINK_ENTITY (weapon_m4a1)
LINK_ENTITY (weapon_mac10)
LINK_ENTITY (weapon_mp5navy)
LINK_ENTITY (weapon_p228)
LINK_ENTITY (weapon_p90)
LINK_ENTITY (weapon_scout)
LINK_ENTITY (weapon_sg550)
LINK_ENTITY (weapon_sg552)
LINK_ENTITY (weapon_shield)
LINK_ENTITY (weapon_shieldgun)
LINK_ENTITY (weapon_smokegrenade)
LINK_ENTITY (weapon_tmp)
LINK_ENTITY (weapon_ump45)
LINK_ENTITY (weapon_usp)
LINK_ENTITY (weapon_xm1014)
LINK_ENTITY (weaponbox)
LINK_ENTITY (world_items)
LINK_ENTITY (worldspawn)

View file

@ -302,7 +302,7 @@ void BotManager::AddBot (const String &name, const String &difficulty, const Str
yb_quota.SetInt (GetBotsNum () + 1);
}
void BotManager::CheckAutoVacate (edict_t *ent)
void BotManager::CheckAutoVacate(void)
{
// this function sets timer to kick one bot off.
@ -858,7 +858,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
void Bot::ReleaseUsedName (void)
{
IterateArray (g_botNames, j)
FOR_EACH_AE (g_botNames, j)
{
BotName &name = g_botNames[j];
@ -951,7 +951,7 @@ void Bot::NewRound (void)
m_duckDefuse = false;
m_duckDefuseCheckTime = 0.0;
for (int i = 0; i < 5; i++)
for (i = 0; i < 5; i++)
m_prevWptIndex[i] = -1;
m_navTimeset = GetWorldTime ();

View file

@ -601,14 +601,14 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dir, const Vector &di
m_collStateIndex++;
m_probeTime = GetWorldTime () + 0.5;
if (m_collStateIndex > 5)
if (m_collStateIndex > MAX_COLLIDE_MOVES)
{
m_navTimeset = GetWorldTime () - 5.0;
ResetCollideState ();
}
}
if (m_collStateIndex <= MAX_COLLIDE_MOVES)
if (m_collStateIndex < MAX_COLLIDE_MOVES)
{
switch (m_collideMoves[m_collStateIndex])
{
@ -919,12 +919,12 @@ bool Bot::DoWaypointNav (void)
{
edict_t *button = FindNearestButton (STRING (m_liftEntity->v.targetname));
// lift is already used ?
bool liftUsed = false;
// if we got a valid button entity
if (!IsEntityNull (button))
{
// lift is already used ?
bool liftUsed = false;
// iterate though clients, and find if lift already used
for (int i = 0; i < GetMaxClients (); i++)
{
@ -1282,10 +1282,20 @@ public:
// inserts a value into the priority queue
inline void Push (int value, float pri)
{
if (m_heap == NULL)
return;
if (m_size >= m_heapSize)
{
m_heapSize += 100;
m_heap = static_cast <Node *> (realloc (m_heap, sizeof (Node) * m_heapSize));
Node *newHeap = static_cast <Node *> (realloc (m_heap, sizeof (Node) * m_heapSize));
if (newHeap != NULL)
{
m_heap = newHeap;
free (newHeap);
}
}
m_heap[m_size].pri = pri;
@ -1409,7 +1419,7 @@ float gfunctionKillsDistCTWithHostage (int currentIndex, int parentIndex)
return gfunctionKillsDistCT (currentIndex, parentIndex);
}
float gfunctionKillsT (int currentIndex, int parentIndex)
float gfunctionKillsT (int currentIndex, int)
{
// least kills to goal for a team
@ -1633,6 +1643,7 @@ void Bot::FindPath (int srcIndex, int destIndex, unsigned char pathType)
break;
case 2:
default:
if (m_team == TEAM_TF)
{
gcalc = gfunctionKillsT;
@ -2021,7 +2032,7 @@ int Bot::ChooseBombWaypoint (void)
float lastDistance = FLT_MAX;
// find nearest goal waypoint either to bomb (if "heard" or player)
IterateArray (goals, i)
FOR_EACH_AE (goals, i)
{
float distance = (g_waypoint->GetPath (goals[i])->origin - bombOrigin).GetLengthSquared ();
@ -2140,6 +2151,17 @@ int Bot::FindDefendWaypoint (const Vector &origin)
}
} while (isOrderChanged);
if (waypointIndex[0] == -1)
{
Array <int> found;
g_waypoint->FindInRadius (found, 1024.0f, origin);
if (found.IsEmpty ())
return Random.Long (0, g_numWaypoints - 1); // most worst case, since there a evil error in waypoints
return found.GetRandomElement ();
}
int index = 0;
for (; index < MAX_PATH_INDEX; index++)
@ -2196,7 +2218,7 @@ int Bot::FindCoverWaypoint (float maxDistance)
bool neighbourVisible = false; // now check neighbour waypoints for visibility
IterateArray (enemyIndices, j)
FOR_EACH_AE (enemyIndices, j)
{
if (g_waypoint->IsVisible (enemyIndices[j], i))
{
@ -2570,6 +2592,7 @@ bool Bot::CantMoveForward (const Vector &normal, TraceResult *tr)
return false; // bot can move forward, return false
}
#ifdef DEAD_CODE
bool Bot::CanStrafeLeft (TraceResult *tr)
{
// this function checks if bot can move sideways
@ -2628,6 +2651,8 @@ bool Bot::CanStrafeRight (TraceResult * tr)
return true;
}
#endif
bool Bot::CanJumpUp (const Vector &normal)
{
// this function check if bot can jump over some obstacle
@ -2826,6 +2851,8 @@ bool Bot::CanDuckUnder (const Vector &normal)
return tr.flFraction > 1.0;
}
#ifdef DEAD_CODE
bool Bot::IsBlockedLeft (void)
{
TraceResult tr;
@ -2866,6 +2893,8 @@ bool Bot::IsBlockedRight (void)
return false;
}
#endif
bool Bot::CheckWallOnLeft (void)
{
TraceResult tr;
@ -2943,6 +2972,8 @@ bool Bot::IsDeadlyDrop (const Vector &to)
return false;
}
#ifdef DEAD_CODE
void Bot::ChangePitch (float speed)
{
// this function turns a bot towards its ideal_pitch
@ -3023,6 +3054,8 @@ void Bot::ChangeYaw (float speed)
pev->angles.y = pev->v_angle.y;
}
#endif
int Bot::GetAimingWaypoint (void)
{
// Find a good WP to look at when camping
@ -3314,7 +3347,7 @@ bool Bot::IsPointOccupied (int index)
{
int occupyId = GetShootingConeDeviation (bot->GetEntity (), &pev->origin) >= 0.7f ? bot->m_prevWptIndex[0] : m_currentWaypointIndex;
if (occupyId == index || bot->GetTask ()->data == index || (g_waypoint->GetPath (occupyId)->origin - g_waypoint->GetPath (index)->origin).GetLengthSquared () < 8100)
if (occupyId == index || bot->GetTask ()->data == index || (g_waypoint->GetPath (occupyId)->origin - g_waypoint->GetPath (index)->origin).GetLengthSquared () < 4096.0f)
return true;
}
}

View file

@ -209,7 +209,7 @@ void NetworkMsg::Execute (void *p)
case 2:
damageBits = PTR_TO_INT (p);
if (m_bot && damageArmor > 0 || damageTaken > 0)
if (m_bot != NULL && (damageArmor > 0 || damageTaken > 0))
m_bot->TakeDamage (m_bot->pev->dmg_inflictor, damageTaken, damageArmor, damageBits);
break;
}

View file

@ -289,7 +289,7 @@ void FreeLibraryMemory (void)
// this function free's all allocated memory
g_waypoint->Init (); // frees waypoint data
IterateArray (g_localizer->m_langTab, it)
FOR_EACH_AE (g_localizer->m_langTab, it)
{
delete[] g_localizer->m_langTab[it].original;
delete[] g_localizer->m_langTab[it].translated;
@ -462,11 +462,7 @@ void strtrim (char *string)
for (i = length - 1; i >= 0; i--)
{
#if defined (PLATFORM_WIN32)
if (!iswspace (string[i]))
#else
if (!isspace (string[i]))
#endif
break;
else
{
@ -477,11 +473,7 @@ void strtrim (char *string)
for (i = 0; i < length; i++)
{
#if defined (PLATFORM_WIN32)
if (iswspace (string[i]) && !toggleFlag) // win32 crash fx
#else
if (isspace (string[i]) && !toggleFlag)
#endif
{
increment++;
@ -812,6 +804,17 @@ bool IsValidPlayer (edict_t *ent)
return false;
}
bool IsPlayerVIP (edict_t *ent)
{
if (!(g_mapType & MAP_AS))
return false;
if (!IsValidPlayer (ent))
return false;
return *(INFOKEY_VALUE (GET_INFOKEYBUFFER (ent), "model")) == 'v';
}
bool IsValidBot (edict_t *ent)
{
if (g_botManager->GetBot (ent) != NULL || (!IsEntityNull (ent) && (ent->v.flags & FL_FAKECLIENT)))
@ -943,7 +946,7 @@ const char *GetMapName (void)
return &mapName[0]; // and return a pointer to it
}
bool OpenConfig (const char *fileName, char *errorIfNotExists, File *outFile, bool languageDependant)
extern bool OpenConfig(const char *fileName, const char *errorIfNotExists, File *outFile, bool languageDependant /*= false*/)
{
if (outFile->IsValid ())
outFile->Close ();
@ -979,7 +982,7 @@ const char *GetWaypointDir (void)
return FormatBuffer ("%s/addons/yapb/data/", GetModName ());
}
void RegisterCommand (char *command, void funcPtr (void))
extern void RegisterCommand(const char *command, void funcPtr (void))
{
// this function tells the engine that a new server command is being declared, in addition
// to the standard ones, whose name is command_name. The engine is thus supposed to be aware
@ -989,7 +992,7 @@ void RegisterCommand (char *command, void funcPtr (void))
if (IsNullString (command) || funcPtr == NULL)
return; // reliability check
REG_SVR_COMMAND (command, funcPtr); // ask the engine to register this new command
REG_SVR_COMMAND (const_cast <char *> (command), funcPtr); // ask the engine to register this new command
}
void CheckWelcomeMessage (void)
@ -1221,11 +1224,11 @@ char *Localizer::TranslateInput (const char *input)
strncpy (string, input, 1024);
strtrim (string);
IterateArray (m_langTab, i)
FOR_EACH_AE (m_langTab, i)
{
if (strcmp (string, m_langTab[i].original) == 0)
{
strncpy (string, m_langTab[i].translated, 1024);
strncpy (string, m_langTab[i].translated, 1023);
if (ptr != input)
strncat (string, ptr, 1024 - 1 - strlen (string));
@ -1257,9 +1260,9 @@ bool FindNearestPlayer (void **pvHolder, edict_t *to, float searchDistance, bool
if ((sameTeam && g_clients[i].team != toTeam) || (isAlive && !(g_clients[i].flags & CF_ALIVE)) || (needBot && !IsValidBot (ent)) || (needDrawn && (ent->v.effects & EF_NODRAW)))
continue; // filter players with parameters
float distance = (ent->v.origin - to->v.origin).GetLengthSquared ();
float distance = (ent->v.origin - to->v.origin).GetLength ();
if (distance < nearestPlayer)
if (distance < nearestPlayer && distance < searchDistance)
{
nearestPlayer = distance;
survive = ent;
@ -1286,7 +1289,7 @@ void SoundAttachToThreat (edict_t *ent, const char *sample, float volume)
if (IsEntityNull (ent) || IsNullString (sample))
return; // reliability check
Vector origin = GetEntityOrigin (ent);
const Vector &origin = GetEntityOrigin (ent);
int index = IndexOfEntity (ent) - 1;
if (index < 0 || index >= GetMaxClients ())

View file

@ -507,7 +507,7 @@ void Waypoint::Delete (void)
delete m_paths[index];
m_paths[index] = NULL;
// Rotate Path Array down
// rotate path array down
for (i = index; i < g_numWaypoints - 1; i++)
m_paths[i] = m_paths[i + 1];
@ -1451,7 +1451,7 @@ bool Waypoint::IsStandVisible (int srcIndex, int destIndex)
return !((res & 1) == 1);
}
char *Waypoint::GetWaypointInfo (int id)
const char *Waypoint::GetWaypointInfo(int id)
{
// this function returns path information for waypoint pointed by id.
@ -1998,7 +1998,7 @@ bool Waypoint::NodesValid (void)
visited[current->index] = true;
IterateArray (outgoingPaths[current->index], p)
FOR_EACH_AE (outgoingPaths[current->index], p)
{
if (visited[outgoingPaths[current->index][p]])
continue; // skip this waypoint as it's already visited
@ -2179,7 +2179,7 @@ void Waypoint::SetGoalVisited (int index)
bool Waypoint::IsGoalVisited (int index)
{
IterateArray (m_visitedGoals, i)
FOR_EACH_AE (m_visitedGoals, i)
{
if (m_visitedGoals[i] == index)
return true;
@ -2511,10 +2511,13 @@ void WaypointDownloader::FreeSocket (int sock)
WaypointDownloadError WaypointDownloader::DoDownload (void)
{
#if defined (PLATFORM_WIN32)
WORD requestedVersion = MAKEWORD (1, 3);
WORD requestedVersion = MAKEWORD (1, 1);
WSADATA wsaData;
WSAStartup (requestedVersion, &wsaData);
int wsa = WSAStartup (requestedVersion, &wsaData);
if (wsa != 0)
return WDE_SOCKET_ERROR;
#endif
hostent *host = gethostbyname (yb_waypoint_autodl_host.GetString ());