mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
parent
1911a45e3f
commit
2689012249
1 changed files with 43 additions and 1 deletions
|
|
@ -409,7 +409,49 @@ waypoint_t *K_GetBestWaypointForMobj(mobj_t *const mobj, waypoint_t *const hint)
|
|||
checkdist = P_AproxDistance(
|
||||
(mobj->x / FRACUNIT) - (checkwaypoint->mobj->x / FRACUNIT),
|
||||
(mobj->y / FRACUNIT) - (checkwaypoint->mobj->y / FRACUNIT));
|
||||
checkdist = P_AproxDistance(checkdist, ((mobj->z / FRACUNIT) - (checkwaypoint->mobj->z / FRACUNIT)) * 4);
|
||||
|
||||
UINT8 zMultiplier = 4; // Heavily weight z distance, for the sake of overlapping paths
|
||||
|
||||
if (hint != NULL)
|
||||
{
|
||||
boolean connectedToHint = (checkwaypoint == hint);
|
||||
|
||||
if (connectedToHint == false && hint->numnextwaypoints > 0)
|
||||
{
|
||||
for (size_t i = 0U; i < hint->numnextwaypoints; i++)
|
||||
{
|
||||
if (hint->nextwaypoints[i] == checkwaypoint)
|
||||
{
|
||||
connectedToHint = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (connectedToHint == false && hint->numprevwaypoints > 0)
|
||||
{
|
||||
for (size_t i = 0U; i < hint->numprevwaypoints; i++)
|
||||
{
|
||||
if (hint->prevwaypoints[i] == checkwaypoint)
|
||||
{
|
||||
connectedToHint = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do not consider z height for next/prev waypoints of current waypoint.
|
||||
// This helps the current waypoint not be behind you when you're taking a jump.
|
||||
if (connectedToHint == true)
|
||||
{
|
||||
zMultiplier = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (zMultiplier > 0)
|
||||
{
|
||||
checkdist = P_AproxDistance(checkdist, ((mobj->z / FRACUNIT) - (checkwaypoint->mobj->z / FRACUNIT)) * zMultiplier);
|
||||
}
|
||||
|
||||
fixed_t rad = (checkwaypoint->mobj->radius / FRACUNIT);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue