From 0fc8077375ca466ac6b3463ef45b02136e460f2a Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Sat, 24 May 2025 17:35:51 -0400 Subject: [PATCH] Duel uses internal 99 laps --- src/k_kart.c | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 94f5e9cef..5bde7b66c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -297,7 +297,7 @@ void K_TimerInit(void) } if (K_InRaceDuel()) - numlaps = 1; + numlaps = 99; } } @@ -9780,14 +9780,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->amppickup--; } - // ACHTUNG TEMPORARY FUCKUP. - // Disable skip protection in Race Duel because of distance jumps in infinite-lap contexts. - // This shouldn't exist at all in release 2.4, so this is probably fine, right...? - if (K_InRaceDuel()) - { - player->pflags |= PF_TRUSTWAYPOINTS; - } - // Don't tick down while in damage state. // There may be some maps where the timer activates for @@ -11081,28 +11073,15 @@ static void K_UpdateDistanceFromFinishLine(player_t *const player) } Z_Free(pathtofinish.array); - if (K_InRaceDuel() && player->position == 1) + // distancetofinish is currently a flat distance to the finish line, but in order to be fully + // correct we need to add to it the length of the entire circuit multiplied by the number of laps + // left after this one. This will give us the total distance to the finish line, and allow item + // distance calculation to work easily + const mapheader_t *mapheader = mapheaderinfo[gamemap - 1]; + if ((mapheader->levelflags & LF_SECTIONRACE) == 0U) { - // As far as we're concerned, the race starts and ends with our position. - // Don't care about laps at all! - } - else - { - // distancetofinish is currently a flat distance to the finish line, but in order to be fully - // correct we need to add to it the length of the entire circuit multiplied by the number of laps - // left after this one. This will give us the total distance to the finish line, and allow item - // distance calculation to work easily - const mapheader_t *mapheader = mapheaderinfo[gamemap - 1]; - if ((mapheader->levelflags & LF_SECTIONRACE) == 0U) - { - UINT8 numfulllapsleft = ((UINT8)numlaps - player->laps) / mapheader->lapspersection; - if (K_InRaceDuel()) - { - player_t *opp = K_DuelOpponent(player); - numfulllapsleft = opp->laps - player->laps; - } - player->distancetofinish += numfulllapsleft * K_GetCircuitLength(); - } + UINT8 numfulllapsleft = ((UINT8)numlaps - player->laps) / mapheader->lapspersection; + player->distancetofinish += numfulllapsleft * K_GetCircuitLength(); } } }