diff --git a/src/k_hud.c b/src/k_hud.c index 3857cf159..65ea04239 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2212,7 +2212,7 @@ static void K_drawKartLaps(void) if (numlaps >= 10) { UINT8 ln[2]; - ln[0] = ((stplyr->laps+1 / 10) % 10); + ln[0] = ((stplyr->laps / 10) % 10); ln[1] = (stplyr->laps % 10); V_DrawScaledPatch(fx+13, fy, V_HUDTRANS|splitflags, fontv[PINGNUM_FONT].font[ln[0]]); diff --git a/src/k_kart.c b/src/k_kart.c index 22f9fb2ab..ebfb070fb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10271,32 +10271,47 @@ void K_KartLegacyUpdatePosition(player_t *player) // This checks every thing on the map, and looks for MT_BOSS3WAYPOINT (the thing we're using for checkpoint wp's, for now) for (mo = boss3cap; mo != NULL; mo = mo->tracer) { - pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x, - mo->y - player->mo->y), - mo->z - player->mo->z) / FRACUNIT; - imo = P_AproxDistance(P_AproxDistance( mo->x - players[i].mo->x, - mo->y - players[i].mo->y), - mo->z - players[i].mo->z) / FRACUNIT; + const boolean isprevcheckpointp = mo->health == player->starpostnum; + const boolean isnextcheckpointp = mo->health == (player->starpostnum + 1); - if (mo->health == player->starpostnum && (!mo->movecount || mo->movecount == player->laps+1)) + if ((isprevcheckpointp || isnextcheckpointp) && (!mo->movecount || mo->movecount == player->laps)) { - player->prevcheck += pmo; - ppcd++; + pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x, + mo->y - player->mo->y), + mo->z - player->mo->z) / FRACUNIT; + + if (isprevcheckpointp) + { + player->prevcheck += pmo; + ppcd++; + } + + if (isnextcheckpointp) + { + player->nextcheck += pmo; + pncd++; + } } - if (mo->health == (player->starpostnum + 1) && (!mo->movecount || mo->movecount == player->laps+1)) + + const boolean isprevcheckpointi = mo->health == players[i].starpostnum; + const boolean isnextcheckpointi = mo->health == (players[i].starpostnum + 1); + + if ((isprevcheckpointi || isnextcheckpointi) && (!mo->movecount || mo->movecount == players[i].laps)) { - player->nextcheck += pmo; - pncd++; - } - if (mo->health == players[i].starpostnum && (!mo->movecount || mo->movecount == players[i].laps+1)) - { - players[i].prevcheck += imo; - ipcd++; - } - if (mo->health == (players[i].starpostnum + 1) && (!mo->movecount || mo->movecount == players[i].laps+1)) - { - players[i].nextcheck += imo; - incd++; + imo = P_AproxDistance(P_AproxDistance( mo->x - players[i].mo->x, + mo->y - players[i].mo->y), + mo->z - players[i].mo->z) / FRACUNIT; + + if (isprevcheckpointi) + { + players[i].prevcheck += imo; + ipcd++; + } + if (isnextcheckpointi ) + { + players[i].nextcheck += imo; + incd++; + } } }