From d4618acf8364725e761a28fd5493aefd513e5370 Mon Sep 17 00:00:00 2001 From: rtxa Date: Fri, 15 Aug 2025 22:42:25 -0300 Subject: [PATCH] Add custom VGUI2 HUD settings to Advanced Options This adds settings for hud_color_override, hud_color4, and hud_custom in the Advanced Options menu. --- .../language/bugfixedhl_english.utf8.txt | 8 ++- gamedir/ui/resource/options/HudSubOptions.res | 44 +++++++++--- .../resource/options/HudSubOptionsColors.res | 72 +++++++++++++++++++ .../client/gameui/options/options_hud.cpp | 10 +++ src/game/client/gameui/options/options_hud.h | 1 + .../gameui/options/options_hud_colors.cpp | 10 +++ .../gameui/options/options_hud_colors.h | 6 +- 7 files changed, 140 insertions(+), 11 deletions(-) diff --git a/gamedir/ui/resource/language/bugfixedhl_english.utf8.txt b/gamedir/ui/resource/language/bugfixedhl_english.utf8.txt index 7058281c..2484a8b1 100644 --- a/gamedir/ui/resource/language/bugfixedhl_english.utf8.txt +++ b/gamedir/ui/resource/language/bugfixedhl_english.utf8.txt @@ -81,7 +81,12 @@ "BHL_AdvOptions_HUD_Color2_Title" "HUD HP/AP/Ammo (Medium) color" "BHL_AdvOptions_HUD_Color3" "HP/AP/Ammo (Low)" -"BHL_AdvOptions_HUD_Color3_Title" "HUD HP/AP/Ammo (Medium) color" +"BHL_AdvOptions_HUD_Color3_Title" "HUD HP/AP/Ammo (Low) color" + +"BHL_AdvOptions_HUD_Color4" "HP/AP/Ammo (Very low)" +"BHL_AdvOptions_HUD_Color4_Title" "HUD HP/AP/Ammo (Very low) color" + +"BHL_AdvOptions_HUD_ColorOverride" "Color HUD numbers by amount (HP/AP/Ammo)" "BHL_AdvOptions_HUD_Render" "Enhanced sprite rendering *" "BHL_AdvOptions_HUD_Dim" "Dim HUD when inactive" @@ -96,6 +101,7 @@ "BHL_AdvOptions_HUD_JumpSpeedCross" "Jump speed under crosshair" "BHL_AdvOptions_HUD_Deathnotice" "VGUI2 Deathnotice *" +"BHL_AdvOptions_HUD_CustomHud" "VGUI2 Custom HUD (HP/AP/Ammo) *" "BHL_AdvOptions_HUD_RenderMsg" "* Requires hardware rendering mode" diff --git a/gamedir/ui/resource/options/HudSubOptions.res b/gamedir/ui/resource/options/HudSubOptions.res index 05220aad..49278b69 100644 --- a/gamedir/ui/resource/options/HudSubOptions.res +++ b/gamedir/ui/resource/options/HudSubOptions.res @@ -23,7 +23,7 @@ "fieldName" "OpacityLabel" "xpos" "38" "ypos" "15" - "wide" "180" + "wide" "150" "tall" "24" "autoResize" "0" "pinCorner" "0" @@ -48,7 +48,7 @@ { "ControlName" "CCvarTextEntry" "fieldName" "OpacityValue" - "xpos" "292" + "xpos" "212" "ypos" "30" "wide" "48" "tall" "24" @@ -72,7 +72,7 @@ "fieldName" "OpacitySlider" "xpos" "38" "ypos" "32" - "wide" "252" + "wide" "172" "tall" "24" "autoResize" "0" "pinCorner" "0" @@ -363,12 +363,40 @@ "useproportionalinsets" "0" "Default" "0" } + "CustomHudCheckbox" + { + "ControlName" "CCvarCheckButton" + "fieldName" "CustomHudCheckBox" + "xpos" "230" + "ypos" "184" + "wide" "240" + "tall" "24" + "autoResize" "0" + "pinCorner" "0" + "RoundedCorners" "15" + "pin_corner_to_sibling" "0" + "pin_to_sibling_corner" "0" + "visible" "1" + "enabled" "1" + "tabPosition" "0" + "labelText" "#BHL_AdvOptions_HUD_CustomHud" + "textAlignment" "west" + "dulltext" "0" + "brighttext" "0" + "wrap" "0" + "centerwrap" "0" + "textinsetx" "6" + "textinsety" "0" + "autowidetocontents" "0" + "useproportionalinsets" "0" + "Default" "0" + } "DeathnoticeCheckbox" { "ControlName" "CCvarCheckButton" "fieldName" "DeathnoticeCheckbox" "xpos" "230" - "ypos" "184" + "ypos" "160" "wide" "192" "tall" "24" "autoResize" "0" @@ -396,7 +424,7 @@ "ControlName" "CCVarComboBox" "fieldName" "TimerBox" "xpos" "274" - "ypos" "92" + "ypos" "45" "wide" "192" "tall" "24" "autoResize" "0" @@ -418,7 +446,7 @@ "ControlName" "CCVarComboBox" "fieldName" "ScaleBox" "xpos" "274" - "ypos" "145" + "ypos" "100" "wide" "192" "tall" "24" "autoResize" "0" @@ -440,7 +468,7 @@ "ControlName" "Label" "fieldName" "TimerLabel" "xpos" "276" - "ypos" "64" + "ypos" "15" "wide" "214" "tall" "24" "autoResize" "0" @@ -494,7 +522,7 @@ "ControlName" "Label" "fieldName" "Label2" "xpos" "276" - "ypos" "117" + "ypos" "72" "wide" "214" "tall" "24" "autoResize" "0" diff --git a/gamedir/ui/resource/options/HudSubOptionsColors.res b/gamedir/ui/resource/options/HudSubOptionsColors.res index 139858e7..dc09d440 100644 --- a/gamedir/ui/resource/options/HudSubOptionsColors.res +++ b/gamedir/ui/resource/options/HudSubOptionsColors.res @@ -193,6 +193,78 @@ "enabled" "1" "tabPosition" "0" } + "Color4Label" + { + "ControlName" "Label" + "fieldName" "Color4Label" + "xpos" "12" + "ypos" "128" + "wide" "150" + "tall" "24" + "autoResize" "0" + "pinCorner" "0" + "RoundedCorners" "15" + "pin_corner_to_sibling" "0" + "pin_to_sibling_corner" "0" + "visible" "1" + "enabled" "1" + "tabPosition" "0" + "labelText" "#BHL_AdvOptions_HUD_Color4" + "textAlignment" "west" + "dulltext" "0" + "brighttext" "0" + "wrap" "0" + "centerwrap" "0" + "textinsetx" "0" + "textinsety" "0" + "autowidetocontents" "0" + "useproportionalinsets" "0" + } + "Color4Value" + { + "ControlName" "CCvarColor" + "fieldName" "Color4Value" + "xpos" "170" + "ypos" "128" + "wide" "128" + "tall" "24" + "autoResize" "0" + "pinCorner" "0" + "RoundedCorners" "15" + "pin_corner_to_sibling" "0" + "pin_to_sibling_corner" "0" + "visible" "1" + "enabled" "1" + "tabPosition" "0" + } + "ColorOverrideCheckbox" + { + "ControlName" "CCvarCheckButton" + "fieldName" "ColorOverrideCheckbox" + "xpos" "5" + "ypos" "160" + "wide" "300" + "tall" "24" + "autoResize" "0" + "pinCorner" "0" + "RoundedCorners" "15" + "pin_corner_to_sibling" "0" + "pin_to_sibling_corner" "0" + "visible" "1" + "enabled" "1" + "tabPosition" "0" + "labelText" "#BHL_AdvOptions_HUD_ColorOverride" + "textAlignment" "west" + "dulltext" "0" + "brighttext" "0" + "wrap" "0" + "centerwrap" "0" + "textinsetx" "6" + "textinsety" "0" + "autowidetocontents" "0" + "useproportionalinsets" "0" + "Default" "0" + } "BuildModeDialog" { "ControlName" "BuildModeDialog" diff --git a/src/game/client/gameui/options/options_hud.cpp b/src/game/client/gameui/options/options_hud.cpp index 628ba38c..4db15025 100644 --- a/src/game/client/gameui/options/options_hud.cpp +++ b/src/game/client/gameui/options/options_hud.cpp @@ -37,6 +37,7 @@ CHudSubOptions::CHudSubOptions(vgui2::Panel *parent) m_pJumpSpeedCrossCheckbox = new CCvarCheckButton(this, "JumpSpeedCrossCheckbox", "#BHL_AdvOptions_HUD_JumpSpeedCross", "hud_jumpspeed_below_cross"); m_pDeathnoticeVGui = new CCvarCheckButton(this, "DeathnoticeCheckbox", "#BHL_AdvOptions_HUD_Deathnotice", "hud_deathnotice_vgui"); + m_pCustomHudVGui = new CCvarCheckButton(this, "CustomHudCheckbox", "#BHL_AdvOptions_HUD_CustomHud", "hud_custom"); m_pTimerBox = new CCVarComboBox(this, "TimerBox", "hud_timer"); m_pTimerBox->AddItem("#BHL_AdvOptions_Hud_Timer0", "0"); @@ -67,6 +68,7 @@ CHudSubOptions::CHudSubOptions(vgui2::Panel *parent) { m_pRenderCheckbox->SetEnabled(false); m_pDeathnoticeVGui->SetEnabled(false); + m_pCustomHudVGui->SetEnabled(false); } } @@ -93,6 +95,11 @@ void CHudSubOptions::OnResetData() else m_pDeathnoticeVGui->SetSelected(false); + if (m_pCustomHudVGui->IsEnabled()) + m_pCustomHudVGui->ResetData(); + else + m_pCustomHudVGui->SetSelected(false); + m_pTimerBox->ResetData(); m_pScaleBox->ResetData(); } @@ -116,6 +123,9 @@ void CHudSubOptions::OnApplyChanges() if (m_pDeathnoticeVGui->IsEnabled()) m_pDeathnoticeVGui->ApplyChanges(); + if (m_pCustomHudVGui->IsEnabled()) + m_pCustomHudVGui->ApplyChanges(); + m_pTimerBox->ApplyChanges(); m_pScaleBox->ApplyChanges(); } diff --git a/src/game/client/gameui/options/options_hud.h b/src/game/client/gameui/options/options_hud.h index 7b3cc5e4..109ee481 100644 --- a/src/game/client/gameui/options/options_hud.h +++ b/src/game/client/gameui/options/options_hud.h @@ -41,6 +41,7 @@ class CHudSubOptions : public vgui2::PropertyPage CCvarCheckButton *m_pJumpSpeedCrossCheckbox = nullptr; CCvarCheckButton *m_pDeathnoticeVGui = nullptr; + CCvarCheckButton *m_pCustomHudVGui = nullptr; CCVarComboBox *m_pTimerBox = nullptr; CCVarComboBox *m_pScaleBox = nullptr; diff --git a/src/game/client/gameui/options/options_hud_colors.cpp b/src/game/client/gameui/options/options_hud_colors.cpp index d0273ecb..ff9ca81c 100644 --- a/src/game/client/gameui/options/options_hud_colors.cpp +++ b/src/game/client/gameui/options/options_hud_colors.cpp @@ -1,6 +1,7 @@ #include #include "client_vgui.h" #include "cvar_color.h" +#include "cvar_check_button.h" #include "options_hud_colors.h" CHudSubOptionsColors::CHudSubOptionsColors(vgui2::Panel *parent) @@ -20,6 +21,11 @@ CHudSubOptionsColors::CHudSubOptionsColors(vgui2::Panel *parent) m_pColorLabel[3] = new vgui2::Label(this, "Color3Label", "#BHL_AdvOptions_HUD_Color3"); m_pColorValue[3] = new CCvarColor(this, "Color3Value", "hud_color3", "#BHL_AdvOptions_HUD_Color3_Title"); + m_pColorLabel[4] = new vgui2::Label(this, "Color4Label", "#BHL_AdvOptions_HUD_Color4"); + m_pColorValue[4] = new CCvarColor(this, "Color4Value", "hud_color4", "#BHL_AdvOptions_HUD_Color4_Title"); + + m_pColorOverride = new CCvarCheckButton(this, "ColorOverrideCheckbox", "#BHL_AdvOptions_HUD_ColorOverride", "hud_color_override", true); + LoadControlSettings(VGUI2_ROOT_DIR "resource/options/HudSubOptionsColors.res"); } @@ -29,6 +35,8 @@ void CHudSubOptionsColors::OnResetData() m_pColorValue[1]->ResetData(); m_pColorValue[2]->ResetData(); m_pColorValue[3]->ResetData(); + m_pColorValue[4]->ResetData(); + m_pColorOverride->ResetData(); } void CHudSubOptionsColors::OnApplyChanges() @@ -37,4 +45,6 @@ void CHudSubOptionsColors::OnApplyChanges() m_pColorValue[1]->ApplyChanges(); m_pColorValue[2]->ApplyChanges(); m_pColorValue[3]->ApplyChanges(); + m_pColorValue[4]->ApplyChanges(); + m_pColorOverride->ApplyChanges(); } diff --git a/src/game/client/gameui/options/options_hud_colors.h b/src/game/client/gameui/options/options_hud_colors.h index 2ec91f4d..8611c00e 100644 --- a/src/game/client/gameui/options/options_hud_colors.h +++ b/src/game/client/gameui/options/options_hud_colors.h @@ -3,6 +3,7 @@ #include class CCvarColor; +class CCvarCheckButton; class CHudSubOptionsColors : public vgui2::PropertyPage { @@ -15,8 +16,9 @@ class CHudSubOptionsColors : public vgui2::PropertyPage virtual void OnApplyChanges(); private: - vgui2::Label *m_pColorLabel[4]; - CCvarColor *m_pColorValue[4]; + vgui2::Label *m_pColorLabel[5]; + CCvarColor *m_pColorValue[5]; + CCvarCheckButton *m_pColorOverride = nullptr; }; #endif