From 49ec730531337947fc9492e56f61e0e98e949a03 Mon Sep 17 00:00:00 2001 From: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Wed, 15 Nov 2023 01:51:07 -0300 Subject: [PATCH] "Show Kills Percentage" setting --- CHANGELOG.md | 1 + README.md | 1 + src/doomstat.c | 1 + src/doomstat.h | 1 + src/hu_stuff.c | 12 +++++++++--- src/m_menu.c | 8 +++++--- src/m_misc.c | 7 +++++++ 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b81b7ea53..c0005fe31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Ammo and Health icons; - Toggle to apply patch offsets. - **Further Extended HUD color customization** +- **_Show Kills Percentage [in Stats display]_ setting** - **_Direct Vertical Aiming_ for melee attacks** - **_Disable Melee Snapping_ setting** diff --git a/README.md b/README.md index aa9d77543..09d342170 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ For these settings, their CVAR names are provided alongside the _CFG-Only_ label - _**Alternative Arms Display**_ setting, to show the Chainsaw or SSG's availability on the Arms widget in place of the trivial Pistol - **Blink Missing Keys** setting (CFG-Only: `blink_keys`) [partially p.f. Crispy Doom] - _**Smart Totals**_ setting [p.f. So Doom] +- _**Show Kills Percentage [in Stats display]**_ setting - **Event Timers:** - _"Use" Button Timer_ [p.f. Crispy Doom]; - _Teleport Timer_ [i.b. the above]; diff --git a/src/doomstat.c b/src/doomstat.c index 7d4fabc87..02cb0af12 100644 --- a/src/doomstat.c +++ b/src/doomstat.c @@ -195,6 +195,7 @@ int show_ssg; // CFG-Only int alt_arms; int blink_keys; // CFG-Only int smarttotals; +int hud_kills_percentage; int event_timers[NUMTIMERS]; int hudcolor_time_scale; diff --git a/src/doomstat.h b/src/doomstat.h index cc4c03d51..384d62d77 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -533,6 +533,7 @@ extern int show_ssg; // CFG-Only extern int alt_arms; extern int blink_keys; // CFG-Only extern int smarttotals; +extern int hud_kills_percentage; typedef enum { TIMER_USE, diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 67699a6a0..97ad22a3b 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1296,7 +1296,10 @@ static void HU_widget_build_monsec(void) if ((hud_threelined_widgets && !st_crispyhud) || (st_crispyhud && nughud.sts_ml)) // [Nugget] NUGHUD { - sprintf(hud_monsecstr + offset, " \x1b%c%d%%", kills_percent_color, kills_percent); + // [Nugget] + if (hud_kills_percentage) + { sprintf(hud_monsecstr + offset, " \x1b%c%d%%", kills_percent_color, kills_percent); } + HUlib_add_string_to_cur_line(&w_monsec, hud_monsecstr); sprintf(hud_monsecstr, "\x1b%cI \x1b%c%d/%d", ('0'+hudcolor_items), items_color, items, totalitems); @@ -1307,9 +1310,12 @@ static void HU_widget_build_monsec(void) } else { + // [Nugget] + if (hud_kills_percentage) + { offset += sprintf(hud_monsecstr + offset, " \x1b%c%d%%", kills_percent_color, kills_percent); } + sprintf(hud_monsecstr + offset, - " \x1b%c%d%% \x1b%cI \x1b%c%d/%d \x1b%cS \x1b%c%d/%d", - kills_percent_color, kills_percent, + " \x1b%cI \x1b%c%d/%d \x1b%cS \x1b%c%d/%d", '0'+hudcolor_items, items_color, items, totalitems, '0'+hudcolor_secrets, secrets_color, secrets, totalsecret); diff --git a/src/m_menu.c b/src/m_menu.c index 31736e9b9..89021b634 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3659,6 +3659,7 @@ enum { stat4_powers, stat4_altarms, stat4_smart, + stat4_killspct, stat4_stub2, stat4_title2, stat4_timeruse, @@ -3670,9 +3671,10 @@ setup_menu_t stat_settings4[] = { {"Nugget - Extended HUD", S_SKIP|S_TITLE, m_null, M_X, M_Y + stat4_title1 * M_SPC}, - {"Show Powerup Timers", S_YESNO|S_COSMETIC, m_null, M_X, M_Y + stat4_powers * M_SPC, {"hud_power_timers"}}, - {"Alternative Arms Display", S_YESNO, m_null, M_X, M_Y + stat4_altarms * M_SPC, {"alt_arms"}}, - {"Smart Totals", S_YESNO, m_null, M_X, M_Y + stat4_smart * M_SPC, {"smarttotals"}}, + {"Show Powerup Timers", S_YESNO|S_COSMETIC, m_null, M_X, M_Y + stat4_powers * M_SPC, {"hud_power_timers"}}, + {"Alternative Arms Display", S_YESNO, m_null, M_X, M_Y + stat4_altarms * M_SPC, {"alt_arms"}}, + {"Smart Totals", S_YESNO, m_null, M_X, M_Y + stat4_smart * M_SPC, {"smarttotals"}}, + {"Show Kills Percentage", S_YESNO, m_null, M_X, M_Y + stat4_killspct * M_SPC, {"hud_kills_percentage"}}, {"", S_SKIP, m_null, M_X, M_Y + stat4_stub2 * M_SPC}, {"Nugget - Event Timers", S_SKIP|S_TITLE, m_null, M_X, M_Y + stat4_title2 * M_SPC}, diff --git a/src/m_misc.c b/src/m_misc.c index a6e816a7c..bb2e21966 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -3365,6 +3365,13 @@ default_t defaults[] = { "1 to enable Smart Totals" }, + { // [Nugget] + "hud_kills_percentage", + (config_t *) &hud_kills_percentage, NULL, + {1}, {0,1}, number, ss_stat, wad_no, + "1 to show Kills percentage in Stats display" + }, + // [Nugget] Extended HUD colors /------------------------------------------- {