mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-04 07:52:22 +00:00
Sight check for player waypoints
This commit is contained in:
parent
f068539bad
commit
ac1d40d6c5
1 changed files with 8 additions and 2 deletions
|
|
@ -222,10 +222,10 @@ waypoint_t *K_GetClosestWaypointToMobj(mobj_t *const mobj)
|
||||||
{
|
{
|
||||||
checkwaypoint = &waypointheap[i];
|
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));
|
checkdist = abs((mobj->z >> FRACBITS) - (checkwaypoint->mobj->z >> FRACBITS));
|
||||||
|
|
||||||
// TODO: Keep the old version of this function,
|
|
||||||
// make this 128 check a separate function.
|
|
||||||
if (checkdist <= 128)
|
if (checkdist <= 128)
|
||||||
{
|
{
|
||||||
checkdist = P_AproxDistance(
|
checkdist = P_AproxDistance(
|
||||||
|
|
@ -234,6 +234,12 @@ waypoint_t *K_GetClosestWaypointToMobj(mobj_t *const mobj)
|
||||||
|
|
||||||
if (checkdist < closestdist)
|
if (checkdist < closestdist)
|
||||||
{
|
{
|
||||||
|
if (!P_CheckSight(mobj, checkwaypoint->mobj))
|
||||||
|
{
|
||||||
|
// Save sight checks for the end, so we only do it if we have to
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
closestwaypoint = checkwaypoint;
|
closestwaypoint = checkwaypoint;
|
||||||
closestdist = checkdist;
|
closestdist = checkdist;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue