Misc waypoint fixes, make bogus finish line waypoints work

This commit is contained in:
GenericHeroGuy 2025-05-03 22:41:09 +02:00
parent 54a628bdfd
commit 144b93f262
3 changed files with 13 additions and 5 deletions

View file

@ -8382,6 +8382,11 @@ static boolean K_SetPlayerNextWaypoint(player_t *player)
if (bestwaypoint != NULL)
{
player->currentwaypoint = bestwaypoint;
// if currentwaypoint is the finish line, don't set nextwaypoint to it!
// fixes bigwaypointgap triggering if we're facing the back of the finish line
if (bestwaypoint == finishline)
bestwaypoint = NULL;
}
// check the waypoint's location in relation to the player
@ -8499,7 +8504,8 @@ static boolean K_SetPlayerNextWaypoint(player_t *player)
}
if ((waypoint->prevwaypoints != NULL) && (waypoint->numprevwaypoints > 0U)
&& !(K_PlayerUsesBotMovement(player))) // Bots do not need prev waypoints
&& !(K_PlayerUsesBotMovement(player)) // Bots do not need prev waypoints
&& waypoint != finishline) // do not check finish line's prevwaypoints
{
for (i = 0U; i < waypoint->numprevwaypoints; i++)
{

View file

@ -2179,14 +2179,14 @@ static waypoint_t *K_SetupWaypoint(mobj_t *const mobj)
firstwaypoint = thiswaypoint;
}
if (K_GetWaypointIsFinishline(thiswaypoint))
if (K_GetWaypointIsFinishline(thiswaypoint) && K_GetWaypointIsEnabled(thiswaypoint))
{
if (finishline != NULL)
{
const INT32 oldfinishlineid = K_GetWaypointID(finishline);
const INT32 thiswaypointid = K_GetWaypointID(thiswaypoint);
CONS_Alert(
CONS_WARNING, "Multiple finish line waypoints with IDs %d and %d! Using %d.",
CONS_WARNING, "Multiple finish line waypoints with IDs %d and %d! Using %d.\n",
oldfinishlineid, thiswaypointid, thiswaypointid);
}
finishline = thiswaypoint;

View file

@ -2051,7 +2051,7 @@ static void K_HandleLapIncrement(player_t *player)
player->karthud[khud_lapanimation] = 80;
}
if (netgame && player->laps >= numlaps)
if (netgame && player->laps > numlaps)
CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players]));
if (P_IsDisplayPlayer(player))
@ -2135,7 +2135,9 @@ static void K_HandleLapDecrement(player_t *player)
{
if (player)
{
if ((player->starpostnum == 0) && (player->laps > 0))
if (K_IgnoreFinishLine(player))
return;
if (player->laps > 0)
{
player->starpostnum = numstarposts;
player->laps--;