fixed crash, when official csbots active
fixed baaaad waypoint dislpaying fixed bots equip in buyzone when has active enemy bots try to do their goals more ofter (again) fixed some issues with knife maps
This commit is contained in:
parent
9f02b92ee2
commit
64445029c7
9 changed files with 80 additions and 63 deletions
|
|
@ -56,13 +56,14 @@ enum TaskID
|
|||
};
|
||||
|
||||
// supported cs's
|
||||
enum CSVersion
|
||||
enum GameFlags
|
||||
{
|
||||
CSVERSION_CSTRIKE16 = (1 << 0), // Counter-Strike 1.6 and Above
|
||||
CSVERSION_XASH = (1 << 1), // Counter-Strike 1.6 under the xash engine (additional flag)
|
||||
CSVERSION_CZERO = (1 << 2), // Counter-Strike: Condition Zero
|
||||
CSVERSION_LEGACY = (1 << 3), // Counter-Strike 1.3-1.5 with/without Steam
|
||||
CSVERSION_MOBILITY = (1 << 4) // additional flag that bot is running on android (additional flag)
|
||||
GAME_CSTRIKE16 = (1 << 0), // Counter-Strike 1.6 and Above
|
||||
GAME_XASH = (1 << 1), // Counter-Strike 1.6 under the xash engine (additional flag)
|
||||
GAME_CZERO = (1 << 2), // Counter-Strike: Condition Zero
|
||||
GAME_LEGACY = (1 << 3), // Counter-Strike 1.3-1.5 with/without Steam
|
||||
GAME_MOBILITY = (1 << 4), // additional flag that bot is running on android (additional flag)
|
||||
GAME_OFFICIAL_CSBOT = (1 << 5) // additional flag that indicates offficial cs bots are ingame
|
||||
};
|
||||
|
||||
// log levels
|
||||
|
|
@ -1104,7 +1105,8 @@ public:
|
|||
|
||||
edict_t *m_enemy; // pointer to enemy entity
|
||||
float m_enemyUpdateTime; // time to check for new enemies
|
||||
float m_enemyReachableTimer; // time to recheck if Enemy reachable
|
||||
float m_enemyReachableTimer; // time to recheck if enemy reachable
|
||||
float m_enemyIgnoreTimer; // ignore enemy for some time
|
||||
bool m_isEnemyReachable; // direct line to enemy
|
||||
|
||||
float m_seeEnemyTime; // time bot sees enemy
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ extern float g_lastRadioTime[2];
|
|||
|
||||
extern int g_mapType;
|
||||
extern int g_numWaypoints;
|
||||
extern int g_gameVersion;
|
||||
extern int g_gameFlags;
|
||||
extern int g_fakeArgc;
|
||||
|
||||
extern int g_highestDamageCT;
|
||||
|
|
|
|||
|
|
@ -963,7 +963,7 @@ void Bot::SwitchChatterIcon (bool show)
|
|||
{
|
||||
// this function depending on show boolen, shows/remove chatter, icon, on the head of bot.
|
||||
|
||||
if ((g_gameVersion & CSVERSION_LEGACY) || yb_communication_type.GetInt () != 2)
|
||||
if ((g_gameFlags & GAME_LEGACY) || yb_communication_type.GetInt () != 2)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < GetMaxClients (); i++)
|
||||
|
|
@ -982,7 +982,7 @@ void Bot::InstantChatterMessage (int type)
|
|||
{
|
||||
// this function sends instant chatter messages.
|
||||
|
||||
if (yb_communication_type.GetInt () != 2 || g_chatterFactory[type].IsEmpty () || (g_gameVersion & CSVERSION_LEGACY) || !g_sendAudioFinished)
|
||||
if (yb_communication_type.GetInt () != 2 || g_chatterFactory[type].IsEmpty () || (g_gameFlags & GAME_LEGACY) || !g_sendAudioFinished)
|
||||
return;
|
||||
|
||||
if (m_notKilled)
|
||||
|
|
@ -1033,7 +1033,7 @@ void Bot::RadioMessage (int message)
|
|||
if (yb_communication_type.GetInt () == 0 || m_numFriendsLeft == 0)
|
||||
return;
|
||||
|
||||
if (g_chatterFactory[message].IsEmpty () || (g_gameVersion & CSVERSION_LEGACY) || yb_communication_type.GetInt () != 2)
|
||||
if (g_chatterFactory[message].IsEmpty () || (g_gameFlags & GAME_LEGACY) || yb_communication_type.GetInt () != 2)
|
||||
g_radioInsteadVoice = true; // use radio instead voice
|
||||
|
||||
m_radioSelect = message;
|
||||
|
|
@ -1044,7 +1044,7 @@ void Bot::ChatterMessage (int message)
|
|||
{
|
||||
// this function inserts the voice message into the message queue (mostly same as above)
|
||||
|
||||
if ((g_gameVersion & CSVERSION_LEGACY) || yb_communication_type.GetInt () != 2 || g_chatterFactory[message].IsEmpty () || m_numFriendsLeft == 0)
|
||||
if ((g_gameFlags & GAME_LEGACY) || yb_communication_type.GetInt () != 2 || g_chatterFactory[message].IsEmpty () || m_numFriendsLeft == 0)
|
||||
return;
|
||||
|
||||
bool shouldExecute = false;
|
||||
|
|
@ -1245,7 +1245,7 @@ void Bot::CheckMessageQueue (void)
|
|||
}
|
||||
}
|
||||
|
||||
if ((m_radioSelect != Radio_ReportingIn && g_radioInsteadVoice) || yb_communication_type.GetInt () != 2 || g_chatterFactory[m_radioSelect].IsEmpty () || (g_gameVersion & CSVERSION_LEGACY))
|
||||
if ((m_radioSelect != Radio_ReportingIn && g_radioInsteadVoice) || yb_communication_type.GetInt () != 2 || g_chatterFactory[m_radioSelect].IsEmpty () || (g_gameFlags & GAME_LEGACY))
|
||||
{
|
||||
if (m_radioSelect < Radio_GoGoGo)
|
||||
FakeClientCommand (GetEntity (), "radio1");
|
||||
|
|
@ -1412,7 +1412,7 @@ void Bot::PurchaseWeapons (void)
|
|||
|
||||
|
||||
// do this, because xash engine is not capable to run all the features goldsrc, but we have cs 1.6 on it, so buy table must be the same
|
||||
bool isOldGame = (g_gameVersion & CSVERSION_LEGACY) && !(g_gameVersion & CSVERSION_XASH);
|
||||
bool isOldGame = (g_gameFlags & GAME_LEGACY) && !(g_gameFlags & GAME_XASH);
|
||||
|
||||
switch (m_buyState)
|
||||
{
|
||||
|
|
@ -1810,14 +1810,21 @@ void Bot::SetConditionsOverride (void)
|
|||
// special handling, if we have a knife in our hands
|
||||
if (m_currentWeapon == WEAPON_KNIFE && IsValidPlayer (m_enemy) && (GetTaskId () != TASK_MOVETOPOSITION || GetTask ()->desire != TASKPRI_HIDE))
|
||||
{
|
||||
if ((pev->origin - m_enemy->v.origin).GetLength2D () > 100.0f && (m_states & STATE_SEEING_ENEMY))
|
||||
float length = (pev->origin - m_enemy->v.origin).GetLength2D ();
|
||||
|
||||
// do waypoint movement if enemy is not reacheable with a knife
|
||||
if (length > 100.0f && (m_states & STATE_SEEING_ENEMY))
|
||||
{
|
||||
int nearestToEnemyPoint = waypoints.FindNearest (m_enemy->v.origin);
|
||||
|
||||
if (nearestToEnemyPoint != -1 && nearestToEnemyPoint != m_currentWaypointIndex && fabsf (waypoints.GetPath (nearestToEnemyPoint)->origin.z - m_enemy->v.origin.z) < 16.0f)
|
||||
{
|
||||
PushTask (TASK_MOVETOPOSITION, TASKPRI_HIDE, nearestToEnemyPoint, GetWorldTime () + Random.Float (5.0f, 10.0f), true);
|
||||
|
||||
m_isEnemyReachable = false;
|
||||
m_enemy = NULL;
|
||||
|
||||
m_enemyIgnoreTimer = GetWorldTime () + ((length / pev->maxspeed) * 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2004,7 +2011,7 @@ void Bot::ApplyTaskFilters (void)
|
|||
g_taskFilters[TASK_ATTACK].desire = 0.0f;
|
||||
|
||||
// calculate desires to seek cover or hunt
|
||||
if (IsValidPlayer (m_lastEnemy) && !m_lastEnemyOrigin.IsZero ())
|
||||
if (IsValidPlayer (m_lastEnemy) && !m_lastEnemyOrigin.IsZero () && !m_hasC4)
|
||||
{
|
||||
float distance = (m_lastEnemyOrigin - pev->origin).GetLength ();
|
||||
|
||||
|
|
@ -3196,10 +3203,16 @@ void Bot::RunTask_Normal (void)
|
|||
}
|
||||
else if (m_team == CT)
|
||||
{
|
||||
if (!g_bombPlanted && GetNearbyFriendsNearPosition (pev->origin, 360.0f) < 4 && m_personality != PERSONALITY_RUSHER)
|
||||
if (!g_bombPlanted && GetNearbyFriendsNearPosition (pev->origin, 210.0f) < 4)
|
||||
{
|
||||
int index = FindDefendWaypoint (m_currentPath->origin);
|
||||
|
||||
float campTime = Random.Float (25.0f, 40.f);
|
||||
|
||||
// rusher bots don't like to camp too much
|
||||
if (m_personality == PERSONALITY_RUSHER)
|
||||
campTime *= 0.5f;
|
||||
|
||||
PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (25.0, 40.0), true); // push camp task on to stack
|
||||
PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + Random.Float (5.0f, 11.0f), true); // push move command
|
||||
|
||||
|
|
@ -6026,7 +6039,7 @@ void Bot::EquipInBuyzone (int buyCount)
|
|||
checkBuyTime = (g_timeRoundStart + Random.Float (10.0f, 20.0f) + mp_buytime.GetFloat () < GetWorldTime ());
|
||||
|
||||
// if bot is in buy zone, try to buy ammo for this weapon...
|
||||
if (m_lastEquipTime + 15.0f < GetWorldTime () && m_inBuyZone && checkBuyTime && !g_bombPlanted && m_moneyAmount > g_botBuyEconomyTable[0])
|
||||
if (m_seeEnemyTime + 5.0f < GetWorldTime () && m_lastEquipTime + 15.0f < GetWorldTime () && m_inBuyZone && checkBuyTime && !g_bombPlanted && m_moneyAmount > g_botBuyEconomyTable[0])
|
||||
{
|
||||
m_buyingFinished = false;
|
||||
m_buyState = buyCount;
|
||||
|
|
|
|||
|
|
@ -290,14 +290,14 @@ void Bot::PrepareChatMessage (char *text)
|
|||
}
|
||||
else if (*pattern == 'd')
|
||||
{
|
||||
if (g_gameVersion == CSVERSION_CZERO)
|
||||
if (g_gameFlags == GAME_CZERO)
|
||||
{
|
||||
if (Random.Long (1, 100) < 30)
|
||||
strcat (m_tempStrings, "CZ");
|
||||
else
|
||||
strcat (m_tempStrings, "Condition Zero");
|
||||
}
|
||||
else if (g_gameVersion == CSVERSION_CSTRIKE16 || g_gameVersion == CSVERSION_LEGACY)
|
||||
else if (g_gameFlags == GAME_CSTRIKE16 || g_gameFlags == GAME_LEGACY)
|
||||
{
|
||||
if (Random.Long (1, 100) < 30)
|
||||
strcat (m_tempStrings, "CS");
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
|
|||
if (IsEnemyHiddenByRendering (target))
|
||||
{
|
||||
*bodyPart = 0;
|
||||
origin->Zero();
|
||||
origin->Zero ();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ bool Bot::LookupEnemy (void)
|
|||
// this function tries to find the best suitable enemy for the bot
|
||||
|
||||
// do not search for enemies while we're blinded, or shooting disabled by user
|
||||
if (m_blindTime > GetWorldTime () || yb_ignore_enemies.GetBool ())
|
||||
if (m_enemyIgnoreTimer > GetWorldTime () || m_blindTime > GetWorldTime () || yb_ignore_enemies.GetBool ())
|
||||
return false;
|
||||
|
||||
edict_t *player, *newEnemy = NULL;
|
||||
|
|
@ -269,10 +269,6 @@ bool Bot::LookupEnemy (void)
|
|||
if (!ENGINE_CHECK_VISIBILITY (player, pvs))
|
||||
continue;
|
||||
|
||||
// skip glowed players, in free for all mode, we can't hit them
|
||||
if (player->v.renderfx == kRenderFxGlowShell && yb_csdm_mode.GetInt () >= 1)
|
||||
continue;
|
||||
|
||||
// do some blind by smoke grenade
|
||||
if (m_blindRecognizeTime < GetWorldTime () && IsBehindSmokeClouds (player))
|
||||
{
|
||||
|
|
@ -1115,7 +1111,7 @@ void Bot::CombatFight (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (m_fightStyle == 0 || ((pev->button & IN_RELOAD) || m_isReloading) || (UsesPistol () && distance < 400.0f))
|
||||
if (m_fightStyle == 0 || ((pev->button & IN_RELOAD) || m_isReloading) || (UsesPistol () && distance < 400.0f) || m_currentWeapon == WEAPON_KNIFE)
|
||||
{
|
||||
if (m_strafeSetTime < GetWorldTime ())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ int g_lastRadio[2];
|
|||
int g_storeAddbotVars[4];
|
||||
int g_radioSelect[32];
|
||||
int g_fakeArgc = 0;
|
||||
int g_gameVersion = 0;
|
||||
int g_gameFlags = 0;
|
||||
int g_numWaypoints = 0;
|
||||
int g_mapType = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ void InitConfig (void)
|
|||
}
|
||||
|
||||
// CHATTER SYSTEM INITIALIZATION
|
||||
if (OpenConfig ("chatter.cfg", "Couldn't open chatter system configuration", &fp) && !(g_gameVersion & CSVERSION_LEGACY) && yb_communication_type.GetInt () == 2)
|
||||
if (OpenConfig ("chatter.cfg", "Couldn't open chatter system configuration", &fp) && !(g_gameFlags & GAME_LEGACY) && yb_communication_type.GetInt () == 2)
|
||||
{
|
||||
Array <String> array;
|
||||
|
||||
|
|
@ -831,7 +831,7 @@ void InitConfig (void)
|
|||
}
|
||||
|
||||
// LOCALIZER INITITALIZATION
|
||||
if (OpenConfig ("lang.cfg", "Specified language not found", &fp, true) && !(g_gameVersion & CSVERSION_LEGACY))
|
||||
if (OpenConfig ("lang.cfg", "Specified language not found", &fp, true) && !(g_gameFlags & GAME_LEGACY))
|
||||
{
|
||||
if (IsDedicatedServer ())
|
||||
return; // dedicated server will use only english translation
|
||||
|
|
@ -881,7 +881,7 @@ void InitConfig (void)
|
|||
}
|
||||
fp.Close ();
|
||||
}
|
||||
else if (g_gameVersion & CSVERSION_LEGACY)
|
||||
else if (g_gameFlags & GAME_LEGACY)
|
||||
AddLogEntry (true, LL_DEFAULT, "Multilingual system disabled, due to your Counter-Strike Version!");
|
||||
else if (strcmp (yb_language.GetString (), "en") != 0)
|
||||
AddLogEntry (true, LL_ERROR, "Couldn't load language configuration");
|
||||
|
|
@ -922,20 +922,20 @@ void GameDLLInit (void)
|
|||
// print game detection info
|
||||
String gameVersionStr;
|
||||
|
||||
if (g_gameVersion & CSVERSION_LEGACY)
|
||||
if (g_gameFlags & GAME_LEGACY)
|
||||
gameVersionStr.Assign ("Legacy");
|
||||
|
||||
else if (g_gameVersion & CSVERSION_CZERO)
|
||||
else if (g_gameFlags & GAME_CZERO)
|
||||
gameVersionStr.Assign ("Condition Zero");
|
||||
|
||||
else if (g_gameVersion & CSVERSION_CSTRIKE16)
|
||||
else if (g_gameFlags & GAME_CSTRIKE16)
|
||||
gameVersionStr.Assign ("v1.6");
|
||||
|
||||
if (g_gameVersion & CSVERSION_XASH)
|
||||
if (g_gameFlags & GAME_XASH)
|
||||
{
|
||||
gameVersionStr.Append (" @ Xash3D Engine");
|
||||
|
||||
if (g_gameVersion & CSVERSION_MOBILITY)
|
||||
if (g_gameFlags & GAME_MOBILITY)
|
||||
gameVersionStr.Append (" Mobile");
|
||||
|
||||
gameVersionStr.Replace ("Legacy", "1.6 Limited");
|
||||
|
|
@ -1019,10 +1019,15 @@ int Spawn (edict_t *ent)
|
|||
RoundInit ();
|
||||
|
||||
g_mapType = NULL; // reset map type as worldspawn is the first entity spawned
|
||||
|
||||
|
||||
// detect official csbots here, as they causing crash in linkent code when active for some reason
|
||||
if (!(g_gameFlags & GAME_LEGACY) && g_engfuncs.pfnCVarGetPointer ("bot_stop") != NULL)
|
||||
g_gameFlags |= GAME_OFFICIAL_CSBOT;
|
||||
}
|
||||
else if (strcmp (entityClassname, "player_weaponstrip") == 0)
|
||||
{
|
||||
if ((g_gameVersion & CSVERSION_LEGACY) && (STRING (ent->v.target))[0] == '0')
|
||||
if ((g_gameFlags & GAME_LEGACY) && (STRING (ent->v.target))[0] == '0')
|
||||
ent->v.target = ent->v.targetname = ALLOC_STRING ("fake");
|
||||
else
|
||||
{
|
||||
|
|
@ -2425,12 +2430,12 @@ void pfnMessageBegin (int msgDest, int msgType, const float *origin, edict_t *ed
|
|||
netmsg.SetId (NETMSG_SAYTEXT, GET_USER_MSG_ID (PLID, "SayText", NULL));
|
||||
netmsg.SetId (NETMSG_RESETHUD, GET_USER_MSG_ID (PLID, "ResetHUD", NULL));
|
||||
|
||||
if (!(g_gameVersion & CSVERSION_LEGACY))
|
||||
if (!(g_gameFlags & GAME_LEGACY))
|
||||
netmsg.SetId (NETMSG_BOTVOICE, GET_USER_MSG_ID (PLID, "BotVoice", NULL));
|
||||
}
|
||||
netmsg.Reset ();
|
||||
|
||||
if (msgDest == MSG_SPEC && msgType == netmsg.GetId (NETMSG_HLTV) && !(g_gameVersion & CSVERSION_LEGACY))
|
||||
if (msgDest == MSG_SPEC && msgType == netmsg.GetId (NETMSG_HLTV) && !(g_gameFlags & GAME_LEGACY))
|
||||
netmsg.SetMessage (NETMSG_HLTV);
|
||||
|
||||
netmsg.HandleMessageIfRequired (msgType, NETMSG_WEAPONLIST);
|
||||
|
|
@ -3060,7 +3065,7 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
convars.PushRegisteredConVarsToEngine ();
|
||||
|
||||
#ifdef PLATFORM_ANDROID
|
||||
g_gameVersion |= (CSVERSION_LEGACY | CSVERSION_XASH | CSVERSION_MOBILITY);
|
||||
g_gameFlags |= (GAME_LEGACY | GAME_XASH | GAME_MOBILITY);
|
||||
|
||||
if (g_isMetamod)
|
||||
return; // we should stop the attempt for loading the real gamedll, since metamod handle this for us
|
||||
|
|
@ -3089,13 +3094,13 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
int modType;
|
||||
} s_supportedMods[] =
|
||||
{
|
||||
{ "cstrike", "cs_i386.so", "cs.dylib", "mp.dll", "Counter-Strike v1.6", CSVERSION_CSTRIKE16 },
|
||||
{ "cstrike", "cs.so", "cs.dylib", "mp.dll", "Counter-Strike v1.6 (Newer)", CSVERSION_CSTRIKE16 },
|
||||
{ "czero", "cs_i386.so", "cs.dylib", "mp.dll", "Counter-Strike: Condition Zero", CSVERSION_CZERO },
|
||||
{ "czero", "cs.so", "cs.dylib", "mp.dll", "Counter-Strike: Condition Zero (Newer)", CSVERSION_CZERO },
|
||||
{ "csv15", "cs_i386.so", "cs.dylib", "mp.dll", "CS 1.5 for Steam", CSVERSION_LEGACY },
|
||||
{ "csdm", "cs_i386.so", "cs.dylib", "mp.dll", "CSDM for Windows", CSVERSION_LEGACY },
|
||||
{ "cs13", "cs_i386.so", "cs.dylib", "mp.dll", "Counter-Strike v1.3", CSVERSION_LEGACY }, // assume cs13 = cs15
|
||||
{ "cstrike", "cs_i386.so", "cs.dylib", "mp.dll", "Counter-Strike v1.6", GAME_CSTRIKE16 },
|
||||
{ "cstrike", "cs.so", "cs.dylib", "mp.dll", "Counter-Strike v1.6 (Newer)", GAME_CSTRIKE16 },
|
||||
{ "czero", "cs_i386.so", "cs.dylib", "mp.dll", "Counter-Strike: Condition Zero", GAME_CZERO },
|
||||
{ "czero", "cs.so", "cs.dylib", "mp.dll", "Counter-Strike: Condition Zero (Newer)", GAME_CZERO },
|
||||
{ "csv15", "cs_i386.so", "cs.dylib", "mp.dll", "CS 1.5 for Steam", GAME_LEGACY },
|
||||
{ "csdm", "cs_i386.so", "cs.dylib", "mp.dll", "CSDM for Windows", GAME_LEGACY },
|
||||
{ "cs13", "cs_i386.so", "cs.dylib", "mp.dll", "Counter-Strike v1.3", GAME_LEGACY }, // assume cs13 = cs15
|
||||
};
|
||||
|
||||
ModSupport *knownMod = NULL;
|
||||
|
|
@ -3121,7 +3126,7 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
|
||||
if (knownMod != NULL)
|
||||
{
|
||||
g_gameVersion |= knownMod->modType;
|
||||
g_gameFlags |= knownMod->modType;
|
||||
|
||||
if (g_isMetamod)
|
||||
return; // we should stop the attempt for loading the real gamedll, since metamod handle this for us
|
||||
|
|
@ -3232,7 +3237,7 @@ void ConVarWrapper::PushRegisteredConVarsToEngine (bool gameVars)
|
|||
static void LinkEntity_Helper (EntityPtr_t &entAddress, const char *name, entvars_t *pev)
|
||||
{
|
||||
// here we're see an ugliest hack :)
|
||||
if (entAddress == NULL || (g_gameVersion & CSVERSION_CZERO))
|
||||
if (entAddress == NULL || (g_gameFlags & GAME_OFFICIAL_CSBOT))
|
||||
entAddress = g_gameLib->GetFuncAddr <EntityPtr_t > (name);
|
||||
|
||||
if (entAddress == NULL)
|
||||
|
|
|
|||
|
|
@ -874,7 +874,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
char *buffer = GET_INFOKEYBUFFER (bot);
|
||||
SET_CLIENT_KEYVALUE (clientIndex, buffer, "_vgui_menus", "0");
|
||||
|
||||
if (!(g_gameVersion & CSVERSION_LEGACY) && yb_latency_display.GetInt () == 1)
|
||||
if (!(g_gameFlags & GAME_LEGACY) && yb_latency_display.GetInt () == 1)
|
||||
SET_CLIENT_KEYVALUE (clientIndex, buffer, "*bot", "1");
|
||||
|
||||
rejectReason[0] = 0; // reset the reject reason template string
|
||||
|
|
@ -1135,6 +1135,7 @@ void Bot::NewRound (void)
|
|||
|
||||
m_buttonPushTime = 0.0f;
|
||||
m_enemyUpdateTime = 0.0f;
|
||||
m_enemyIgnoreTimer = 0.0f;
|
||||
m_seeEnemyTime = 0.0f;
|
||||
m_shootAtDeadTime = 0.0f;
|
||||
m_oldCombatDesire = 0.0f;
|
||||
|
|
@ -1252,7 +1253,7 @@ void Bot::NewRound (void)
|
|||
|
||||
const float interval = (1.0f / 30.0f) * Random.Float (0.95f, 1.05f);
|
||||
|
||||
if (g_gameVersion & CSVERSION_LEGACY)
|
||||
if (g_gameFlags & GAME_LEGACY)
|
||||
m_thinkInterval = 0.0f;
|
||||
else
|
||||
m_thinkInterval = interval;
|
||||
|
|
@ -1320,7 +1321,7 @@ void Bot::StartGame (void)
|
|||
{
|
||||
m_startAction = GSM_IDLE; // switch back to idle
|
||||
|
||||
if (g_gameVersion & CSVERSION_CZERO) // czero has spetsnaz and militia skins
|
||||
if (g_gameFlags & GAME_CZERO) // czero has spetsnaz and militia skins
|
||||
{
|
||||
if (m_wantedClass < 1 || m_wantedClass > 5)
|
||||
m_wantedClass = Random.Long (1, 5); // use random if invalid
|
||||
|
|
@ -1345,7 +1346,7 @@ void Bot::StartGame (void)
|
|||
|
||||
void BotManager::CalculatePingOffsets (void)
|
||||
{
|
||||
if ((g_gameVersion & CSVERSION_LEGACY) || yb_latency_display.GetInt () != 2)
|
||||
if ((g_gameFlags & GAME_LEGACY) || yb_latency_display.GetInt () != 2)
|
||||
return;
|
||||
|
||||
int averagePing = 0;
|
||||
|
|
@ -1405,7 +1406,7 @@ void BotManager::CalculatePingOffsets (void)
|
|||
|
||||
void BotManager::SendPingDataOffsets (edict_t *to)
|
||||
{
|
||||
if ((g_gameVersion & CSVERSION_LEGACY) || yb_latency_display.GetInt () != 2 || IsEntityNull (to))
|
||||
if ((g_gameFlags & GAME_LEGACY) || yb_latency_display.GetInt () != 2 || IsEntityNull (to))
|
||||
return;
|
||||
|
||||
if (!(to->v.flags & FL_CLIENT) && !(((to->v.button & IN_SCORE) || !(to->v.oldbuttons & IN_SCORE))))
|
||||
|
|
|
|||
|
|
@ -136,9 +136,9 @@ bool IsVisible (const Vector &origin, edict_t *ent)
|
|||
TraceLine (ent->v.origin + ent->v.view_ofs, origin, true, true, ent, &tr);
|
||||
|
||||
if (tr.flFraction != 1.0f)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Vector GetEntityOrigin (edict_t *ent)
|
||||
|
|
@ -174,7 +174,7 @@ void DisplayMenuToClient (edict_t *ent, MenuText *menu)
|
|||
for (int i = 0; i <= 9; i++)
|
||||
tempText.Replace (FormatBuffer ("%d.", i), FormatBuffer ("\\r%d.\\w", i));
|
||||
|
||||
if ((g_gameVersion & (CSVERSION_XASH | CSVERSION_MOBILITY)) && !yb_display_menu_text.GetBool ())
|
||||
if ((g_gameFlags & (GAME_XASH | GAME_MOBILITY)) && !yb_display_menu_text.GetBool ())
|
||||
text = " ";
|
||||
else
|
||||
text = (char *) tempText.GetBuffer ();
|
||||
|
|
@ -992,7 +992,7 @@ void CheckWelcomeMessage (void)
|
|||
|
||||
Array <String> sentences;
|
||||
|
||||
if (!(g_gameVersion & (CSVERSION_MOBILITY | CSVERSION_XASH)))
|
||||
if (!(g_gameFlags & (GAME_MOBILITY | GAME_XASH)))
|
||||
{
|
||||
// add default messages
|
||||
sentences.Push ("hello user,communication is acquired");
|
||||
|
|
@ -1018,7 +1018,7 @@ void CheckWelcomeMessage (void)
|
|||
|
||||
if (receiveTime > 0.0f && receiveTime < GetWorldTime () && !alreadyReceived && (g_numWaypoints > 0 ? g_isCommencing : true))
|
||||
{
|
||||
if (!(g_gameVersion & (CSVERSION_MOBILITY | CSVERSION_XASH)))
|
||||
if (!(g_gameFlags & (GAME_MOBILITY | GAME_XASH)))
|
||||
ServerCommand ("speak \"%s\"", const_cast <char *> (sentences.GetRandomElement ().GetBuffer ()));
|
||||
|
||||
ChartPrint ("----- %s v%s (Build: %u), {%s}, (c) 2016, by %s (%s)-----", PRODUCT_NAME, PRODUCT_VERSION, GenerateBuildNumber (), PRODUCT_DATE, PRODUCT_AUTHOR, PRODUCT_URL);
|
||||
|
|
@ -1051,13 +1051,13 @@ void CheckWelcomeMessage (void)
|
|||
|
||||
void DetectCSVersion (void)
|
||||
{
|
||||
if (g_gameVersion & CSVERSION_CZERO)
|
||||
if (g_gameFlags & GAME_CZERO)
|
||||
return;
|
||||
|
||||
// detect xash engine
|
||||
if (g_engfuncs.pfnCVarGetPointer ("build") != NULL)
|
||||
{
|
||||
g_gameVersion |= (CSVERSION_LEGACY | CSVERSION_XASH);
|
||||
g_gameFlags |= (GAME_LEGACY | GAME_XASH);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1065,9 +1065,9 @@ void DetectCSVersion (void)
|
|||
byte *detection = (*g_engfuncs.pfnLoadFileForMe) ("events/galil.sc", NULL);
|
||||
|
||||
if (detection != NULL)
|
||||
g_gameVersion |= CSVERSION_CSTRIKE16; // just to be sure
|
||||
g_gameFlags |= GAME_CSTRIKE16; // just to be sure
|
||||
else if (detection == NULL)
|
||||
g_gameVersion |= CSVERSION_LEGACY; // reset it to WON
|
||||
g_gameFlags |= GAME_LEGACY; // reset it to WON
|
||||
|
||||
// if we have loaded the file free it
|
||||
if (detection != NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue