From 9a7af6c5929484f9df2967432af0d8fa7e6084a4 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 4 Mar 2024 01:42:29 -0800 Subject: [PATCH 1/2] srb2::Draw: add fonts kRollingNum and kRollingNum4P --- src/hu_stuff.c | 9 +++++++++ src/hu_stuff.h | 2 ++ src/v_draw.cpp | 6 ++++++ src/v_draw.hpp | 2 ++ src/v_video.cpp | 14 ++++++++++++++ 5 files changed, 33 insertions(+) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 7a4157def..61d925aba 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -319,6 +319,15 @@ void HU_Init(void) PR ("PRFN"); REG; + DIM ('0', 10); + DIG (2); + + PR ("ROLNUM"); + REG; + + PR ("RO4NUM"); + REG; + DIG (3); ADIM (KART); diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 94130c7fb..487b06e1a 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -80,6 +80,8 @@ enum X (NIGHTSNUM), X (PINGNUM), X (PROFNUM), + X (ROLNUM), + X (RO4NUM), X (KART), X (TIMER), diff --git a/src/v_draw.cpp b/src/v_draw.cpp index e611b41a4..a668f98d0 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -308,6 +308,12 @@ int Draw::font_to_fontno(Font font) case Font::kMedium: return MED_FONT; + + case Font::kRollingNum: + return ROLNUM_FONT; + + case Font::kRollingNum4P: + return RO4NUM_FONT; } return TINY_FONT; diff --git a/src/v_draw.hpp b/src/v_draw.hpp index 2f6be5d25..8b0441537 100644 --- a/src/v_draw.hpp +++ b/src/v_draw.hpp @@ -41,6 +41,8 @@ public: kThinTimer, kMenu, kMedium, + kRollingNum, + kRollingNum4P, }; enum class Align diff --git a/src/v_video.cpp b/src/v_video.cpp index 06991d0e5..50c431e3d 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -2342,6 +2342,12 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result) case PINGF_FONT: result->spacew = 3; break; + case ROLNUM_FONT: + result->spacew = 17; + break; + case RO4NUM_FONT: + result->spacew = 9; + break; } switch (fontno) @@ -2373,6 +2379,12 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result) case PINGF_FONT: result->lfh = 10; break; + case ROLNUM_FONT: + result->lfh = 33; + break; + case RO4NUM_FONT: + result->lfh = 15; + break; } switch (fontno) @@ -2432,6 +2444,8 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result) break; case OPPRF_FONT: case PINGF_FONT: + case ROLNUM_FONT: + case RO4NUM_FONT: if (result->chw) result->dim_fn = FixedCharacterDim; else From c3f852ddafcc5cfd30a677cccd42ccd699d3961b Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 4 Mar 2024 01:43:26 -0800 Subject: [PATCH 2/2] Draw numbers for roulette items that give more than 1 - Bottom centered - Except orbinaut x2, x3, x4 - Except ballhog x5 --- src/k_hud.cpp | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/k_hud.cpp b/src/k_hud.cpp index e7b2f2c6b..a1ebc1091 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -1371,6 +1371,7 @@ static void K_drawKartItem(void) // Set to 'no item' just in case. const UINT8 offset = ((r_splitscreen > 1) ? 1 : 0); patch_t *localpatch[3] = { kp_nodraw, kp_nodraw, kp_nodraw }; + UINT8 localamt[3] = {0, 0, 0}; patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]); patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]); INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags... @@ -1403,14 +1404,19 @@ static void K_drawKartItem(void) { case KITEM_INVINCIBILITY: localpatch[i] = localinv; + localamt[i] = amt; break; case KITEM_ORBINAUT: localpatch[i] = kp_orbinaut[(offset ? 4 : std::min(amt-1, 3))]; + if (amt > 4) + localamt[i] = amt; break; default: localpatch[i] = K_GetCachedItemPatch(item, offset); + if (item != KITEM_BALLHOG || amt != 5) + localamt[i] = amt; break; } } @@ -1586,25 +1592,35 @@ static void K_drawKartItem(void) V_SLIDEIN|fflags ); - V_DrawFixedPatch( - fx< 1) + { + using srb2::Draw; + Draw( + fx + rouletteCrop.x + FixedToFloat(rouletteSpace/2), + fy + rouletteCrop.y + FixedToFloat(rouletteOffset + y + rouletteSpace) - (r_splitscreen > 1 ? 15 : 33)) + .font(r_splitscreen > 1 ? Draw::Font::kRollingNum4P : Draw::Font::kRollingNum) + .align(Draw::Align::kCenter) + .flags(V_HUDTRANS|V_SLIDEIN|fflags) + .colormap(colormap) + .text("{}", localamt[i]); + } + }; + + draw_item(rouletteSpace, 0); + draw_item(-rouletteSpace, 2); if (stplyr->itemRoulette.active == true) { // Draw the item underneath the box. - V_DrawFixedPatch( - fx<