some little tweaks

This commit is contained in:
jeefo 2014-08-15 21:58:43 +04:00
commit 379c0bc81e
5 changed files with 25 additions and 20 deletions

View file

@ -997,6 +997,7 @@ private:
void SwitchChatterIcon (bool show); void SwitchChatterIcon (bool show);
void InstantChatterMessage (int type); void InstantChatterMessage (int type);
void BotAI (void); void BotAI (void);
void CheckSpawnTimeConditions (void);
bool IsMorePowerfulWeaponCanBeBought (void); bool IsMorePowerfulWeaponCanBeBought (void);
void PerformWeaponPurchase (void); void PerformWeaponPurchase (void);

View file

@ -26,7 +26,7 @@
#include <../include/resource.h> #include <../include/resource.h>
// generated by update tool -- do not edit -- // generated by update tool -- do not edit --
#define PRODUCT_BUILD_TOOL 3850 #define PRODUCT_BUILD_TOOL 3853
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION PRODUCT_VERSION_DWORD, PRODUCT_BUILD_TOOL FILEVERSION PRODUCT_VERSION_DWORD, PRODUCT_BUILD_TOOL

View file

@ -3137,13 +3137,15 @@ void Bot::Think (void)
SecondThink (); SecondThink ();
// update timer to one second // update timer to one second
secondThinkTimer = GetWorldTime () + 1.05; secondThinkTimer = GetWorldTime () + 0.99f;
} }
CheckMessageQueue (); // check for pending messages CheckMessageQueue (); // check for pending messages
if (pev->maxspeed < 10 && GetTaskId () != TASK_PLANTBOMB && GetTaskId () != TASK_DEFUSEBOMB) if (pev->maxspeed < 10 && GetTaskId () != TASK_PLANTBOMB && GetTaskId () != TASK_DEFUSEBOMB)
botMovement = false; botMovement = false;
CheckSpawnTimeConditions ();
if (m_notKilled && botMovement && !yb_freeze_bots.GetBool ()) if (m_notKilled && botMovement && !yb_freeze_bots.GetBool ())
BotAI (); // execute main code BotAI (); // execute main code
@ -4762,15 +4764,12 @@ void Bot::RunTask (void)
} }
} }
void Bot::BotAI (void) void Bot::CheckSpawnTimeConditions (void)
{ {
// this function gets called each frame and is the core of all bot ai. from here all other subroutines are called // this function is called instead of BotAI when buying finished, but freezetime is not yet left.
float movedDistance; // length of different vector (distance bot moved)
TraceResult tr;
// switch to knife if time to do this // switch to knife if time to do this
if (m_checkKnifeSwitch && m_buyingFinished && m_spawnTime + g_randGen.Float (4.0, 6.5) < GetWorldTime ()) if (m_checkKnifeSwitch && !m_checkWeaponSwitch && m_buyingFinished && m_spawnTime + g_randGen.Float (4.0, 6.5) < GetWorldTime ())
{ {
if (g_randGen.Long (1, 100) < 2 && yb_spraypaints.GetBool ()) if (g_randGen.Long (1, 100) < 2 && yb_spraypaints.GetBool ())
StartTask (TASK_SPRAY, TASKPRI_SPRAYLOGO, -1, GetWorldTime () + 1.0, false); StartTask (TASK_SPRAY, TASKPRI_SPRAYLOGO, -1, GetWorldTime () + 1.0, false);
@ -4809,14 +4808,15 @@ void Bot::BotAI (void)
// select a leader bot for this team // select a leader bot for this team
SelectLeaderEachTeam (m_team); SelectLeaderEachTeam (m_team);
m_checkWeaponSwitch = false; m_checkWeaponSwitch = false;
if (m_isLeader && m_moveToC4)
InstantChatterMessage (Chatter_CoverMe);
if (IsBehindSmokeClouds (GetEntity ()))
InstantChatterMessage (Chatter_BehindSmoke);
} }
// warning: the following timers aren't frame independent so it varies on slower/faster computers }
void Bot::BotAI (void)
{
// this function gets called each frame and is the core of all bot ai. from here all other subroutines are called
float movedDistance; // length of different vector (distance bot moved)
TraceResult tr;
// increase reaction time // increase reaction time
m_actualReactionTime += 0.3; m_actualReactionTime += 0.3;
@ -6219,7 +6219,7 @@ float Bot::GetBombTimeleft (void)
float Bot::GetEstimatedReachTime (void) float Bot::GetEstimatedReachTime (void)
{ {
float estimatedTime = 5.0; // time to reach next waypoint float estimatedTime = 4.0; // time to reach next waypoint
// calculate 'real' time that we need to get from one waypoint to another // calculate 'real' time that we need to get from one waypoint to another
if (m_currentWaypointIndex >= 0 && m_currentWaypointIndex < g_numWaypoints && m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints) if (m_currentWaypointIndex >= 0 && m_currentWaypointIndex < g_numWaypoints && m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints)
@ -6228,9 +6228,9 @@ float Bot::GetEstimatedReachTime (void)
// caclulate estimated time // caclulate estimated time
if (pev->maxspeed <= 0.0) if (pev->maxspeed <= 0.0)
estimatedTime = 5.0 * distance / 240.0; estimatedTime = 4.0 * distance / 240.0;
else else
estimatedTime = 5.0 * distance / pev->maxspeed; estimatedTime = 4.0 * distance / pev->maxspeed;
// check for special waypoints, that can slowdown our movement // check for special waypoints, that can slowdown our movement
if ((m_currentPath->flags & FLAG_CROUCH) || (m_currentPath->flags & FLAG_LADDER) || (pev->button & IN_DUCK)) if ((m_currentPath->flags & FLAG_CROUCH) || (m_currentPath->flags & FLAG_LADDER) || (pev->button & IN_DUCK))

View file

@ -38,7 +38,7 @@ ConVar yb_minskill ("yb_minskill", "60");
ConVar yb_maxskill ("yb_maxskill", "100"); ConVar yb_maxskill ("yb_maxskill", "100");
ConVar yb_skill_tags ("yb_skill_tags", "0"); ConVar yb_skill_tags ("yb_skill_tags", "0");
ConVar yb_latency_display ("yb_latency_display", "0"); ConVar yb_latency_display ("yb_latency_display", "2");
BotManager::BotManager (void) BotManager::BotManager (void)
{ {

View file

@ -107,7 +107,6 @@ bool Bot::LookupEnemy (void)
{ {
m_enemyUpdateTime = GetWorldTime () + 0.25; m_enemyUpdateTime = GetWorldTime () + 0.25;
// search the world for players... // search the world for players...
for (i = 0; i < GetMaxClients (); i++) for (i = 0; i < GetMaxClients (); i++)
{ {
@ -126,8 +125,13 @@ bool Bot::LookupEnemy (void)
// do some blind by smoke grenade // do some blind by smoke grenade
if (IsBehindSmokeClouds (player) && m_blindRecognizeTime < GetWorldTime ()) if (IsBehindSmokeClouds (player) && m_blindRecognizeTime < GetWorldTime ())
{
m_blindRecognizeTime = GetWorldTime () + g_randGen.Float (2.0, 3.0); m_blindRecognizeTime = GetWorldTime () + g_randGen.Float (2.0, 3.0);
if (g_randGen.Long (0, 100) < 50)
ChatterMessage (Chatter_BehindSmoke);
}
if (player->v.button & (IN_ATTACK | IN_ATTACK2)) if (player->v.button & (IN_ATTACK | IN_ATTACK2))
m_blindRecognizeTime = GetWorldTime () - 0.1; m_blindRecognizeTime = GetWorldTime () - 0.1;