mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-25 19:43:22 +00:00
Instead of vertical cap, quadruple z axis distance
Far more natural results!
This commit is contained in:
parent
ac1d40d6c5
commit
7fff21acd4
1 changed files with 12 additions and 16 deletions
|
|
@ -223,26 +223,22 @@ waypoint_t *K_GetClosestWaypointToMobj(mobj_t *const mobj)
|
|||
checkwaypoint = &waypointheap[i];
|
||||
|
||||
// TODO: Keep the old version of this function,
|
||||
// make this 128 check & sight checks a separate function.
|
||||
checkdist = abs((mobj->z >> FRACBITS) - (checkwaypoint->mobj->z >> FRACBITS));
|
||||
// make the vertical axis faking & sight checks a separate function.
|
||||
checkdist = P_AproxDistance(
|
||||
(mobj->x >> FRACBITS) - (checkwaypoint->mobj->x >> FRACBITS),
|
||||
(mobj->y >> FRACBITS) - (checkwaypoint->mobj->y >> FRACBITS));
|
||||
checkdist = P_AproxDistance(checkdist, ((mobj->z >> FRACBITS) - (checkwaypoint->mobj->z >> FRACBITS)) << 2);
|
||||
|
||||
if (checkdist <= 128)
|
||||
if (checkdist < closestdist)
|
||||
{
|
||||
checkdist = P_AproxDistance(
|
||||
(mobj->x >> FRACBITS) - (checkwaypoint->mobj->x >> FRACBITS),
|
||||
(mobj->y >> FRACBITS) - (checkwaypoint->mobj->y >> FRACBITS));
|
||||
|
||||
if (checkdist < closestdist)
|
||||
if (!P_CheckSight(mobj, checkwaypoint->mobj))
|
||||
{
|
||||
if (!P_CheckSight(mobj, checkwaypoint->mobj))
|
||||
{
|
||||
// Save sight checks for the end, so we only do it if we have to
|
||||
continue;
|
||||
}
|
||||
|
||||
closestwaypoint = checkwaypoint;
|
||||
closestdist = checkdist;
|
||||
// Save sight checks for the end, so we only do it if we have to
|
||||
continue;
|
||||
}
|
||||
|
||||
closestwaypoint = checkwaypoint;
|
||||
closestdist = checkdist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue