From 4bb24678bb22301ed7e1fa54e87b930e42556fa3 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 19 Aug 2024 00:50:03 +0200 Subject: [PATCH] HUD editor: fix Chat, Vote and StrafeHud panels being visible while the settings menu of another panel is open --- qcsrc/client/hud/panel/centerprint.qc | 2 +- qcsrc/client/hud/panel/chat.qc | 6 ++++-- qcsrc/client/hud/panel/strafehud.qc | 2 +- qcsrc/client/hud/panel/vote.qc | 8 +++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 1e388c4d8..551894abf 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -192,7 +192,7 @@ void HUD_CenterPrint() } if (time > hud_configure_cp_generation_time) { - if(highlightedPanel == HUD_PANEL(CENTERPRINT)) + if (highlightedPanel == panel) { centerprint_SetTitle(sprintf(_("Title at %s"), seconds_tostring(hud_configure_cp_generation_time))); diff --git a/qcsrc/client/hud/panel/chat.qc b/qcsrc/client/hud/panel/chat.qc index 448b9f408..a4e1b64d7 100644 --- a/qcsrc/client/hud/panel/chat.qc +++ b/qcsrc/client/hud/panel/chat.qc @@ -159,14 +159,16 @@ void HUD_Chat() if(autocvar__hud_configure) { + float alpha = 1; // engine can display chat only at full alpha + if (hud_configure_menu_open == 2 && highlightedPanel != panel) + alpha = hud_fade_alpha; // fade only when the settings menu of another panel is open vector chatsize = '1 1 0' * autocvar_con_chatsize; if (cvar_string("con_chatrect_x") != "9001") cvar_set("con_chatrect_x", "9001"); // over 9000, we'll fake it instead for more control over alpha and such string str = textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors); for(int i = 0; i < autocvar_con_chat; ++i) { - // engine displays chat text at full alpha - drawcolorcodedstring(pos, str, chatsize, 1, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos, str, chatsize, alpha, DRAWFLAG_NORMAL); pos.y += chatsize.y; } } diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index a9a8ce3aa..66fd55bf0 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -1218,7 +1218,7 @@ void StrafeHUD_drawGradient(vector color1, vector color2, vector size, float ori float color_ratio, alpha1, alpha2; vector segment_size = size; alpha1 = bound(0, alpha, 1); - alpha2 = bound(0, autocvar_hud_panel_strafehud_bar_neutral_alpha, 1); + alpha2 = bound(0, autocvar_hud_panel_strafehud_bar_neutral_alpha * panel_fg_alpha, 1); if((alpha1 + alpha2) == 0) return; color_ratio = alpha1 / (alpha1 + alpha2); for(int i = 0; i < size.x; ++i) diff --git a/qcsrc/client/hud/panel/vote.qc b/qcsrc/client/hud/panel/vote.qc index 556369908..79fea584a 100644 --- a/qcsrc/client/hud/panel/vote.qc +++ b/qcsrc/client/hud/panel/vote.qc @@ -66,12 +66,14 @@ void HUD_Vote() a = vote_alpha * (vote_highlighted ? autocvar_hud_panel_vote_alreadyvoted_alpha : 1); if(a <= 0) return; - //panel_fade_alpha *= a; - // nothing can hide this panel, not even the menu + + // menu can't hide this panel, unless: + // 1) the uid2name menu dialog is open (replaces this panel) + // 2) the settings menu of another panel is open (hud_config mode) float hud_fade_alpha_save = hud_fade_alpha; if(uid2name_dialog && autocvar__menu_alpha) hud_fade_alpha = 0; - else + else if(!(hud_configure_menu_open == 2 && highlightedPanel != panel)) hud_fade_alpha = a; HUD_Panel_LoadCvars(); hud_fade_alpha = hud_fade_alpha_save; -- 2.39.2