diff --git a/source/basecode.cpp b/source/basecode.cpp index b76416f..0157a40 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -5293,7 +5293,7 @@ void Bot::TakeBlinded (const Vector &fade, int alpha) // it's used to make bot blind froumd the grenade. - if (fade.x != 255 || fade.y != 255 || fade.z != 255 || alpha <= 200) + if (fade.x != 255 || fade.y != 255 || fade.z != 255 || alpha <= 170) return; m_enemy = NULL; @@ -5810,17 +5810,21 @@ float Bot::GetEstimatedReachTime (void) else estimatedTime = 4.0f * distance / pev->maxspeed; + bool longTermReachability = (m_currentPath->flags & FLAG_CROUCH) || (m_currentPath->flags & FLAG_LADDER) || (pev->button & IN_DUCK); + // 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 (longTermReachability) estimatedTime *= 3.0f; // check for too low values if (estimatedTime < 1.0f) estimatedTime = 1.0f; + const float maxReachTime = longTermReachability ? 10.0f : 5.0f; + // check for too high values - if (estimatedTime > 8.0f) - estimatedTime = 8.0f; + if (estimatedTime > maxReachTime) + estimatedTime = maxReachTime; } return estimatedTime; } diff --git a/source/navigate.cpp b/source/navigate.cpp index 518c6b1..3e68046 100644 --- a/source/navigate.cpp +++ b/source/navigate.cpp @@ -243,14 +243,13 @@ void Bot::FilterGoals (const Array &goals, int *result) { // this function filters the goals, so new goal is not bot's old goal, and array of goals doesn't contains duplicate goals - int totalGoals = goals.GetElementNumber (); int searchCount = 0; for (int index = 0; index < 4; index++) { int rand = goals.GetRandomElement (); - if (searchCount <= 8 && (m_prevGoalIndex == rand || ((result[0] == rand || result[1] == rand || result[2] == rand || result[3] == rand) && totalGoals > 4)) && !IsPointOccupied (rand)) + if (searchCount <= 8 && (m_prevGoalIndex == rand || ((result[0] == rand || result[1] == rand || result[2] == rand || result[3] == rand) && goals.GetElementNumber () > 4)) && !IsPointOccupied (rand)) { if (index > 0) index--; @@ -1841,7 +1840,7 @@ bool Bot::FindWaypoint (void) #if 0 if (i == m_currentWaypointIndex || i == m_prevWptIndex[0] || i == m_prevWptIndex[1] || i == m_prevWptIndex[2] || i == m_prevWptIndex[3] || i == m_prevWptIndex[4]) #else - if (i == m_currentWaypointIndex || i == m_prevWptIndex[0]) + if (i == m_currentWaypointIndex || i == m_prevWptIndex[0] || i == m_prevWptIndex[1] || i == m_prevWptIndex[2]) #endif continue; @@ -3158,6 +3157,10 @@ void Bot::UpdateLookAngles (void) const float delta = GetWorldTime () - m_lookUpdateTime; m_lookUpdateTime = GetWorldTime (); + // in intermission, do not try to look at something, but update the timer above + if (g_timeRoundStart < GetWorldTime () || !m_buyingFinished) + return; + // adjust all body and view angles to face an absolute vector Vector direction = (m_lookAt - EyePosition ()).ToAngles (); direction.x *= -1.0f; // invert for engine