From 09a6c9a086dc567aa6c6ce7bd46fee525a0f579a Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 13 Mar 2023 18:40:01 -0700 Subject: [PATCH 1/3] Lives cap 9 -> 10 --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index dc6490fcf..542efbfad 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -548,8 +548,8 @@ void P_GivePlayerLives(player_t *player, INT32 numlives) { player->lives += numlives; - if (player->lives > 9) - player->lives = 9; + if (player->lives > 10) + player->lives = 10; else if (player->lives < 1) player->lives = 1; } From aed6e06ea56ede07fdc6b8f4c303dc406442c510 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 13 Mar 2023 18:42:56 -0700 Subject: [PATCH 2/3] Add tens place digit to lives count HUD --- src/k_hud.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index bfa92b4c8..2b3168eb9 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2560,7 +2560,11 @@ static void K_drawRingCounter(void) UINT8 *colormap = R_GetTranslationColormap(stplyr->skin, stplyr->skincolor, GTC_CACHE); V_DrawMappedPatch(fr+21, fy-13, V_HUDTRANS|V_SLIDEIN|splitflags, faceprefix[stplyr->skin][FACE_MINIMAP], colormap); if (stplyr->lives >= 0) - V_DrawScaledPatch(fr+34, fy-10, V_HUDTRANS|V_SLIDEIN|splitflags, fontv[PINGNUM_FONT].font[(stplyr->lives % 10)]); // make sure this doesn't overflow OR underflow + { + // make sure this doesn't overflow OR underflow + V_DrawScaledPatch(fr+34, fy-10, V_HUDTRANS|V_SLIDEIN|splitflags, fontv[PINGNUM_FONT].font[(stplyr->lives / 10 % 10)]); + V_DrawScaledPatch(fr+38, fy-10, V_HUDTRANS|V_SLIDEIN|splitflags, fontv[PINGNUM_FONT].font[(stplyr->lives % 10)]); + } } } else @@ -2598,9 +2602,13 @@ static void K_drawRingCounter(void) if (uselives) { UINT8 *colormap = R_GetTranslationColormap(stplyr->skin, stplyr->skincolor, GTC_CACHE); - V_DrawMappedPatch(LAPS_X+46, fy-5, V_HUDTRANS|V_SLIDEIN|splitflags, faceprefix[stplyr->skin][FACE_RANK], colormap); + V_DrawMappedPatch(LAPS_X+40, fy-5, V_HUDTRANS|V_SLIDEIN|splitflags, faceprefix[stplyr->skin][FACE_RANK], colormap); if (stplyr->lives >= 0) - V_DrawScaledPatch(LAPS_X+63, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_facenum[(stplyr->lives % 10)]); // make sure this doesn't overflow OR underflow + { + // make sure this doesn't overflow OR underflow + V_DrawScaledPatch(LAPS_X+57, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_facenum[(stplyr->lives / 10 % 10)]); + V_DrawScaledPatch(LAPS_X+63, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_facenum[(stplyr->lives % 10)]); + } } } } From 82866f74d0092252045ced14993faabcaf7b5e41 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 15 Mar 2023 23:23:06 -0700 Subject: [PATCH 3/3] Use only single digit if less than ten lives in HUD --- src/k_hud.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 2b3168eb9..e5b0050b0 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2473,6 +2473,19 @@ static void K_drawKartLaps(void) #define RINGANIM_FLIPFRAME (RINGANIM_NUMFRAMES/2) +static void K_DrawLivesDigits(INT32 x, INT32 y, INT32 width, INT32 flags, patch_t *font[10]) +{ + const SINT8 tens = stplyr->lives / 10; + + if (tens) + { + V_DrawScaledPatch(x, y, flags, font[tens % 10]); + x += width; + } + + V_DrawScaledPatch(x, y, flags, font[stplyr->lives % 10]); +} + static void K_drawRingCounter(void) { const boolean uselives = G_GametypeUsesLives(); @@ -2560,11 +2573,7 @@ static void K_drawRingCounter(void) UINT8 *colormap = R_GetTranslationColormap(stplyr->skin, stplyr->skincolor, GTC_CACHE); V_DrawMappedPatch(fr+21, fy-13, V_HUDTRANS|V_SLIDEIN|splitflags, faceprefix[stplyr->skin][FACE_MINIMAP], colormap); if (stplyr->lives >= 0) - { - // make sure this doesn't overflow OR underflow - V_DrawScaledPatch(fr+34, fy-10, V_HUDTRANS|V_SLIDEIN|splitflags, fontv[PINGNUM_FONT].font[(stplyr->lives / 10 % 10)]); - V_DrawScaledPatch(fr+38, fy-10, V_HUDTRANS|V_SLIDEIN|splitflags, fontv[PINGNUM_FONT].font[(stplyr->lives % 10)]); - } + K_DrawLivesDigits(fr+34, fy-10, 4, V_HUDTRANS|V_SLIDEIN|splitflags, fontv[PINGNUM_FONT].font); } } else @@ -2604,11 +2613,7 @@ static void K_drawRingCounter(void) UINT8 *colormap = R_GetTranslationColormap(stplyr->skin, stplyr->skincolor, GTC_CACHE); V_DrawMappedPatch(LAPS_X+40, fy-5, V_HUDTRANS|V_SLIDEIN|splitflags, faceprefix[stplyr->skin][FACE_RANK], colormap); if (stplyr->lives >= 0) - { - // make sure this doesn't overflow OR underflow - V_DrawScaledPatch(LAPS_X+57, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_facenum[(stplyr->lives / 10 % 10)]); - V_DrawScaledPatch(LAPS_X+63, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_facenum[(stplyr->lives % 10)]); - } + K_DrawLivesDigits(LAPS_X + (stplyr->lives < 10 ? 60 : 57), fy, 6, V_HUDTRANS|V_SLIDEIN|splitflags, kp_facenum); } } }