cosmetic changes

This commit is contained in:
Dmitriy 2015-07-24 14:39:11 +03:00
commit 1d22832979
9 changed files with 436 additions and 434 deletions

View file

@ -22,7 +22,7 @@ int Bot::FindGoal (void)
{
if (strcmp (STRING (pent->v.model), "models/w_backpack.mdl") == 0)
{
int index = waypoint->FindNearest (GetEntityOrigin (pent));
int index = waypoint.FindNearest (GetEntityOrigin (pent));
if (index >= 0 && index < g_numWaypoints)
return m_loosedBombWptIndex = index;
@ -49,13 +49,13 @@ int Bot::FindGoal (void)
switch (m_team)
{
case TEAM_TF:
offensiveWpts = waypoint->m_ctPoints;
defensiveWpts = waypoint->m_terrorPoints;
offensiveWpts = waypoint.m_ctPoints;
defensiveWpts = waypoint.m_terrorPoints;
break;
case TEAM_CF:
offensiveWpts = waypoint->m_terrorPoints;
defensiveWpts = waypoint->m_ctPoints;
offensiveWpts = waypoint.m_terrorPoints;
defensiveWpts = waypoint.m_ctPoints;
break;
}
@ -68,7 +68,7 @@ int Bot::FindGoal (void)
else if (m_team == TEAM_CF && HasHostage ())
{
tactic = 2;
offensiveWpts = waypoint->m_rescuePoints;
offensiveWpts = waypoint.m_rescuePoints;
goto TacticChoosen;
}
@ -100,7 +100,7 @@ int Bot::FindGoal (void)
}
else if ((g_mapType & MAP_DE) && m_team == TEAM_CF)
{
if (g_bombPlanted && GetTaskId () != TASK_ESCAPEFROMBOMB && waypoint->GetBombPosition () != nullvec)
if (g_bombPlanted && GetTaskId () != TASK_ESCAPEFROMBOMB && waypoint.GetBombPosition () != nullvec)
{
if (g_bombSayString)
{
@ -119,7 +119,7 @@ int Bot::FindGoal (void)
{
// send some terrorists to guard planter bomb
if (g_bombPlanted && GetTaskId () != TASK_ESCAPEFROMBOMB && GetBombTimeleft () >= 15.0)
return m_chosenGoalIndex = FindDefendWaypoint (waypoint->GetBombPosition ());
return m_chosenGoalIndex = FindDefendWaypoint (waypoint.GetBombPosition ());
}
goalDesire = Random.Float (0.0f, 100.0f) + offensive;
@ -153,17 +153,17 @@ TacticChoosen:
if (tactic == 0 && !defensiveWpts.IsEmpty ()) // careful goal
FilterGoals (defensiveWpts, goalChoices);
else if (tactic == 1 && !waypoint->m_campPoints.IsEmpty ()) // camp waypoint goal
else if (tactic == 1 && !waypoint.m_campPoints.IsEmpty ()) // camp waypoint goal
{
// pickup sniper points if possible for sniping bots
if (!waypoint->m_sniperPoints.IsEmpty () && UsesSniper ())
FilterGoals (waypoint->m_sniperPoints, goalChoices);
if (!waypoint.m_sniperPoints.IsEmpty () && UsesSniper ())
FilterGoals (waypoint.m_sniperPoints, goalChoices);
else
FilterGoals (waypoint->m_campPoints, goalChoices);
FilterGoals (waypoint.m_campPoints, goalChoices);
}
else if (tactic == 2 && !offensiveWpts.IsEmpty ()) // offensive goal
FilterGoals (offensiveWpts, goalChoices);
else if (tactic == 3 && !waypoint->m_goalPoints.IsEmpty ()) // map goal waypoint
else if (tactic == 3 && !waypoint.m_goalPoints.IsEmpty ()) // map goal waypoint
{
// forcee bomber to select closest goal, if round-start goal was reset by something
if (m_hasC4 && g_timeRoundStart + 20.0f < GetWorldTime ())
@ -173,7 +173,7 @@ TacticChoosen:
for (int i = 0; i < g_numWaypoints; i++)
{
Path *path = waypoint->GetPath (i);
Path *path = waypoint.GetPath (i);
if (!(path->flags & FLAG_GOAL))
continue;
@ -195,17 +195,17 @@ TacticChoosen:
{
if (goalChoices[i] == -1)
{
goalChoices[i] = waypoint->m_goalPoints.GetRandomElement ();
goalChoices[i] = waypoint.m_goalPoints.GetRandomElement ();
InternalAssert (goalChoices[i] >= 0 && goalChoices[i] < g_numWaypoints);
}
}
}
else
FilterGoals (waypoint->m_goalPoints, goalChoices);
FilterGoals (waypoint.m_goalPoints, goalChoices);
}
if (m_currentWaypointIndex == -1 || m_currentWaypointIndex >= g_numWaypoints)
m_currentWaypointIndex = ChangeWptIndex (waypoint->FindNearest (pev->origin));
m_currentWaypointIndex = ChangeWptIndex (waypoint.FindNearest (pev->origin));
if (goalChoices[0] == -1)
return m_chosenGoalIndex = Random.Long (0, g_numWaypoints - 1);
@ -767,9 +767,9 @@ bool Bot::DoWaypointNav (void)
{
if ((m_liftState == LIFT_NO_NEARBY || m_liftState == LIFT_WAITING_FOR) && m_navNode->next != NULL)
{
if (m_navNode->next->index >= 0 && m_navNode->next->index < g_numWaypoints && (waypoint->GetPath (m_navNode->next->index)->flags & FLAG_LIFT))
if (m_navNode->next->index >= 0 && m_navNode->next->index < g_numWaypoints && (waypoint.GetPath (m_navNode->next->index)->flags & FLAG_LIFT))
{
TraceLine (m_currentPath->origin, waypoint->GetPath (m_navNode->next->index)->origin, true, true, GetEntity (), &tr);
TraceLine (m_currentPath->origin, waypoint.GetPath (m_navNode->next->index)->origin, true, true, GetEntity (), &tr);
if (!IsEntityNull (tr.pHit) && (strcmp (STRING (tr.pHit->v.classname), "func_door") == 0 || strcmp (STRING (tr.pHit->v.classname), "func_plat") == 0 || strcmp (STRING (tr.pHit->v.classname), "func_train") == 0))
m_liftEntity = tr.pHit;
@ -801,7 +801,7 @@ bool Bot::DoWaypointNav (void)
// if some bot is following a bot going into lift - he should take the same lift to go
for (int i = 0; i < GetMaxClients (); i++)
{
Bot *bot = botMgr->GetBot (i);
Bot *bot = botMgr.GetBot (i);
if (bot == NULL || bot == this)
continue;
@ -840,7 +840,7 @@ bool Bot::DoWaypointNav (void)
for (int i = 0; i < GetMaxClients (); i++)
{
Bot *bot = botMgr->GetBot (i);
Bot *bot = botMgr.GetBot (i);
if (bot == NULL)
continue; // skip invalid bots
@ -898,7 +898,7 @@ bool Bot::DoWaypointNav (void)
// is lift activated and bot is standing on it and lift is moving ?
if (m_liftState == LIFT_LOOKING_BUTTON_INSIDE || m_liftState == LIFT_ENTERING_IN || m_liftState == LIFT_WAIT_FOR_TEAMMATES || m_liftState == LIFT_WAITING_FOR)
{
if (pev->groundentity == m_liftEntity && m_liftEntity->v.velocity.z != 0 && IsOnFloor () && ((waypoint->GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT) || !IsEntityNull (m_targetEntity)))
if (pev->groundentity == m_liftEntity && m_liftEntity->v.velocity.z != 0 && IsOnFloor () && ((waypoint.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT) || !IsEntityNull (m_targetEntity)))
{
m_liftState = LIFT_TRAVELING_BY;
m_liftUsageTime = GetWorldTime () + 14.0;
@ -941,7 +941,7 @@ bool Bot::DoWaypointNav (void)
if (m_buttonPushTime + 8.0 >= GetWorldTime ())
{
if ((m_prevWptIndex[0] >= 0) && (m_prevWptIndex[0] < g_numWaypoints))
m_destOrigin = waypoint->GetPath (m_prevWptIndex[0])->origin;
m_destOrigin = waypoint.GetPath (m_prevWptIndex[0])->origin;
else
m_destOrigin = pev->origin;
@ -983,7 +983,7 @@ bool Bot::DoWaypointNav (void)
if (liftUsed)
{
if (m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints)
m_destOrigin = waypoint->GetPath (m_prevWptIndex[0])->origin;
m_destOrigin = waypoint.GetPath (m_prevWptIndex[0])->origin;
else
m_destOrigin = button->v.origin;
@ -1016,10 +1016,10 @@ bool Bot::DoWaypointNav (void)
{
if ((m_prevWptIndex[0] >= 0) && (m_prevWptIndex[0] < g_numWaypoints))
{
if (!(waypoint->GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT))
m_destOrigin = waypoint->GetPath (m_prevWptIndex[0])->origin;
if (!(waypoint.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT))
m_destOrigin = waypoint.GetPath (m_prevWptIndex[0])->origin;
else if ((m_prevWptIndex[1] >= 0) && (m_prevWptIndex[0] < g_numWaypoints))
m_destOrigin = waypoint->GetPath (m_prevWptIndex[1])->origin;
m_destOrigin = waypoint.GetPath (m_prevWptIndex[1])->origin;
}
if ((pev->origin - m_destOrigin).GetLengthSquared () < 100)
@ -1040,7 +1040,7 @@ bool Bot::DoWaypointNav (void)
// bot fall down somewhere inside the lift's groove :)
if (pev->groundentity != m_liftEntity && m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints)
{
if ((waypoint->GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT) && (m_currentPath->origin.z - pev->origin.z) > 50.0 && (waypoint->GetPath (m_prevWptIndex[0])->origin.z - pev->origin.z) > 50.0)
if ((waypoint.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT) && (m_currentPath->origin.z - pev->origin.z) > 50.0 && (waypoint.GetPath (m_prevWptIndex[0])->origin.z - pev->origin.z) > 50.0)
{
m_liftState = LIFT_NO_NEARBY;
m_liftEntity = NULL;
@ -1084,7 +1084,7 @@ bool Bot::DoWaypointNav (void)
if (m_prevWptIndex[0] >= 0 && m_prevWptIndex[0] < g_numWaypoints)
{
if (!(waypoint->GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT))
if (!(waypoint.GetPath (m_prevWptIndex[0])->flags & FLAG_LIFT))
ChangeWptIndex (m_prevWptIndex[0]);
else
FindWaypoint ();
@ -1237,13 +1237,13 @@ bool Bot::DoWaypointNav (void)
// bot within 'hearable' bomb tick noises?
if (bombOrigin != nullvec)
{
float distance = (bombOrigin - waypoint->GetPath (GetTask ()->data)->origin).GetLength ();
float distance = (bombOrigin - waypoint.GetPath (GetTask ()->data)->origin).GetLength ();
if (distance > 512.0)
waypoint->SetGoalVisited (GetTask ()->data); // doesn't hear so not a good goal
waypoint.SetGoalVisited (GetTask ()->data); // doesn't hear so not a good goal
}
else
waypoint->SetGoalVisited (GetTask ()->data); // doesn't hear so not a good goal
waypoint.SetGoalVisited (GetTask ()->data); // doesn't hear so not a good goal
}
HeadTowardWaypoint (); // do the actual movement checking
}
@ -1270,7 +1270,7 @@ void Bot::FindShortestPath (int srcIndex, int destIndex)
while (srcIndex != destIndex)
{
srcIndex = *(waypoint->m_pathMatrix + (srcIndex * g_numWaypoints) + destIndex);
srcIndex = *(waypoint.m_pathMatrix + (srcIndex * g_numWaypoints) + destIndex);
if (srcIndex < 0)
{
@ -1415,7 +1415,7 @@ float gfunctionKillsDistT (int currentIndex, int parentIndex)
float cost = (g_experienceData + (currentIndex * g_numWaypoints) + currentIndex)->team0Damage + g_highestDamageT;
Path *current = waypoint->GetPath (currentIndex);
Path *current = waypoint.GetPath (currentIndex);
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
@ -1428,7 +1428,7 @@ float gfunctionKillsDistT (int currentIndex, int parentIndex)
if (current->flags & FLAG_CROUCH)
cost *= 1.5;
return waypoint->GetPathDistance (parentIndex, currentIndex) + cost;
return waypoint.GetPathDistance (parentIndex, currentIndex) + cost;
}
@ -1441,7 +1441,7 @@ float gfunctionKillsDistCT (int currentIndex, int parentIndex)
float cost = (g_experienceData + (currentIndex * g_numWaypoints) + currentIndex)->team1Damage + g_highestDamageCT;
Path *current = waypoint->GetPath (currentIndex);
Path *current = waypoint.GetPath (currentIndex);
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
@ -1454,14 +1454,14 @@ float gfunctionKillsDistCT (int currentIndex, int parentIndex)
if (current->flags & FLAG_CROUCH)
cost *= 1.5;
return waypoint->GetPathDistance (parentIndex, currentIndex) + cost;
return waypoint.GetPathDistance (parentIndex, currentIndex) + cost;
}
float gfunctionKillsDistCTWithHostage (int currentIndex, int parentIndex)
{
// least kills and number of nodes to goal for a team
Path *current = waypoint->GetPath (currentIndex);
Path *current = waypoint.GetPath (currentIndex);
if (current->flags & FLAG_NOHOSTAGE)
return 65355;
@ -1478,7 +1478,7 @@ float gfunctionKillsT (int currentIndex, int)
float cost = (g_experienceData + (currentIndex * g_numWaypoints) + currentIndex)->team0Damage;
Path *current = waypoint->GetPath (currentIndex);
Path *current = waypoint.GetPath (currentIndex);
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
@ -1503,7 +1503,7 @@ float gfunctionKillsCT (int currentIndex, int parentIndex)
float cost = (g_experienceData + (currentIndex * g_numWaypoints) + currentIndex)->team1Damage;
Path *current = waypoint->GetPath (currentIndex);
Path *current = waypoint.GetPath (currentIndex);
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
@ -1526,7 +1526,7 @@ float gfunctionKillsCTWithHostage (int currentIndex, int parentIndex)
if (parentIndex == -1)
return 0;
Path *current = waypoint->GetPath (currentIndex);
Path *current = waypoint.GetPath (currentIndex);
if (current->flags & FLAG_NOHOSTAGE)
return 65355;
@ -1542,8 +1542,8 @@ float gfunctionPathDist (int currentIndex, int parentIndex)
if (parentIndex == -1)
return 0;
Path *parent = waypoint->GetPath (parentIndex);
Path *current = waypoint->GetPath (currentIndex);
Path *parent = waypoint.GetPath (parentIndex);
Path *current = waypoint.GetPath (currentIndex);
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
@ -1561,7 +1561,7 @@ float gfunctionPathDist (int currentIndex, int parentIndex)
float gfunctionPathDistWithHostage (int currentIndex, int parentIndex)
{
Path *current = waypoint->GetPath (currentIndex);
Path *current = waypoint.GetPath (currentIndex);
if (current->flags & FLAG_NOHOSTAGE)
return 65355;
@ -1576,8 +1576,8 @@ float hfunctionSquareDist (int index, int, int goalIndex)
{
// square distance heuristic
Path *start = waypoint->GetPath (index);
Path *goal = waypoint->GetPath (goalIndex);
Path *start = waypoint.GetPath (index);
Path *goal = waypoint.GetPath (goalIndex);
#if 0
float deltaX = fabsf (start->origin.x - goal->origin.x);
@ -1601,7 +1601,7 @@ float hfunctionSquareDistWithHostage (int index, int startIndex, int goalIndex)
{
// square distance heuristic with hostages
if (waypoint->GetPath (startIndex)->flags & FLAG_NOHOSTAGE)
if (waypoint.GetPath (startIndex)->flags & FLAG_NOHOSTAGE)
return 65355;
return hfunctionSquareDist (index, startIndex, goalIndex);
@ -1758,7 +1758,7 @@ void Bot::FindPath (int srcIndex, int destIndex, unsigned char pathType)
// now expand the current node
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
int currentChild = waypoint->GetPath (currentIndex)->index[i];
int currentChild = waypoint.GetPath (currentIndex)->index[i];
if (currentChild == -1)
continue;
@ -1806,20 +1806,20 @@ int Bot::GetAimingWaypoint (const Vector &to)
// return the most distant waypoint which is seen from the bot to the target and is within count
if (m_currentWaypointIndex == -1)
m_currentWaypointIndex = ChangeWptIndex (waypoint->FindNearest (pev->origin));
m_currentWaypointIndex = ChangeWptIndex (waypoint.FindNearest (pev->origin));
int srcIndex = m_currentWaypointIndex;
int destIndex = waypoint->FindNearest (to);
int destIndex = waypoint.FindNearest (to);
int bestIndex = srcIndex;
while (destIndex != srcIndex)
{
destIndex = *(waypoint->m_pathMatrix + (destIndex * g_numWaypoints) + srcIndex);
destIndex = *(waypoint.m_pathMatrix + (destIndex * g_numWaypoints) + srcIndex);
if (destIndex < 0)
break;
if (waypoint->IsVisible (m_currentWaypointIndex, destIndex))
if (waypoint.IsVisible (m_currentWaypointIndex, destIndex))
{
bestIndex = destIndex;
break;
@ -1854,11 +1854,11 @@ bool Bot::FindWaypoint (void)
#endif
continue;
if ((g_mapType & MAP_CS) && HasHostage () && (waypoint->GetPath (i)->flags & FLAG_NOHOSTAGE))
if ((g_mapType & MAP_CS) && HasHostage () && (waypoint.GetPath (i)->flags & FLAG_NOHOSTAGE))
continue;
// ignore non-reacheable waypoints...
if (!waypoint->Reachable (this, i))
if (!waypoint.Reachable (this, i))
continue;
// check if waypoint is already used by another bot...
@ -1869,7 +1869,7 @@ bool Bot::FindWaypoint (void)
}
// now pick 1-2 random waypoints that near the bot
float distance = (waypoint->GetPath (i)->origin - pev->origin).GetLengthSquared ();
float distance = (waypoint.GetPath (i)->origin - pev->origin).GetLengthSquared ();
// now fill the waypoint list
for (int j = 0; j < 3; j++)
@ -1902,7 +1902,7 @@ bool Bot::FindWaypoint (void)
i = 0;
Array <int> found;
waypoint->FindInRadius (found, 256.0f, pev->origin);
waypoint.FindInRadius (found, 256.0f, pev->origin);
if (!found.IsEmpty ())
{
@ -1913,7 +1913,7 @@ bool Bot::FindWaypoint (void)
{
int index = found.Pop ();
if (!waypoint->Reachable (this, index))
if (!waypoint.Reachable (this, index))
continue;
waypointIndeces[i] = index;
@ -2042,7 +2042,7 @@ int Bot::ChangeWptIndex(int waypointIndex)
m_currentWaypointIndex = waypointIndex;
m_navTimeset = GetWorldTime ();
m_currentPath = waypoint->GetPath (m_currentWaypointIndex);
m_currentPath = waypoint.GetPath (m_currentWaypointIndex);
m_waypointFlags = m_currentPath->flags;
return m_currentWaypointIndex; // to satisfy static-code analyzers
@ -2052,7 +2052,7 @@ int Bot::ChooseBombWaypoint (void)
{
// this function finds the best goal (bomb) waypoint for CTs when searching for a planted bomb.
Array <int> goals = waypoint->m_goalPoints;
Array <int> goals = waypoint.m_goalPoints;
if (goals.IsEmpty ())
return Random.Long (0, g_numWaypoints - 1); // reliability check
@ -2069,7 +2069,7 @@ int Bot::ChooseBombWaypoint (void)
// find nearest goal waypoint either to bomb (if "heard" or player)
FOR_EACH_AE (goals, i)
{
float distance = (waypoint->GetPath (goals[i])->origin - bombOrigin).GetLengthSquared ();
float distance = (waypoint.GetPath (goals[i])->origin - bombOrigin).GetLengthSquared ();
// check if we got more close distance
if (distance < lastDistance)
@ -2079,7 +2079,7 @@ int Bot::ChooseBombWaypoint (void)
}
}
while (waypoint->IsGoalVisited (goal))
while (waypoint.IsGoalVisited (goal))
{
goal = goals.GetRandomElement ();
@ -2105,8 +2105,8 @@ int Bot::FindDefendWaypoint (const Vector &origin)
minDistance[i] = 128;
}
int posIndex = waypoint->FindNearest (origin);
int srcIndex = waypoint->FindNearest (pev->origin);
int posIndex = waypoint.FindNearest (origin);
int srcIndex = waypoint.FindNearest (pev->origin);
// some of points not found, return random one
if (srcIndex == -1 || posIndex == -1)
@ -2115,17 +2115,17 @@ int Bot::FindDefendWaypoint (const Vector &origin)
for (int i = 0; i < g_numWaypoints; i++) // find the best waypoint now
{
// exclude ladder & current waypoints
if ((waypoint->GetPath (i)->flags & FLAG_LADDER) || i == srcIndex || !waypoint->IsVisible (i, posIndex) || IsPointOccupied (i))
if ((waypoint.GetPath (i)->flags & FLAG_LADDER) || i == srcIndex || !waypoint.IsVisible (i, posIndex) || IsPointOccupied (i))
continue;
// use the 'real' pathfinding distances
int distances = waypoint->GetPathDistance (srcIndex, i);
int distances = waypoint.GetPathDistance (srcIndex, i);
// skip wayponts with distance more than 1024 units
if (distances > 1248.0f)
continue;
TraceLine (waypoint->GetPath (i)->origin, waypoint->GetPath (posIndex)->origin, true, true, GetEntity (), &tr);
TraceLine (waypoint.GetPath (i)->origin, waypoint.GetPath (posIndex)->origin, true, true, GetEntity (), &tr);
// check if line not hit anything
if (tr.flFraction != 1.0)
@ -2192,7 +2192,7 @@ int Bot::FindDefendWaypoint (const Vector &origin)
for (int i = 0; i < g_numWaypoints; i++)
{
if ((waypoint->GetPath (i)->origin - origin).GetLength () <= 1248.0f && !IsPointOccupied (i))
if ((waypoint.GetPath (i)->origin - origin).GetLength () <= 1248.0f && !IsPointOccupied (i))
found.Push (i);
}
@ -2224,7 +2224,7 @@ int Bot::FindCoverWaypoint (float maxDistance)
maxDistance = 300.0;
int srcIndex = m_currentWaypointIndex;
int enemyIndex = waypoint->FindNearest (m_lastEnemyOrigin);
int enemyIndex = waypoint.FindNearest (m_lastEnemyOrigin);
Array <int> enemyIndices;
int waypointIndex[MAX_PATH_INDEX];
@ -2242,8 +2242,8 @@ int Bot::FindCoverWaypoint (float maxDistance)
// now get enemies neigbouring points
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
if (waypoint->GetPath (enemyIndex)->index[i] != -1)
enemyIndices.Push (waypoint->GetPath (enemyIndex)->index[i]);
if (waypoint.GetPath (enemyIndex)->index[i] != -1)
enemyIndices.Push (waypoint.GetPath (enemyIndex)->index[i]);
}
// ensure we're on valid point
@ -2253,14 +2253,14 @@ int Bot::FindCoverWaypoint (float maxDistance)
for (int i = 0; i < g_numWaypoints; i++)
{
// exclude ladder, current waypoints and waypoints seen by the enemy
if ((waypoint->GetPath (i)->flags & FLAG_LADDER) || i == srcIndex || waypoint->IsVisible (enemyIndex, i))
if ((waypoint.GetPath (i)->flags & FLAG_LADDER) || i == srcIndex || waypoint.IsVisible (enemyIndex, i))
continue;
bool neighbourVisible = false; // now check neighbour waypoints for visibility
FOR_EACH_AE (enemyIndices, j)
{
if (waypoint->IsVisible (enemyIndices[j], i))
if (waypoint.IsVisible (enemyIndices[j], i))
{
neighbourVisible = true;
break;
@ -2272,8 +2272,8 @@ int Bot::FindCoverWaypoint (float maxDistance)
continue;
// use the 'real' pathfinding distances
int distances = waypoint->GetPathDistance (srcIndex, i);
int enemyDistance = waypoint->GetPathDistance (enemyIndex, i);
int distances = waypoint.GetPathDistance (srcIndex, i);
int enemyDistance = waypoint.GetPathDistance (enemyIndex, i);
if (distances >= enemyDistance)
continue;
@ -2337,7 +2337,7 @@ int Bot::FindCoverWaypoint (float maxDistance)
{
if (waypointIndex[i] != -1)
{
TraceLine (m_lastEnemyOrigin + Vector (0, 0, 36), waypoint->GetPath (waypointIndex[i])->origin, true, true, GetEntity (), &tr);
TraceLine (m_lastEnemyOrigin + Vector (0, 0, 36), waypoint.GetPath (waypointIndex[i])->origin, true, true, GetEntity (), &tr);
if (tr.flFraction < 1.0)
return waypointIndex[i];
@ -2366,9 +2366,9 @@ bool Bot::GetBestNextWaypoint (void)
{
int id = m_currentPath->index[i];
if (id != -1 && waypoint->IsConnected (id, m_navNode->next->index) && waypoint->IsConnected (m_currentWaypointIndex, id))
if (id != -1 && waypoint.IsConnected (id, m_navNode->next->index) && waypoint.IsConnected (m_currentWaypointIndex, id))
{
if (waypoint->GetPath (id)->flags & FLAG_LADDER) // don't use ladder waypoints as alternative
if (waypoint.GetPath (id)->flags & FLAG_LADDER) // don't use ladder waypoints as alternative
continue;
if (!IsPointOccupied (id))
@ -2435,7 +2435,7 @@ bool Bot::HeadTowardWaypoint (void)
if (m_baseAgressionLevel < kills && HasPrimaryWeapon ())
{
PushTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + Random.Float (m_difficulty * 0.5, m_difficulty) * 5, true);
PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, FindDefendWaypoint (waypoint->GetPath (nextIndex)->origin), GetWorldTime () + Random.Float (3.0f, 10.0f), true);
PushTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, FindDefendWaypoint (waypoint.GetPath (nextIndex)->origin), GetWorldTime () + Random.Float (3.0f, 10.0f), true);
}
}
else if (g_botsCanPause && !IsOnLadder () && !IsInWater () && !m_currentTravelFlags && IsOnFloor ())
@ -2479,8 +2479,8 @@ bool Bot::HeadTowardWaypoint (void)
{
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
Path *path = waypoint->GetPath (m_navNode->index);
Path *next = waypoint->GetPath (m_navNode->next->index);
Path *path = waypoint.GetPath (m_navNode->index);
Path *next = waypoint.GetPath (m_navNode->next->index);
if (path->index[i] == m_navNode->next->index && (path->connectionFlags[i] & PATHFLAG_JUMP))
{
@ -2500,12 +2500,12 @@ bool Bot::HeadTowardWaypoint (void)
SelectWeaponByName ("weapon_knife"); // draw out the knife if we needed
// bot not already on ladder but will be soon?
if ((waypoint->GetPath (destIndex)->flags & FLAG_LADDER) && !IsOnLadder ())
if ((waypoint.GetPath (destIndex)->flags & FLAG_LADDER) && !IsOnLadder ())
{
// get ladder waypoints used by other (first moving) bots
for (int c = 0; c < GetMaxClients (); c++)
{
Bot *otherBot = botMgr->GetBot (c);
Bot *otherBot = botMgr.GetBot (c);
// if another bot uses this ladder, wait 3 secs
if (otherBot != NULL && otherBot != this && IsAlive (otherBot->GetEntity ()) && otherBot->m_currentWaypointIndex == m_navNode->index)
@ -3112,10 +3112,10 @@ int Bot::GetAimingWaypoint (void)
for (int i = 0; i < g_numWaypoints; i++)
{
if (currentWaypoint == i || !waypoint->IsVisible (currentWaypoint, i))
if (currentWaypoint == i || !waypoint.IsVisible (currentWaypoint, i))
continue;
Path *path = waypoint->GetPath (i);
Path *path = waypoint.GetPath (i);
if (count < 3)
{
@ -3257,7 +3257,7 @@ int Bot::FindPlantedBomb (void)
{
if (strcmp (STRING (bombEntity->v.model) + 9, "c4.mdl") == 0)
{
int nearestIndex = waypoint->FindNearest (GetEntityOrigin (bombEntity));
int nearestIndex = waypoint.FindNearest (GetEntityOrigin (bombEntity));
if (nearestIndex >= 0 && nearestIndex < g_numWaypoints)
return nearestIndex;
@ -3276,7 +3276,7 @@ bool Bot::IsPointOccupied (int index)
// first check if current waypoint of one of the bots is index waypoint
for (int i = 0; i < GetMaxClients (); i++)
{
Bot *bot = botMgr->GetBot (i);
Bot *bot = botMgr.GetBot (i);
if (bot == NULL || bot == this)
continue;
@ -3287,7 +3287,7 @@ bool Bot::IsPointOccupied (int index)
int occupyId = GetShootingConeDeviation (bot->GetEntity (), &pev->origin) >= 0.7f ? bot->m_prevWptIndex[0] : m_currentWaypointIndex;
// length check
float length = (waypoint->GetPath (occupyId)->origin - waypoint->GetPath (index)->origin).GetLengthSquared ();
float length = (waypoint.GetPath (occupyId)->origin - waypoint.GetPath (index)->origin).GetLengthSquared ();
if (occupyId == index || bot->GetTask ()->data == index || length < GET_SQUARE (64.0f))
return true;