minor changes
This commit is contained in:
parent
f9781342ae
commit
85e618fb1b
11 changed files with 61 additions and 42 deletions
|
|
@ -426,16 +426,15 @@ void Bot::AvoidGrenades (void)
|
|||
if (!EntityIsVisible (ent->v.origin) && InFieldOfView (ent->v.origin - EyePosition ()) > pev->fov * 0.5)
|
||||
continue;
|
||||
|
||||
// TODO: should be done once for grenade, instead of checking several times
|
||||
if (m_personality == PERSONALITY_RUSHER && m_difficulty == 4 && strcmp (STRING (ent->v.model) + 9, "flashbang.mdl") == 0)
|
||||
if (m_turnAwayFromFlashbang < GetWorldTime () && m_personality == PERSONALITY_RUSHER && m_difficulty == 4 && strcmp (STRING (ent->v.model) + 9, "flashbang.mdl") == 0)
|
||||
{
|
||||
const Vector &position = (GetEntityOrigin (ent) - EyePosition ()).ToAngles ();
|
||||
|
||||
// don't look at flash bang
|
||||
if (!(m_states & STATE_SEEING_ENEMY))
|
||||
{
|
||||
pev->v_angle.y = AngleNormalize (position.y + 180.0f);
|
||||
pev->v_angle.y = AngleNormalize ((GetEntityOrigin (ent) - EyePosition ()).ToAngles ().y + 180.0f);
|
||||
|
||||
m_canChooseAimDirection = false;
|
||||
m_turnAwayFromFlashbang = GetWorldTime () + Random.Float (1.0f, 2.0f);
|
||||
}
|
||||
}
|
||||
else if (strcmp (STRING (ent->v.model) + 9, "hegrenade.mdl") == 0)
|
||||
|
|
@ -1223,7 +1222,7 @@ void Bot::CheckMessageQueue (void)
|
|||
}
|
||||
|
||||
m_buyPending = false;
|
||||
m_nextBuyTime = GetWorldTime () + Random.Float (0.3, 0.8);
|
||||
m_nextBuyTime = GetWorldTime () + Random.Float (0.5f, 1.3f);
|
||||
|
||||
// if bot buying is off then no need to buy
|
||||
if (!yb_botbuy.GetBool ())
|
||||
|
|
@ -1416,7 +1415,7 @@ bool Bot::IsRestricted (int weaponIndex)
|
|||
// this function checks for weapon restrictions.
|
||||
|
||||
if (IsNullString (yb_restricted_weapons.GetString ()))
|
||||
return false; // no banned weapons
|
||||
return IsRestrictedAMX (weaponIndex); // no banned weapons
|
||||
|
||||
Array <String> bannedWeapons = String (yb_restricted_weapons.GetString ()).Split (';');
|
||||
|
||||
|
|
@ -1522,7 +1521,7 @@ void Bot::PurchaseWeapons (void)
|
|||
// this function does all the work in selecting correct buy menus for most weapons/items
|
||||
|
||||
WeaponSelect *selectedWeapon = NULL;
|
||||
m_nextBuyTime = GetWorldTime ();
|
||||
m_nextBuyTime = GetWorldTime () + Random.Float (0.3f, 0.5f);
|
||||
|
||||
int count = 0, foundWeapons = 0;
|
||||
int choices[NUM_WEAPONS];
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ void StripTags (char *buffer)
|
|||
{
|
||||
strtrim (buffer); // if so, string is just a tag
|
||||
|
||||
int tagLength = 0;
|
||||
int tagLength = 0;
|
||||
|
||||
// strip just the tag part...
|
||||
for (index = 0; index < ARRAYSIZE_HLSDK(tagOpen); index++)
|
||||
for (index = 0; index < ARRAYSIZE_HLSDK (tagOpen); index++)
|
||||
{
|
||||
fieldStart = strstr (buffer, tagOpen[index]) - buffer; // look for a tag start
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ void StripTags (char *buffer)
|
|||
|
||||
for (i = fieldStart; i < length - tagLength; i++)
|
||||
buffer[i] = buffer[i + tagLength]; // overwrite the buffer with the stripped string
|
||||
|
||||
|
||||
buffer[i] = 0; // terminate the string
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -585,6 +585,12 @@ bool Bot::DoFirePause (float distance, FireDelay *fireDelay)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (UsesPistol () && distance > 450.0f)
|
||||
{
|
||||
m_shootTime = GetWorldTime () + Random.Float (0.15f, 0.4f);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_firePause > GetWorldTime ())
|
||||
return true;
|
||||
|
||||
|
|
@ -613,6 +619,8 @@ bool Bot::DoFirePause (float distance, FireDelay *fireDelay)
|
|||
if (m_firePause < GetWorldTime () - 0.4f)
|
||||
m_firePause = GetWorldTime () + Random.Float (0.4f, 0.4f + 0.3f * ((100 - (m_difficulty * 25)) / 100.f));
|
||||
|
||||
m_burstShotsFired = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -866,7 +874,7 @@ WeaponSelectEnd:
|
|||
pev->button |= IN_ATTACK;
|
||||
|
||||
m_shootTime = GetWorldTime () + baseDelay + Random.Float (minDelay, maxDelay);
|
||||
m_zoomCheckTime = GetWorldTime ();
|
||||
m_zoomCheckTime = GetWorldTime () - 0.09f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2054,7 +2054,7 @@ void ServerActivate (edict_t *pentEdictList, int edictCount, int clientMax)
|
|||
// execute main config
|
||||
ServerCommand ("exec addons/yapb/conf/yapb.cfg");
|
||||
|
||||
if (TryFileOpen (FormatBuffer ("%s/maps/%s_yapb.cfg", GetModName (), GetMapName ())))
|
||||
if (File::Accessible (FormatBuffer ("%s/maps/%s_yapb.cfg", GetModName (), GetMapName ())))
|
||||
{
|
||||
ServerCommand ("exec maps/%s_yapb.cfg", GetMapName ());
|
||||
ServerPrint ("Executing Map-Specific config file");
|
||||
|
|
@ -3078,7 +3078,7 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
{
|
||||
ModSupport *mod = &s_supportedMods[i];
|
||||
|
||||
if (strcmp (mod->name, GetModName ()) == 0 && TryFileOpen (FormatBuffer ("%s/dlls/%s", mod->name,
|
||||
if (strcmp (mod->name, GetModName ()) == 0 && File::Accessible (FormatBuffer ("%s/dlls/%s", mod->name,
|
||||
#if defined (PLATFORM_WIN32)
|
||||
mod->winLib
|
||||
#elif defined (PLATFORM_LINUX)
|
||||
|
|
|
|||
|
|
@ -818,7 +818,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
memset (&m_ammo, 0, sizeof (m_ammo));
|
||||
|
||||
m_currentWeapon = 0; // current weapon is not assigned at start
|
||||
m_voicePitch = Random.Long (166, 250) * 0.5; // assign voice pitch
|
||||
m_voicePitch = Random.Long (80, 115); // assign voice pitch
|
||||
|
||||
// copy them over to the temp level variables
|
||||
m_agressionLevel = m_baseAgressionLevel;
|
||||
|
|
@ -960,6 +960,7 @@ void Bot::NewRound (void)
|
|||
m_isLeader = false;
|
||||
m_hasProgressBar = false;
|
||||
m_canChooseAimDirection = true;
|
||||
m_turnAwayFromFlashbang = 0.0f;
|
||||
|
||||
m_timeTeamOrder = 0.0;
|
||||
m_askCheckTime = 0.0;
|
||||
|
|
@ -1059,8 +1060,8 @@ void Bot::NewRound (void)
|
|||
m_currentWeapon = 0;
|
||||
}
|
||||
|
||||
m_knifeAttackTime = GetWorldTime () + Random.Float (1.3, 2.6);
|
||||
m_nextBuyTime = GetWorldTime () + Random.Float (0.6, 1.2);
|
||||
m_knifeAttackTime = GetWorldTime () + Random.Float (1.3f, 2.6f);
|
||||
m_nextBuyTime = GetWorldTime () + Random.Float (0.6f, 2.0f);
|
||||
|
||||
m_buyPending = false;
|
||||
m_inBombZone = false;
|
||||
|
|
|
|||
|
|
@ -659,6 +659,15 @@ bool Bot::DoWaypointNav (void)
|
|||
|
||||
TraceResult tr, tr2;
|
||||
|
||||
// check if we fallen from something
|
||||
if (IsOnFloor () && m_jumpFinished && m_currentWaypointIndex > 0)
|
||||
{
|
||||
const Vector &wptOrg = m_currentPath->origin;
|
||||
|
||||
if ((pev->origin - wptOrg).GetLength2D () <= 100.0f && (wptOrg.z > pev->origin.z + 20.0f))
|
||||
m_currentWaypointIndex = -1;
|
||||
}
|
||||
|
||||
// check if we need to find a waypoint...
|
||||
if (m_currentWaypointIndex == -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -830,21 +830,6 @@ bool IsDedicatedServer (void)
|
|||
return (IS_DEDICATED_SERVER () > 0); // ask engine for this
|
||||
}
|
||||
|
||||
bool TryFileOpen (const char *fileName)
|
||||
{
|
||||
// this function tests if a file exists by attempting to open it
|
||||
|
||||
File fp;
|
||||
|
||||
// check if got valid handle
|
||||
if (fp.Open (fileName, "rb"))
|
||||
{
|
||||
fp.Close ();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ServerPrint (const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
@ -961,7 +946,7 @@ extern bool OpenConfig(const char *fileName, const char *errorIfNotExists, File
|
|||
const char *languageDependantConfigFile = FormatBuffer ("%s/addons/yapb/conf/lang/%s_%s", GetModName (), yb_language.GetString (), fileName);
|
||||
|
||||
// check is file is exists for this language
|
||||
if (TryFileOpen (languageDependantConfigFile))
|
||||
if (File::Accessible (languageDependantConfigFile))
|
||||
outFile->Open (languageDependantConfigFile, "rt");
|
||||
else
|
||||
outFile->Open (FormatBuffer ("%s/addons/yapb/conf/lang/en_%s", GetModName (), fileName), "rt");
|
||||
|
|
|
|||
|
|
@ -149,12 +149,12 @@ void Waypoint::FindInRadius (const Vector &origin, float radius, int *holdTab, i
|
|||
*count -= 1;
|
||||
}
|
||||
|
||||
void Waypoint::FindInRadius (Array <int> &queueID, float radius, const Vector &origin)
|
||||
void Waypoint::FindInRadius (Array <int> &radiusHolder, float radius, const Vector &origin)
|
||||
{
|
||||
for (int i = 0; i < g_numWaypoints; i++)
|
||||
{
|
||||
if ((m_paths[i]->origin - origin).GetLength () <= radius)
|
||||
queueID.Push (i);
|
||||
radiusHolder.Push (i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1262,7 +1262,7 @@ String Waypoint::CheckSubfolderFile (void)
|
|||
|
||||
returnFile = FormatBuffer ("%s%s%s.pwf", GetWaypointDir (), returnFile.GetBuffer (), GetMapName ());
|
||||
|
||||
if (TryFileOpen (returnFile))
|
||||
if (File::Accessible (returnFile))
|
||||
return returnFile;
|
||||
|
||||
return FormatBuffer ("%s%s.pwf", GetWaypointDir (), GetMapName ());
|
||||
|
|
@ -2412,7 +2412,7 @@ void Waypoint::EraseFromHardDisk (void)
|
|||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (TryFileOpen (const_cast <char *> (deleteList[i].GetBuffer ())))
|
||||
if (File::Accessible (const_cast <char *> (deleteList[i].GetBuffer ())))
|
||||
{
|
||||
unlink (deleteList[i].GetBuffer ());
|
||||
AddLogEntry (true, LL_DEFAULT, "File %s, has been deleted from the hard disk", deleteList[i].GetBuffer ());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue