Prevent finishline ever being your prevwaypoint

This commit is contained in:
Sally Coolatta 2022-11-26 17:42:56 -05:00
parent 05e74c3e9d
commit 63ae0ea6bd
2 changed files with 7 additions and 2 deletions

View file

@ -9067,6 +9067,11 @@ static waypoint_t *K_GetPlayerNextWaypoint(player_t *player)
if (angledelta < nextbestdelta && momdelta < nextbestmomdelta)
{
if (waypoint->prevwaypoints[i] == finishline) // NEVER allow finish line.
{
continue;
}
if (P_TraceWaypointTraversal(player->mo, waypoint->prevwaypoints[i]->mobj) == false)
{
// Save sight checks when all of the other checks pass, so we only do it if we have to

View file

@ -361,7 +361,7 @@ waypoint_t *K_GetBestWaypointForMobj(mobj_t *const mobj)
// remember: huge radius
if (closestdist <= rad && checkdist <= rad && finishline != NULL)
{
if (!P_TraceBlockingLines(mobj, checkwaypoint->mobj)) // Intentionally not P_TraceWaypointTraversal
if (!P_TraceWaypointTraversal(mobj, checkwaypoint->mobj))
{
// Save sight checks when all of the other checks pass, so we only do it if we have to
continue;
@ -379,7 +379,7 @@ waypoint_t *K_GetBestWaypointForMobj(mobj_t *const mobj)
}
else if (checkdist < closestdist && bestfindist == INT32_MAX)
{
if (!P_TraceBlockingLines(mobj, checkwaypoint->mobj)) // Intentionally not P_TraceWaypointTraversal
if (!P_TraceWaypointTraversal(mobj, checkwaypoint->mobj))
{
// Save sight checks when all of the other checks pass, so we only do it if we have to
continue;