mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Limited vertical range on player waypoints
This commit is contained in:
parent
8a19f6f208
commit
1cbb4bea6b
2 changed files with 18 additions and 25 deletions
22
src/k_kart.c
22
src/k_kart.c
|
|
@ -5739,24 +5739,19 @@ void K_KartPlayerAfterThink(player_t *player)
|
|||
|
||||
Input Arguments:-
|
||||
player - The player the next waypoint is being found for
|
||||
closest - Use closest waypoint algorithm, instead of best touching
|
||||
|
||||
Return:-
|
||||
The waypoint that is the player's next waypoint
|
||||
--------------------------------------------------*/
|
||||
static waypoint_t *K_GetPlayerNextWaypoint(player_t *player, boolean closest)
|
||||
static waypoint_t *K_GetPlayerNextWaypoint(player_t *player)
|
||||
{
|
||||
waypoint_t *bestwaypoint = NULL;
|
||||
|
||||
if ((player != NULL) && (player->mo != NULL) && (P_MobjWasRemoved(player->mo) == false))
|
||||
{
|
||||
waypoint_t *waypoint = NULL;
|
||||
waypoint_t *waypoint = K_GetClosestWaypointToMobj(player->mo);
|
||||
boolean updaterespawn = false;
|
||||
|
||||
if (closest == true)
|
||||
waypoint = K_GetClosestWaypointToMobj(player->mo);
|
||||
else
|
||||
waypoint = K_GetBestWaypointTouchingMobj(player->mo);
|
||||
|
||||
bestwaypoint = waypoint;
|
||||
|
||||
// check the waypoint's location in relation to the player
|
||||
|
|
@ -6006,16 +6001,7 @@ static void K_UpdateDistanceFromFinishLine(player_t *const player)
|
|||
else
|
||||
{
|
||||
waypoint_t *finishline = K_GetFinishLineWaypoint();
|
||||
waypoint_t *nextwaypoint = K_GetPlayerNextWaypoint(player, true); //false
|
||||
|
||||
/*
|
||||
if ((nextwaypoint == NULL) && (player->nextwaypoint == NULL))
|
||||
{
|
||||
// Special case: if player nextwaypoint is still NULL, we want to fix that as soon as possible, so use the closest waypoint instead.
|
||||
// This will most likely only happen on map load or player spawn.
|
||||
nextwaypoint = K_GetPlayerNextWaypoint(player, true);
|
||||
}
|
||||
*/
|
||||
waypoint_t *nextwaypoint = K_GetPlayerNextWaypoint(player);
|
||||
|
||||
if (nextwaypoint != NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -221,15 +221,22 @@ waypoint_t *K_GetClosestWaypointToMobj(mobj_t *const mobj)
|
|||
for (i = 0; i < numwaypoints; i++)
|
||||
{
|
||||
checkwaypoint = &waypointheap[i];
|
||||
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));
|
||||
|
||||
if (checkdist < closestdist)
|
||||
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)
|
||||
{
|
||||
closestwaypoint = checkwaypoint;
|
||||
closestdist = checkdist;
|
||||
checkdist = P_AproxDistance(
|
||||
(mobj->x >> FRACBITS) - (checkwaypoint->mobj->x >> FRACBITS),
|
||||
(mobj->y >> FRACBITS) - (checkwaypoint->mobj->y >> FRACBITS));
|
||||
|
||||
if (checkdist < closestdist)
|
||||
{
|
||||
closestwaypoint = checkwaypoint;
|
||||
closestdist = checkdist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue