From 96f7dcb5b8368d23b8c0d22c23ab3ab06226834b Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 7 Sep 2023 21:52:55 -0400 Subject: [PATCH 1/3] Fix 3/4P position number --- src/k_hud.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/k_hud.c b/src/k_hud.c index 146cc99d5..16a81f12a 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2091,6 +2091,8 @@ static void K_DrawKartPositionNum(INT32 num) fx >>= 1; fy >>= 1; + + fy -= (21 << FRACBITS); } if (trans > 0) From e7642109b7dd6de4e842c49e2222979c7e19560f Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 8 Sep 2023 18:43:18 -0400 Subject: [PATCH 2/3] Fix 4P position numbers > 9 --- src/k_hud.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 16a81f12a..f339cfcad 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1961,13 +1961,13 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, U static fixed_t K_DrawKartPositionNumPatch(UINT8 num, UINT8 *color, fixed_t x, fixed_t y, fixed_t scale, INT32 flags) { - UINT8 splitIndex = (r_splitscreen > 0) ? 1 : 0; + const UINT8 splitIndex = (r_splitscreen > 0) ? 1 : 0; fixed_t w = FRACUNIT; fixed_t h = FRACUNIT; INT32 overlayFlags[2]; INT32 i; - if (num >= 10) + if (num > 9) { return x; // invalid input } @@ -1986,10 +1986,7 @@ static fixed_t K_DrawKartPositionNumPatch(UINT8 num, UINT8 *color, fixed_t x, fi w = SHORT(kp_positionnum[num][0][splitIndex]->width) * scale; h = SHORT(kp_positionnum[num][0][splitIndex]->height) * scale; - if (flags & V_SNAPTORIGHT) - { - x -= w; - } + x -= w; if (flags & V_SNAPTOBOTTOM) { @@ -2006,15 +2003,12 @@ static fixed_t K_DrawKartPositionNumPatch(UINT8 num, UINT8 *color, fixed_t x, fi ); } - if (!(flags & V_SNAPTORIGHT)) - { - x -= w; - } + x += 7 * scale; // push the tens place towards the ones place return x; } -static void K_DrawKartPositionNum(INT32 num) +static void K_DrawKartPositionNum(UINT8 num) { const tic_t counter = (leveltime / 3); // Alternate colors every three frames fixed_t scale = FRACUNIT; @@ -2092,6 +2086,8 @@ static void K_DrawKartPositionNum(INT32 num) fx >>= 1; fy >>= 1; + // We're putting it in the same corner as + // the rest of our HUD, so it needs raised. fy -= (21 << FRACBITS); } @@ -2130,30 +2126,28 @@ static void K_DrawKartPositionNum(INT32 num) color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_POSNUM, GTC_CACHE); } - // Special case for 0 - if (num <= 0) + if ((fflags & V_SNAPTORIGHT) == 0 && num > 9) { - K_DrawKartPositionNumPatch( - 0, color, - fx, fy, scale, V_SPLITSCREEN|fflags - ); - - return; + const UINT8 splitIndex = (r_splitscreen > 0) ? 1 : 0; + UINT8 adjustNum = num; + do + { + fixed_t w = SHORT(kp_positionnum[adjustNum % 10][0][splitIndex]->width) * scale; + fx += w; // these should be the reverse of the + fx -= 7 * scale; // x offsets in K_DrawKartPositionNumPatch + adjustNum /= 10; + } while (adjustNum); } // Draw the number - while (num) + do { - /* - - */ - fx = K_DrawKartPositionNumPatch( (num % 10), color, fx, fy, scale, V_SPLITSCREEN|fflags ); num /= 10; - } + } while (num); } static boolean K_drawKartPositionFaces(void) From 9d3772b15e9bfbc5567bc53f1921b2ba7b9bb292 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 8 Sep 2023 19:05:03 -0400 Subject: [PATCH 3/3] Remove tens -> ones place push Looked better but broke splitscreen again while I wasn't looking, fuck this code --- src/k_hud.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index f339cfcad..b8734468c 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2003,8 +2003,6 @@ static fixed_t K_DrawKartPositionNumPatch(UINT8 num, UINT8 *color, fixed_t x, fi ); } - x += 7 * scale; // push the tens place towards the ones place - return x; } @@ -2133,8 +2131,7 @@ static void K_DrawKartPositionNum(UINT8 num) do { fixed_t w = SHORT(kp_positionnum[adjustNum % 10][0][splitIndex]->width) * scale; - fx += w; // these should be the reverse of the - fx -= 7 * scale; // x offsets in K_DrawKartPositionNumPatch + fx += w; adjustNum /= 10; } while (adjustNum); }