revert some old commits, that break compatability.

fixed copyright year.
This commit is contained in:
jeefo 2016-01-04 18:26:06 +03:00
commit c9011b00fd
9 changed files with 101 additions and 98 deletions

View file

@ -1,4 +1,4 @@
Copyright (c) 2014, YaPB Dev Team Copyright (c) 2003-2016, YaPB Dev Team
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:

View file

@ -626,7 +626,6 @@ const float TASKPRI_SHOOTBREAKABLE = 100.0f;
const float TASKPRI_ESCAPEFROMBOMB = 100.0f; const float TASKPRI_ESCAPEFROMBOMB = 100.0f;
const float MAX_GRENADE_TIMER = 2.34f; const float MAX_GRENADE_TIMER = 2.34f;
const float TRACE_FRACTION_EQ = 0.999999f;
const int MAX_HOSTAGES = 8; const int MAX_HOSTAGES = 8;
const int MAX_PATH_INDEX = 8; const int MAX_PATH_INDEX = 8;
@ -1539,7 +1538,7 @@ public:
int GetFacingIndex (void); int GetFacingIndex (void);
int FindFarest (const Vector &origin, float maxDistance = 32.0); int FindFarest (const Vector &origin, float maxDistance = 32.0);
int FindNearest (const Vector &origin, float minDistance = 99999999.0f, int flags = -1); int FindNearest (const Vector &origin, float minDistance = 9999.0f, int flags = -1);
void FindInRadius (Array <int> &radiusHolder, float radius, const Vector &origin, int maxCount = -1); void FindInRadius (Array <int> &radiusHolder, float radius, const Vector &origin, int maxCount = -1);
void Add (int flags, const Vector &waypointOrigin = Vector::GetZero ()); void Add (int flags, const Vector &waypointOrigin = Vector::GetZero ());

View file

@ -13,11 +13,11 @@
#define PRODUCT_NAME "Yet Another POD-Bot" #define PRODUCT_NAME "Yet Another POD-Bot"
#define PRODUCT_VERSION "2.7.1" #define PRODUCT_VERSION "2.7.1"
#define PRODUCT_AUTHOR "YaPB Dev Team" #define PRODUCT_AUTHOR "YaPB Dev Team"
#define PRODUCT_URL "http://yapb.jeefo.net" #define PRODUCT_URL "https://yapb.jeefo.net"
#define PRODUCT_EMAIL "dmitry@jeefo.net" #define PRODUCT_EMAIL "dmitry@jeefo.net"
#define PRODUCT_LOGTAG "YAPB" #define PRODUCT_LOGTAG "YAPB"
#define PRODUCT_DESCRIPTION PRODUCT_NAME " v" PRODUCT_VERSION " - The Counter-Strike Bot" #define PRODUCT_DESCRIPTION PRODUCT_NAME " v" PRODUCT_VERSION " - The Counter-Strike Bot"
#define PRODUCT_COPYRIGHT "Copyright © 2003-2015, by " PRODUCT_AUTHOR #define PRODUCT_COPYRIGHT "Copyright © 2003-2016, by " PRODUCT_AUTHOR
#define PRODUCT_LEGAL "Half-Life, Counter-Strike, Counter-Strike: Condition Zero, Steam, Valve is a trademark of Valve Corporation" #define PRODUCT_LEGAL "Half-Life, Counter-Strike, Counter-Strike: Condition Zero, Steam, Valve is a trademark of Valve Corporation"
#define PRODUCT_ORIGINAL_NAME "yapb.dll" #define PRODUCT_ORIGINAL_NAME "yapb.dll"
#define PRODUCT_INTERNAL_NAME "skybot" #define PRODUCT_INTERNAL_NAME "skybot"

View file

