From 3888bf95f25a80f0affbee48b4ca91773c65333b Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Thu, 7 Dec 2023 17:56:16 -0500 Subject: [PATCH 1/3] Make powerup HUD disableable via Lua --- src/lua_hud.h | 1 + src/lua_hudlib.c | 1 + src/st_stuff.c | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lua_hud.h b/src/lua_hud.h index ba102f2f4..dab5cc3ca 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -19,6 +19,7 @@ enum hud { hud_stagetitle = 0, hud_textspectator, hud_crosshair, + hud_powerup, // Singleplayer / Co-op hud_score, hud_time, diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 2e6721a3a..42c180b98 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -40,6 +40,7 @@ static const char *const hud_disable_options[] = { "stagetitle", "textspectator", "crosshair", + "powerup", "score", "time", diff --git a/src/st_stuff.c b/src/st_stuff.c index a97537978..e9e761192 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2795,14 +2795,14 @@ static void ST_overlayDrawer(void) || ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase)) { ST_drawFirstPersonHUD(); - if (cv_powerupdisplay.value) + if (cv_powerupdisplay.value && LUA_HudEnabled(hud_powerup)) ST_drawPowerupHUD(); // same as it ever was... } - else if (cv_powerupdisplay.value == 2) + else if (cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerup)) ST_drawPowerupHUD(); // same as it ever was... } - else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2) + else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerup)) ST_drawPowerupHUD(); // same as it ever was... if (!(netgame || multiplayer) || !hu_showscores) From 408021b9f5e9608346a9d6cdad255a32684ce78d Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Fri, 8 Dec 2023 09:27:57 -0500 Subject: [PATCH 2/3] Change hud_powerup to hud_powerups for consistency --- src/lua_hud.h | 2 +- src/lua_hudlib.c | 2 +- src/st_stuff.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lua_hud.h b/src/lua_hud.h index dab5cc3ca..5627aaca9 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -19,7 +19,7 @@ enum hud { hud_stagetitle = 0, hud_textspectator, hud_crosshair, - hud_powerup, + hud_powerups, // Singleplayer / Co-op hud_score, hud_time, diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 42c180b98..cd374d7af 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -40,7 +40,7 @@ static const char *const hud_disable_options[] = { "stagetitle", "textspectator", "crosshair", - "powerup", + "powerups", "score", "time", diff --git a/src/st_stuff.c b/src/st_stuff.c index e9e761192..0caf38143 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2795,14 +2795,14 @@ static void ST_overlayDrawer(void) || ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase)) { ST_drawFirstPersonHUD(); - if (cv_powerupdisplay.value && LUA_HudEnabled(hud_powerup)) + if (cv_powerupdisplay.value && LUA_HudEnabled(hud_powerups)) ST_drawPowerupHUD(); // same as it ever was... } - else if (cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerup)) + else if (cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerups)) ST_drawPowerupHUD(); // same as it ever was... } - else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerup)) + else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerups)) ST_drawPowerupHUD(); // same as it ever was... if (!(netgame || multiplayer) || !hu_showscores) From 698dd624fb4d11b0d153ee9c308ba566963064cd Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Fri, 8 Dec 2023 09:39:34 -0500 Subject: [PATCH 3/3] Add check for hud_powerups to SCR_ClosedCaptions --- src/screen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/screen.c b/src/screen.c index 3c50ec67e..b8aa63b9c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -44,6 +44,8 @@ // SRB2Kart #include "r_fps.h" // R_GetFramerateCap +#include "lua_hud.h" // LUA_HudEnabled + // -------------------------------------------- // assembly or c drawer routines for 8bpp/16bpp // -------------------------------------------- @@ -565,6 +567,7 @@ void SCR_ClosedCaptions(void) basey -= 8; else if ((modeattacking == ATTACKING_NIGHTS) || (!(maptol & TOL_NIGHTS) + && LUA_HudEnabled(hud_powerups) && ((cv_powerupdisplay.value == 2) // "Always" || (cv_powerupdisplay.value == 1 && !camera.chase)))) // "First-person only" basey -= 16;