@ -105,7 +105,7 @@ bool Bot::ItemIsVisible (const Vector &destination, char *itemName)
TraceLine (EyePosition (), destination, true, GetEntity (), &tr); TraceLine (EyePosition (), destination, true, GetEntity (), &tr);
// check if line of sight to object is not blocked (i.e. visible) // check if line of sight to object is not blocked (i.e. visible)
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
{ {
// check for standard items // check for standard items
if (strcmp (STRING (tr.pHit->v.classname), itemName) == 0) if (strcmp (STRING (tr.pHit->v.classname), itemName) == 0)
@ -127,7 +127,7 @@ bool Bot::EntityIsVisible (const Vector &dest, bool fromBody)
TraceLine (fromBody ? pev->origin - Vector (0.0f, 0.0f, 1.0f) : EyePosition (), dest, true, true, GetEntity (), &tr); TraceLine (fromBody ? pev->origin - Vector (0.0f, 0.0f, 1.0f) : EyePosition (), dest, true, true, GetEntity (), &tr);
// check if line of sight to object is not blocked (i.e. visible) // check if line of sight to object is not blocked (i.e. visible)
return tr.flFraction > TRACE_FRACTION_EQ; return tr.flFraction >= 1.0f;
} }
void Bot::CheckGrenadeThrow (void) void Bot::CheckGrenadeThrow (void)
@ -481,7 +481,7 @@ edict_t *Bot::FindBreakable (void)
TraceResult tr; TraceResult tr;
TraceLine (pev->origin, pev->origin + (m_destOrigin - pev->origin).Normalize () * 64.0f, false, false, GetEntity (), &tr); TraceLine (pev->origin, pev->origin + (m_destOrigin - pev->origin).Normalize () * 64.0f, false, false, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
{ {
edict_t *ent = tr.pHit; edict_t *ent = tr.pHit;
@ -494,7 +494,7 @@ edict_t *Bot::FindBreakable (void)
} }
TraceLine (EyePosition (), EyePosition () + (m_destOrigin - EyePosition ()).Normalize () * 64.0f, false, false, GetEntity (), &tr); TraceLine (EyePosition (), EyePosition () + (m_destOrigin - EyePosition ()).Normalize () * 64.0f, false, false, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
{ {
edict_t *ent = tr.pHit; edict_t *ent = tr.pHit;
@ -898,7 +898,7 @@ void Bot::GetCampDirection (Vector *dest)
TraceLine (src, *dest, true, GetEntity (), &tr); TraceLine (src, *dest, true, GetEntity (), &tr);
// check if the trace hit something... // check if the trace hit something...
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
{ {
float length = (tr.vecEndPos - src).GetLengthSquared (); float length = (tr.vecEndPos - src).GetLengthSquared ();
@ -942,7 +942,7 @@ void Bot::GetCampDirection (Vector *dest)
if (path->index[i] == -1) if (path->index[i] == -1)
continue; continue;
float distance = waypoints.GetPathDistance (path->index[i], enemyIndex); float distance = static_cast <float> (waypoints.GetPathDistance (path->index[i], enemyIndex));
if (distance < minDistance) if (distance < minDistance)
{ {
@ -2219,7 +2219,7 @@ bool Bot::ReactOnEnemy (void)
int enemyIndex = waypoints.FindNearest (m_enemy->v.origin); int enemyIndex = waypoints.FindNearest (m_enemy->v.origin);
float lineDist = (m_enemy->v.origin - pev->origin).GetLength (); float lineDist = (m_enemy->v.origin - pev->origin).GetLength ();
float pathDist = waypoints.GetPathDistance (i, enemyIndex); float pathDist = static_cast <float> (waypoints.GetPathDistance (i, enemyIndex));
if (pathDist - lineDist > 112.0f) if (pathDist - lineDist > 112.0f)
m_isEnemyReachable = false; m_isEnemyReachable = false;
@ -3233,8 +3233,8 @@ void Bot::RunTask_Spray (void)
TraceLine (EyePosition (), sprayOrigin, true, GetEntity (), &tr); TraceLine (EyePosition (), sprayOrigin, true, GetEntity (), &tr);
// no wall in front? // no wall in front?
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
sprayOrigin.z -= 128.0; sprayOrigin.z -= 128.0f;
m_entity = sprayOrigin; m_entity = sprayOrigin;
@ -3743,12 +3743,12 @@ void Bot::RunTask_PlantBomb (void)
DeleteSearchNodes (); DeleteSearchNodes ();
int index = FindDefendWaypoint (pev->origin); int index = FindDefendWaypoint (pev->origin);
float bombTimer = mp_c4timer.GetFloat (); float guardTime = mp_c4timer.GetFloat () * 0.5f + mp_c4timer.GetFloat () * 0.25f;
// push camp task on to stack // push camp task on to stack
PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + (bombTimer * 0.5f + bombTimer * 0.25f), true); PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + guardTime, true);
// push move command // push move command
PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + (bombTimer * 0.5f + bombTimer * 0.25f), true); PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + guardTime, true);
if (waypoints.GetPath (index)->vis.crouch <= waypoints.GetPath (index)->vis.stand) if (waypoints.GetPath (index)->vis.crouch <= waypoints.GetPath (index)->vis.stand)
m_campButtons |= IN_DUCK; m_campButtons |= IN_DUCK;
@ -4242,7 +4242,7 @@ void Bot::RunTask_DoubleJump (void)
TraceResult tr; TraceResult tr;
TraceLine (EyePosition (), dest, false, true, GetEntity (), &tr); TraceLine (EyePosition (), dest, false, true, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ && tr.pHit == m_doubleJumpEntity) if (tr.flFraction < 1.0f && tr.pHit == m_doubleJumpEntity)
{ {
if (m_doubleJumpEntity->v.button & IN_JUMP) if (m_doubleJumpEntity->v.button & IN_JUMP)
{ {
@ -4313,15 +4313,15 @@ void Bot::RunTask_EscapeFromBomb (void)
{ {
DeleteSearchNodes (); DeleteSearchNodes ();
int lastSelectedGoal = -1; int lastSelectedGoal = -1, minPathDistance = 99999;
float safeRadius = Random.Float (1248.0f, 2048.0f), minPathDistance = 99999.0f; float safeRadius = Random.Float (1248.0f, 2048.0f);
for (int i = 0; i < g_numWaypoints; i++) for (int i = 0; i < g_numWaypoints; i++)
{ {
if ((waypoints.GetPath (i)->origin - waypoints.GetBombPosition ()).GetLength () < safeRadius || IsPointOccupied (i)) if ((waypoints.GetPath (i)->origin - waypoints.GetBombPosition ()).GetLength () < safeRadius || IsPointOccupied (i))
continue; continue;
float pathDistance = waypoints.GetPathDistance (m_currentWaypointIndex, i); int pathDistance = waypoints.GetPathDistance (m_currentWaypointIndex, i);
if (minPathDistance > pathDistance) if (minPathDistance > pathDistance)
{ {
@ -5586,7 +5586,7 @@ Vector Bot::CheckToss(const Vector &start, const Vector &stop)
Vector midPoint = start + (end - start) * 0.5f; Vector midPoint = start + (end - start) * 0.5f;
TraceHull (midPoint, midPoint + Vector (0.0f, 0.0f, 500.0f), true, head_hull, ENT (pev), &tr); TraceHull (midPoint, midPoint + Vector (0.0f, 0.0f, 500.0f), true, head_hull, ENT (pev), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
{ {
midPoint = tr.vecEndPos; midPoint = tr.vecEndPos;
midPoint.z = tr.pHit->v.absmin.z - 1.0f; midPoint.z = tr.pHit->v.absmin.z - 1.0f;
@ -5609,12 +5609,12 @@ Vector Bot::CheckToss(const Vector &start, const Vector &stop)
TraceHull (start, apex, false, head_hull, ENT (pev), &tr); TraceHull (start, apex, false, head_hull, ENT (pev), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ || tr.fAllSolid) if (tr.flFraction < 1.0f || tr.fAllSolid)
return Vector::GetZero (); return Vector::GetZero ();
TraceHull (end, apex, true, head_hull, ENT (pev), &tr); TraceHull (end, apex, true, head_hull, ENT (pev), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
{ {
float dot = -(tr.vecPlaneNormal | (apex - end).Normalize ()); float dot = -(tr.vecPlaneNormal | (apex - end).Normalize ());
@ -5648,12 +5648,12 @@ Vector Bot::CheckThrow(const Vector &start, const Vector &stop)
TraceHull (start, apex, false, head_hull, GetEntity (), &tr); TraceHull (start, apex, false, head_hull, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
return Vector::GetZero (); return Vector::GetZero ();
TraceHull (stop, apex, true, head_hull, GetEntity (), &tr); TraceHull (stop, apex, true, head_hull, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ || tr.fAllSolid) if (tr.flFraction != 1.0 || tr.fAllSolid)
{ {
float dot = -(tr.vecPlaneNormal | (apex - stop).Normalize ()); float dot = -(tr.vecPlaneNormal | (apex - stop).Normalize ());

View file

@ -109,7 +109,7 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
// check for the body // check for the body
TraceLine (botHead, target->v.origin, true, true, GetEntity (), &tr); TraceLine (botHead, target->v.origin, true, true, GetEntity (), &tr);
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
{ {
*bodyPart |= VISIBLE_BODY; *bodyPart |= VISIBLE_BODY;
*origin = target->v.origin; *origin = target->v.origin;
@ -121,7 +121,7 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
// check for the head // check for the head
TraceLine (botHead, target->v.origin + target->v.view_ofs, true, true, GetEntity (), &tr); TraceLine (botHead, target->v.origin + target->v.view_ofs, true, true, GetEntity (), &tr);
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
{ {
*bodyPart |= VISIBLE_HEAD; *bodyPart |= VISIBLE_HEAD;
*origin = target->v.origin + target->v.view_ofs; *origin = target->v.origin + target->v.view_ofs;
@ -184,7 +184,7 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
TraceLine (botHead, pos, true, true, GetEntity (), &tr); TraceLine (botHead, pos, true, true, GetEntity (), &tr);
// check if we hit something // check if we hit something
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
{ {
*origin = tr.vecEndPos; *origin = tr.vecEndPos;
*bodyPart |= VISIBLE_OTHER; *bodyPart |= VISIBLE_OTHER;
@ -631,7 +631,7 @@ bool Bot::IsShootableThruObstacle (const Vector &dest)
const Vector &source = tr.vecEndPos; const Vector &source = tr.vecEndPos;
TraceLine (dest, source, true, GetEntity (), &tr); TraceLine (dest, source, true, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
{ {
if ((tr.vecEndPos - dest).GetLengthSquared () > GET_SQUARE (800.0f)) if ((tr.vecEndPos - dest).GetLengthSquared () > GET_SQUARE (800.0f))
return false; return false;
@ -677,7 +677,7 @@ bool Bot::IsShootableThruObstacleEx (const Vector &dest)
TraceResult tr; TraceResult tr;
TraceLine (source, dest, true, true, GetEntity (), &tr); TraceLine (source, dest, true, true, GetEntity (), &tr);
while (tr.flFraction <= TRACE_FRACTION_EQ && numHits < 3) while (tr.flFraction != 1.0f && numHits < 3)
{ {
numHits++; numHits++;
thikness++; thikness++;

View file

@ -2215,6 +2215,7 @@ void StartFrame (void)
} }
} }
} }
if (g_bombPlanted) if (g_bombPlanted)
waypoints.SetBombPosition (); waypoints.SetBombPosition ();

View file

@ -117,8 +117,8 @@ int Bot::FindGoal (void)
} }
else if ((g_mapType & MAP_DE) && m_team == TEAM_TF && g_timeRoundStart + 10.0f < GetWorldTime ()) else if ((g_mapType & MAP_DE) && m_team == TEAM_TF && g_timeRoundStart + 10.0f < GetWorldTime ())
{ {
// send some terrorists to guard planter bomb // send some terrorists to guard planted bomb
if (g_bombPlanted && GetTaskId () != TASK_ESCAPEFROMBOMB && GetBombTimeleft () >= 15.0) if (!m_defendedBomb && g_bombPlanted && GetTaskId () != TASK_ESCAPEFROMBOMB && GetBombTimeleft () >= 15.0)
return m_chosenGoalIndex = FindDefendWaypoint (waypoints.GetBombPosition ()); return m_chosenGoalIndex = FindDefendWaypoint (waypoints.GetBombPosition ());
} }
@ -469,7 +469,7 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal)
TraceHull (src, dst, true, head_hull, GetEntity (), &tr); TraceHull (src, dst, true, head_hull, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
blockedRight = true; blockedRight = true;
src = pev->origin - g_pGlobals->v_right * 32.0f; src = pev->origin - g_pGlobals->v_right * 32.0f;
@ -477,7 +477,7 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal)
TraceHull (src, dst, true, head_hull, GetEntity (), &tr); TraceHull (src, dst, true, head_hull, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
blockedLeft = true; blockedLeft = true;
if (dirLeft) if (dirLeft)
@ -519,14 +519,14 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal)
TraceLine (src, m_destOrigin, true, true, GetEntity (), &tr); TraceLine (src, m_destOrigin, true, true, GetEntity (), &tr);
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
{ {
src = EyePosition (); src = EyePosition ();
src = src - g_pGlobals->v_right * 15.0f; src = src - g_pGlobals->v_right * 15.0f;
TraceLine (src, m_destOrigin, true, true, GetEntity (), &tr); TraceLine (src, m_destOrigin, true, true, GetEntity (), &tr);
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
state[i] += 5; state[i] += 5;
} }
} }
@ -538,7 +538,7 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal)
dst = src + dirNormal * 30.0f; dst = src + dirNormal * 30.0f;
TraceLine (src, dst, true, true, GetEntity (), &tr); TraceLine (src, dst, true, true, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
state[i] += 10; state[i] += 10;
} }
else else
@ -719,7 +719,7 @@ bool Bot::DoWaypointNav (void)
// trace line to door // trace line to door
TraceLine (pev->origin, m_currentPath->origin, true, true, GetEntity (), &tr2); TraceLine (pev->origin, m_currentPath->origin, true, true, GetEntity (), &tr2);
if (tr2.flFraction <= TRACE_FRACTION_EQ && strcmp (STRING (tr2.pHit->v.classname), "func_door") == 0 && (m_liftState == LIFT_NO_NEARBY || m_liftState == LIFT_WAITING_FOR || m_liftState == LIFT_LOOKING_BUTTON_OUTSIDE) && pev->groundentity != tr2.pHit) if (tr2.flFraction < 1.0f && strcmp (STRING (tr2.pHit->v.classname), "func_door") == 0 && (m_liftState == LIFT_NO_NEARBY || m_liftState == LIFT_WAITING_FOR || m_liftState == LIFT_LOOKING_BUTTON_OUTSIDE) && pev->groundentity != tr2.pHit)
{ {
if (m_liftState == LIFT_NO_NEARBY) if (m_liftState == LIFT_NO_NEARBY)
{ {
@ -1416,7 +1416,7 @@ float gfunctionKillsDistT (int currentIndex, int parentIndex)
if (current->flags & FLAG_CROUCH) if (current->flags & FLAG_CROUCH)
cost *= 1.5f; cost *= 1.5f;
return waypoints.GetPathDistance (parentIndex, currentIndex) + cost; return static_cast <float> (waypoints.GetPathDistance (parentIndex, currentIndex)) + cost;
} }
@ -1442,7 +1442,7 @@ float gfunctionKillsDistCT (int currentIndex, int parentIndex)
if (current->flags & FLAG_CROUCH) if (current->flags & FLAG_CROUCH)
cost *= 1.5f; cost *= 1.5f;
return waypoints.GetPathDistance (parentIndex, currentIndex) + cost; return static_cast <float> (waypoints.GetPathDistance (parentIndex, currentIndex)) + cost;
} }
float gfunctionKillsDistCTWithHostage (int currentIndex, int parentIndex) float gfunctionKillsDistCTWithHostage (int currentIndex, int parentIndex)
@ -2094,26 +2094,24 @@ int Bot::FindDefendWaypoint (const Vector &origin)
continue; continue;
// use the 'real' pathfinding distances // use the 'real' pathfinding distances
int distances = waypoints.GetPathDistance (srcIndex, i); int distance = waypoints.GetPathDistance (srcIndex, i);
// skip wayponts with distance more than 1536 units // skip wayponts with distance more than 512 units
if (distances > 1536.0f) if (distance > 512)
continue; continue;
TraceLine (waypoints.GetPath (i)->origin, waypoints.GetPath (posIndex)->origin, true, true, GetEntity (), &tr); TraceLine (waypoints.GetPath (i)->origin, waypoints.GetPath (posIndex)->origin, true, true, GetEntity (), &tr);
// check if line not hit anything // check if line not hit anything
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
continue; continue;
for (int j = 0; j < MAX_PATH_INDEX; j++) for (int j = 0; j < MAX_PATH_INDEX; j++)
{ {
if (distances > minDistance[j]) if (distance > minDistance[j])
{ {
waypointIndex[j] = i; waypointIndex[j] = i;
minDistance[j] = distances; minDistance[j] = distance;
break;
} }
} }
} }
@ -2161,13 +2159,15 @@ int Bot::FindDefendWaypoint (const Vector &origin)
} }
} while (isOrderChanged); } while (isOrderChanged);
if (waypointIndex[0] == -1) if (waypointIndex[0] == -1)
{ {
Array <int> found; Array <int> found;
for (int i = 0; i < g_numWaypoints; i++) for (int i = 0; i < g_numWaypoints; i++)
{ {
if ((waypoints.GetPath (i)->origin - origin).GetLength () <= 1248.0f && !IsPointOccupied (i)) if ((waypoints.GetPath (i)->origin - origin).GetLength () <= 1248.0f && !waypoints.IsVisible (i, posIndex) && !IsPointOccupied (i))
found.Push (i); found.Push (i);
} }
@ -2314,7 +2314,7 @@ int Bot::FindCoverWaypoint (float maxDistance)
{ {
TraceLine (m_lastEnemyOrigin + Vector (0.0f, 0.0f, 36.0f), waypoints.GetPath (waypointIndex[i])->origin, true, true, GetEntity (), &tr); TraceLine (m_lastEnemyOrigin + Vector (0.0f, 0.0f, 36.0f), waypoints.GetPath (waypointIndex[i])->origin, true, true, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return waypointIndex[i]; return waypointIndex[i];
} }
} }
@ -2507,7 +2507,7 @@ bool Bot::HeadTowardWaypoint (void)
{ {
TraceLine (Vector (pev->origin.x, pev->origin.y, pev->absmin.z), m_waypointOrigin, true, true, GetEntity (), &tr); TraceLine (Vector (pev->origin.x, pev->origin.y, pev->absmin.z), m_waypointOrigin, true, true, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
m_waypointOrigin = m_waypointOrigin + (pev->origin - m_waypointOrigin) * 0.5f + Vector (0.0f, 0.0f, 32.0f); m_waypointOrigin = m_waypointOrigin + (pev->origin - m_waypointOrigin) * 0.5f + Vector (0.0f, 0.0f, 32.0f);
} }
m_navTimeset = GetWorldTime (); m_navTimeset = GetWorldTime ();
@ -2531,7 +2531,7 @@ bool Bot::CantMoveForward (const Vector &normal, TraceResult *tr)
TraceLine (src, forward, true, GetEntity (), tr); TraceLine (src, forward, true, GetEntity (), tr);
// check if the trace hit something... // check if the trace hit something...
if (tr->flFraction <= TRACE_FRACTION_EQ) if (tr->flFraction < 1.0f)
{ {
if (strncmp ("func_door", STRING (tr->pHit->v.classname), 9) == 0) if (strncmp ("func_door", STRING (tr->pHit->v.classname), 9) == 0)
return false; return false;
@ -2547,7 +2547,7 @@ bool Bot::CantMoveForward (const Vector &normal, TraceResult *tr)
TraceLine (src, forward, true, GetEntity (), tr); TraceLine (src, forward, true, GetEntity (), tr);
// check if the trace hit something... // check if the trace hit something...
if (tr->flFraction <= TRACE_FRACTION_EQ && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0) if (tr->flFraction < 1.0f && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0)
return true; // bot's body will hit something return true; // bot's body will hit something
// bot's head is clear, check at shoulder level... // bot's head is clear, check at shoulder level...
@ -2558,7 +2558,7 @@ bool Bot::CantMoveForward (const Vector &normal, TraceResult *tr)
TraceLine (src, forward, true, GetEntity (), tr); TraceLine (src, forward, true, GetEntity (), tr);
// check if the trace hit something... // check if the trace hit something...
if (tr->flFraction <= TRACE_FRACTION_EQ && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0) if (tr->flFraction < 1.0f && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0)
return true; // bot's body will hit something return true; // bot's body will hit something
// now check below waist // now check below waist
@ -2570,7 +2570,7 @@ bool Bot::CantMoveForward (const Vector &normal, TraceResult *tr)
TraceLine (src, forward, true, GetEntity (), tr); TraceLine (src, forward, true, GetEntity (), tr);
// check if the trace hit something... // check if the trace hit something...
if (tr->flFraction <= TRACE_FRACTION_EQ && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0) if (tr->flFraction < 1.0f && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0)
return true; // bot's body will hit something return true; // bot's body will hit something
src = pev->origin; src = pev->origin;
@ -2579,7 +2579,7 @@ bool Bot::CantMoveForward (const Vector &normal, TraceResult *tr)
TraceLine (src, forward, true, GetEntity (), tr); TraceLine (src, forward, true, GetEntity (), tr);
// check if the trace hit something... // check if the trace hit something...
if (tr->flFraction <= TRACE_FRACTION_EQ && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0) if (tr->flFraction < 1.0f && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0)
return true; // bot's body will hit something return true; // bot's body will hit something
} }
else else
@ -2592,7 +2592,7 @@ bool Bot::CantMoveForward (const Vector &normal, TraceResult *tr)
TraceLine (src, forward, true, GetEntity (), tr); TraceLine (src, forward, true, GetEntity (), tr);
// check if the trace hit something... // check if the trace hit something...
if (tr->flFraction <= TRACE_FRACTION_EQ && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0) if (tr->flFraction < 1.0f && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0)
return true; // bot's body will hit something return true; // bot's body will hit something
// trace from the left waist to the right forward waist pos // trace from the left waist to the right forward waist pos
@ -2602,7 +2602,7 @@ bool Bot::CantMoveForward (const Vector &normal, TraceResult *tr)
TraceLine (src, forward, true, GetEntity (), tr); TraceLine (src, forward, true, GetEntity (), tr);
// check if the trace hit something... // check if the trace hit something...
if (tr->flFraction <= TRACE_FRACTION_EQ && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0) if (tr->flFraction < 1.0f && strncmp ("func_door", STRING (tr->pHit->v.classname), 9) != 0)
return true; // bot's body will hit something return true; // bot's body will hit something
} }
return false; // bot can move forward, return false return false; // bot can move forward, return false
@ -2689,7 +2689,7 @@ bool Bot::CanJumpUp (const Vector &normal)
// trace a line forward at maximum jump height... // trace a line forward at maximum jump height...
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
goto CheckDuckJump; goto CheckDuckJump;
else else
{ {
@ -2699,7 +2699,7 @@ bool Bot::CanJumpUp (const Vector &normal)
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
} }
@ -2711,7 +2711,7 @@ bool Bot::CanJumpUp (const Vector &normal)
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
goto CheckDuckJump; goto CheckDuckJump;
// now trace from jump height upward to check for obstructions... // now trace from jump height upward to check for obstructions...
@ -2721,7 +2721,7 @@ bool Bot::CanJumpUp (const Vector &normal)
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
// now check same height on the other side of the bot... // now check same height on the other side of the bot...
@ -2732,7 +2732,7 @@ bool Bot::CanJumpUp (const Vector &normal)
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
goto CheckDuckJump; goto CheckDuckJump;
// now trace from jump height upward to check for obstructions... // now trace from jump height upward to check for obstructions...
@ -2742,7 +2742,7 @@ bool Bot::CanJumpUp (const Vector &normal)
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
return tr.flFraction > TRACE_FRACTION_EQ; return tr.flFraction > 1.0f;
// here we check if a duck jump would work... // here we check if a duck jump would work...
CheckDuckJump: CheckDuckJump:
@ -2754,7 +2754,7 @@ CheckDuckJump:
// trace a line forward at maximum jump height... // trace a line forward at maximum jump height...
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
else else
{ {
@ -2765,7 +2765,7 @@ CheckDuckJump:
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, check duckjump // if trace hit something, check duckjump
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
} }
@ -2777,7 +2777,7 @@ CheckDuckJump:
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
// now trace from jump height upward to check for obstructions... // now trace from jump height upward to check for obstructions...
@ -2787,7 +2787,7 @@ CheckDuckJump:
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
// now check same height on the other side of the bot... // now check same height on the other side of the bot...
@ -2798,7 +2798,7 @@ CheckDuckJump:
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
// now trace from jump height upward to check for obstructions... // now trace from jump height upward to check for obstructions...
@ -2808,7 +2808,7 @@ CheckDuckJump:
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
return tr.flFraction > TRACE_FRACTION_EQ; return tr.flFraction > 1.0f;
} }
bool Bot::CanDuckUnder (const Vector &normal) bool Bot::CanDuckUnder (const Vector &normal)
@ -2834,7 +2834,7 @@ bool Bot::CanDuckUnder (const Vector &normal)
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
// now check same height to one side of the bot... // now check same height to one side of the bot...
@ -2845,7 +2845,7 @@ bool Bot::CanDuckUnder (const Vector &normal)
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
// now check same height on the other side of the bot... // now check same height on the other side of the bot...
@ -2856,7 +2856,7 @@ bool Bot::CanDuckUnder (const Vector &normal)
TraceLine (src, dest, true, GetEntity (), &tr); TraceLine (src, dest, true, GetEntity (), &tr);
// if trace hit something, return false // if trace hit something, return false
return tr.flFraction > TRACE_FRACTION_EQ; return tr.flFraction > 1.0f;
} }
#ifdef DEAD_CODE #ifdef DEAD_CODE
@ -2875,7 +2875,7 @@ bool Bot::IsBlockedLeft (void)
TraceLine (pev->origin, g_pGlobals->v_forward * direction - g_pGlobals->v_right * 48.0f, true, GetEntity (), &tr); TraceLine (pev->origin, g_pGlobals->v_forward * direction - g_pGlobals->v_right * 48.0f, true, GetEntity (), &tr);
// check if the trace hit something... // check if the trace hit something...
if (tr.flFraction <= TRACE_FRACTION_EQ && strncmp ("func_door", STRING (tr.pHit->v.classname), 9) != 0) if (tr.flFraction < 1.0f && strncmp ("func_door", STRING (tr.pHit->v.classname), 9) != 0)
return true; // bot's body will hit something return true; // bot's body will hit something
return false; return false;
@ -2895,7 +2895,7 @@ bool Bot::IsBlockedRight (void)
TraceLine (pev->origin, pev->origin + g_pGlobals->v_forward * direction + g_pGlobals->v_right * 48.0f, true, GetEntity (), &tr); TraceLine (pev->origin, pev->origin + g_pGlobals->v_forward * direction + g_pGlobals->v_right * 48.0f, true, GetEntity (), &tr);
// check if the trace hit something... // check if the trace hit something...
if (tr.flFraction <= TRACE_FRACTION_EQ && (strncmp ("func_door", STRING (tr.pHit->v.classname), 9) != 0)) if (tr.flFraction < 1.0f && (strncmp ("func_door", STRING (tr.pHit->v.classname), 9) != 0))
return true; // bot's body will hit something return true; // bot's body will hit something
return false; return false;
@ -2911,7 +2911,7 @@ bool Bot::CheckWallOnLeft (void)
TraceLine (pev->origin, pev->origin - g_pGlobals->v_right * 40.0f, true, GetEntity (), &tr); TraceLine (pev->origin, pev->origin - g_pGlobals->v_right * 40.0f, true, GetEntity (), &tr);
// check if the trace hit something... // check if the trace hit something...
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return true; return true;
return false; return false;
@ -2926,7 +2926,7 @@ bool Bot::CheckWallOnRight (void)
TraceLine (pev->origin, pev->origin + g_pGlobals->v_right * 40.0f, true, GetEntity (), &tr); TraceLine (pev->origin, pev->origin + g_pGlobals->v_right * 40.0f, true, GetEntity (), &tr);
// check if the trace hit something... // check if the trace hit something...
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return true; return true;
return false; return false;
@ -3320,6 +3320,8 @@ bool Bot::IsPointOccupied (int index)
continue; continue;
// check if this waypoint is already used // check if this waypoint is already used
// TODO: take in account real players
if (bot->m_notKilled) if (bot->m_notKilled)
{ {
int occupyId = GetShootingConeDeviation (bot->GetEntity (), &pev->origin) >= 0.7f ? bot->m_prevWptIndex[0] : m_currentWaypointIndex; int occupyId = GetShootingConeDeviation (bot->GetEntity (), &pev->origin) >= 0.7f ? bot->m_prevWptIndex[0] : m_currentWaypointIndex;
@ -3327,7 +3329,7 @@ bool Bot::IsPointOccupied (int index)
// length check // length check
float length = (waypoints.GetPath (occupyId)->origin - waypoints.GetPath (index)->origin).GetLengthSquared (); float length = (waypoints.GetPath (occupyId)->origin - waypoints.GetPath (index)->origin).GetLengthSquared ();
if (occupyId == index || bot->GetTask ()->data == index || length < GET_SQUARE (75.0f)) if (occupyId == index || bot->GetTask ()->data == index || length < GET_SQUARE (64.0f))
return true; return true;
} }
} }

View file

@ -135,7 +135,7 @@ bool IsVisible (const Vector &origin, edict_t *ent)
TraceResult tr; TraceResult tr;
TraceLine (ent->v.origin + ent->v.view_ofs, origin, true, true, ent, &tr); TraceLine (ent->v.origin + ent->v.view_ofs, origin, true, true, ent, &tr);
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction != 1.0f)
return true; return true;
return false; return false;
@ -229,7 +229,7 @@ void DecalTrace (entvars_t *pev, TraceResult *trace, int logotypeIndex)
if (decalIndex < 0) if (decalIndex < 0)
decalIndex = (*g_engfuncs.pfnDecalIndex) ("{lambda06"); decalIndex = (*g_engfuncs.pfnDecalIndex) ("{lambda06");
if (trace->flFraction > TRACE_FRACTION_EQ) if (trace->flFraction == 1.0f)
return; return;
if (!IsEntityNull (trace->pHit)) if (!IsEntityNull (trace->pHit))
@ -1013,7 +1013,7 @@ void CheckWelcomeMessage (void)
{ {
ServerCommand ("speak \"%s\"", const_cast <char *> (sentences.GetRandomElement ().GetBuffer ())); ServerCommand ("speak \"%s\"", const_cast <char *> (sentences.GetRandomElement ().GetBuffer ()));
ChartPrint ("----- YaPB v%s (Build: %u), {%s}, (c) 2015, by %s -----", PRODUCT_VERSION, GenerateBuildNumber (), PRODUCT_DATE, PRODUCT_AUTHOR); ChartPrint ("----- %s v%s (Build: %u), {%s}, (c) 2016, by %s (%s)-----", PRODUCT_NAME, PRODUCT_VERSION, GenerateBuildNumber (), PRODUCT_DATE, PRODUCT_AUTHOR, PRODUCT_URL);
MESSAGE_BEGIN (MSG_ONE, SVC_TEMPENTITY, NULL, g_hostEntity); MESSAGE_BEGIN (MSG_ONE, SVC_TEMPENTITY, NULL, g_hostEntity);
WRITE_BYTE (TE_TEXTMESSAGE); WRITE_BYTE (TE_TEXTMESSAGE);

View file

@ -116,9 +116,9 @@ int Waypoint::FindNearest (const Vector &origin, float minDistance, int flags)
if (flags != -1 && !(m_paths[i]->flags & flags)) if (flags != -1 && !(m_paths[i]->flags & flags))
continue; // if flag not -1 and waypoint has no this flag, skip waypoint continue; // if flag not -1 and waypoint has no this flag, skip waypoint
float distance = (m_paths[i]->origin - origin).GetLengthSquared (); float distance = (m_paths[i]->origin - origin).GetLength ();
if (distance < GET_SQUARE (minDistance)) if (distance < minDistance)
{ {
index = i; index = i;
minDistance = distance; minDistance = distance;
@ -136,10 +136,11 @@ void Waypoint::FindInRadius (Array <int> &radiusHolder, float radius, const Vect
if (maxCount != -1 && radiusHolder.GetElementNumber () > maxCount) if (maxCount != -1 && radiusHolder.GetElementNumber () > maxCount)
break; break;
if ((m_paths[i]->origin - origin).GetLengthSquared () < GET_SQUARE (radius)) if ((m_paths[i]->origin - origin).GetLength () < radius)
radiusHolder.Push (i); radiusHolder.Push (i);
} }
} }
void Waypoint::Add (int flags, const Vector &waypointOrigin) void Waypoint::Add (int flags, const Vector &waypointOrigin)
{ {
if (IsEntityNull (g_hostEntity)) if (IsEntityNull (g_hostEntity))
@ -367,7 +368,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
// check if the waypoint is reachable from the new one // check if the waypoint is reachable from the new one
TraceLine (newOrigin, m_paths[i]->origin, true, g_hostEntity, &tr); TraceLine (newOrigin, m_paths[i]->origin, true, g_hostEntity, &tr);
if (tr.flFraction > TRACE_FRACTION_EQ && fabs (newOrigin.x - m_paths[i]->origin.x) < 64.0f && fabs (newOrigin.y - m_paths[i]->origin.y) < 64.0f && fabs (newOrigin.z - m_paths[i]->origin.z) < g_autoPathDistance) if (tr.flFraction == 1.0f && fabs (newOrigin.x - m_paths[i]->origin.x) < 64.0f && fabs (newOrigin.y - m_paths[i]->origin.y) < 64.0f && fabs (newOrigin.z - m_paths[i]->origin.z) < g_autoPathDistance)
{ {
distance = (m_paths[i]->origin - newOrigin).GetLength (); distance = (m_paths[i]->origin - newOrigin).GetLength ();
@ -756,7 +757,7 @@ void Waypoint::CalculateWayzone (int index)
TraceHull (radiusStart, radiusEnd, true, head_hull, NULL, &tr); TraceHull (radiusStart, radiusEnd, true, head_hull, NULL, &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
{ {
TraceLine (radiusStart, radiusEnd, true, NULL, &tr); TraceLine (radiusStart, radiusEnd, true, NULL, &tr);
@ -779,7 +780,7 @@ void Waypoint::CalculateWayzone (int index)
TraceHull (dropStart, dropEnd, true, head_hull, NULL, &tr); TraceHull (dropStart, dropEnd, true, head_hull, NULL, &tr);
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
{ {
wayBlocked = true; wayBlocked = true;
path->radius -= 16.0f; path->radius -= 16.0f;
@ -791,7 +792,7 @@ void Waypoint::CalculateWayzone (int index)
TraceHull (dropStart, dropEnd, true, head_hull, NULL, &tr); TraceHull (dropStart, dropEnd, true, head_hull, NULL, &tr);
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
{ {
wayBlocked = true; wayBlocked = true;
path->radius -= 16.0f; path->radius -= 16.0f;
@ -801,7 +802,7 @@ void Waypoint::CalculateWayzone (int index)
radiusEnd.z += 34.0f; radiusEnd.z += 34.0f;
TraceHull (radiusStart, radiusEnd, true, head_hull, NULL, &tr); TraceHull (radiusStart, radiusEnd, true, head_hull, NULL, &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
{ {
wayBlocked = true; wayBlocked = true;
path->radius -= 16.0f; path->radius -= 16.0f;
@ -1278,7 +1279,7 @@ bool Waypoint::Reachable (Bot *bot, int index)
TraceLine (src, dest, true, bot->GetEntity (), &tr); TraceLine (src, dest, true, bot->GetEntity (), &tr);
// if waypoint is visible from current position (even behind head)... // if waypoint is visible from current position (even behind head)...
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0f)
{ {
if (bot->pev->waterlevel == 2 || bot->pev->waterlevel == 3) if (bot->pev->waterlevel == 2 || bot->pev->waterlevel == 3)
return true; return true;
@ -1314,14 +1315,14 @@ bool Waypoint::IsNodeReachable (const Vector &src, const Vector &destination)
TraceLine (src, destination, ignore_monsters, g_hostEntity, &tr); TraceLine (src, destination, ignore_monsters, g_hostEntity, &tr);
// if waypoint is visible from current position (even behind head)... // if waypoint is visible from current position (even behind head)...
if (tr.flFraction > TRACE_FRACTION_EQ || strncmp ("func_door", STRING (tr.pHit->v.classname), 9) == 0) if (tr.flFraction >= 1.0f || strncmp ("func_door", STRING (tr.pHit->v.classname), 9) == 0)
{ {
// if it's a door check if nothing blocks behind // if it's a door check if nothing blocks behind
if (strncmp ("func_door", STRING (tr.pHit->v.classname), 9) == 0) if (strncmp ("func_door", STRING (tr.pHit->v.classname), 9) == 0)
{ {
TraceLine (tr.vecEndPos, destination, ignore_monsters, tr.pHit, &tr); TraceLine (tr.vecEndPos, destination, ignore_monsters, tr.pHit, &tr);
if (tr.flFraction <= TRACE_FRACTION_EQ) if (tr.flFraction < 1.0f)
return false; return false;
} }
@ -1339,7 +1340,7 @@ bool Waypoint::IsNodeReachable (const Vector &src, const Vector &destination)
TraceLine (sourceNew, destinationNew, ignore_monsters, g_hostEntity, &tr); TraceLine (sourceNew, destinationNew, ignore_monsters, g_hostEntity, &tr);
// check if we didn't hit anything, if not then it's in mid-air // check if we didn't hit anything, if not then it's in mid-air
if (tr.flFraction > TRACE_FRACTION_EQ) if (tr.flFraction >= 1.0)
return false; // can't reach this one return false; // can't reach this one
} }
@ -1380,7 +1381,7 @@ bool Waypoint::IsNodeReachable (const Vector &src, const Vector &destination)
void Waypoint::InitializeVisibility (void) void Waypoint::InitializeVisibility (void)
{ {
if (m_redoneVisibility == false) if (!m_redoneVisibility)
return; return;
TraceResult tr; TraceResult tr;
@ -1411,7 +1412,7 @@ void Waypoint::InitializeVisibility (void)
TraceLine (sourceDuck, dest, true, NULL, &tr); TraceLine (sourceDuck, dest, true, NULL, &tr);
// check if line of sight to object is not blocked (i.e. visible) // check if line of sight to object is not blocked (i.e. visible)
if (tr.flFraction <= TRACE_FRACTION_EQ || tr.fStartSolid) if (tr.flFraction != 1.0f || tr.fStartSolid)
res = 1; res = 1;
else else
res = 0; res = 0;
@ -1421,7 +1422,7 @@ void Waypoint::InitializeVisibility (void)
TraceLine (sourceStand, dest, true, NULL, &tr); TraceLine (sourceStand, dest, true, NULL, &tr);
// check if line of sight to object is not blocked (i.e. visible) // check if line of sight to object is not blocked (i.e. visible)
if (tr.flFraction <= TRACE_FRACTION_EQ || tr.fStartSolid) if (tr.flFraction != 1.0f || tr.fStartSolid)
res |= 1; res |= 1;
shift = (i % 4) << 1; shift = (i % 4) << 1;
@ -2239,7 +2240,7 @@ void Waypoint::CreateBasic (void)
TraceHull (down, up, true, point_hull, NULL, &tr); TraceHull (down, up, true, point_hull, NULL, &tr);
if (POINT_CONTENTS (up) == CONTENTS_SOLID || tr.flFraction <= TRACE_FRACTION_EQ) if (POINT_CONTENTS (up) == CONTENTS_SOLID || tr.flFraction != 1.0f)
{ {
up = down = back; up = down = back;
down.z = ent->v.absmax.z; down.z = ent->v.absmax.z;