From caca27413f129fc15f0cb096677989f64b63298f Mon Sep 17 00:00:00 2001 From: Jeremy Potter Date: Fri, 17 Apr 2020 14:30:17 -0700 Subject: [PATCH] Add capitalize option --- _hud_descriptions.cfg | 1 + hud_luma.cfg | 1 + hud_luminos.cfg | 1 + hud_luminos_minimal.cfg | 1 + hud_luminos_minimal_xhair.cfg | 2 ++ hud_luminos_old.cfg | 1 + hud_nexuiz.cfg | 1 + qcsrc/client/autocvars.qh | 1 + qcsrc/client/hud/hud_config.qc | 1 + qcsrc/client/hud/panel/centerprint.qc | 12 ++++++++++-- qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc | 3 +++ qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qh | 2 +- 12 files changed, 24 insertions(+), 3 deletions(-) diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index 7a7b063dc..143647022 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -275,6 +275,7 @@ seta hud_panel_centerprint_bg_padding "" "if set to something else than \"\" = o seta hud_panel_centerprint_align "" "text alignment: 0 left, 0.5 center, 1 right" seta hud_panel_centerprint_flip "" "invert messages order" seta hud_panel_centerprint_bold "" "make frag messages bold" +seta hud_panel_centerprint_capitalize "" "make frag messages uppercase" seta hud_panel_centerprint_fontscale "" "scale the text font by this amount" seta hud_panel_centerprint_fontscale_bold "" "scale the text font of frag messages by this amount" seta hud_panel_centerprint_time "" "message duration (NOTE: certain messages have a fixed duration)" diff --git a/hud_luma.cfg b/hud_luma.cfg index 26cfcf723..b76c7b2f6 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -276,6 +276,7 @@ seta hud_panel_centerprint_bg_padding "" seta hud_panel_centerprint_align "0.5" seta hud_panel_centerprint_flip "0" seta hud_panel_centerprint_bold "1" +seta hud_panel_centerprint_capitalize "1" seta hud_panel_centerprint_fontscale "1" seta hud_panel_centerprint_fontscale_bold "1.8" seta hud_panel_centerprint_time "3" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index 1e1cb6688..6a966debb 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -276,6 +276,7 @@ seta hud_panel_centerprint_bg_padding "" seta hud_panel_centerprint_align "0.5" seta hud_panel_centerprint_flip "0" seta hud_panel_centerprint_bold "1" +seta hud_panel_centerprint_capitalize "1" seta hud_panel_centerprint_fontscale "1" seta hud_panel_centerprint_fontscale_bold "1.8" seta hud_panel_centerprint_time "3" diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index 50c837b07..c67769e0b 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -276,6 +276,7 @@ seta hud_panel_centerprint_bg_padding "" seta hud_panel_centerprint_align "0.5" seta hud_panel_centerprint_flip "0" seta hud_panel_centerprint_bold "1" +seta hud_panel_centerprint_capitalize "1" seta hud_panel_centerprint_fontscale "1" seta hud_panel_centerprint_fontscale_bold "1.8" seta hud_panel_centerprint_time "3" diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index 2bfc5a80c..a079da52b 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -276,6 +276,8 @@ seta hud_panel_centerprint_bg_padding "" seta hud_panel_centerprint_align "0.5" seta hud_panel_centerprint_flip "0" seta hud_panel_centerprint_bold "1" +seta hud_panel_centerprint_capitalize "1" +seta hud_panel_centerprint_capitalize "1" seta hud_panel_centerprint_fontscale "1" seta hud_panel_centerprint_fontscale_bold "1.8" seta hud_panel_centerprint_time "3" diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index e2ed8a4b1..8c09dc3e7 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -276,6 +276,7 @@ seta hud_panel_centerprint_bg_padding "" seta hud_panel_centerprint_align "0.5" seta hud_panel_centerprint_flip "0" seta hud_panel_centerprint_bold "1" +seta hud_panel_centerprint_capitalize "1" seta hud_panel_centerprint_fontscale "1" seta hud_panel_centerprint_fontscale_bold "1.8" seta hud_panel_centerprint_time "3" diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index eb27a98c1..08df3444b 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -276,6 +276,7 @@ seta hud_panel_centerprint_bg_padding "" seta hud_panel_centerprint_align "0.5" seta hud_panel_centerprint_flip "0" seta hud_panel_centerprint_bold "1" +seta hud_panel_centerprint_capitalize "1" seta hud_panel_centerprint_fontscale "1" seta hud_panel_centerprint_fontscale_bold "1.8" seta hud_panel_centerprint_time "3" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 7c4802dad..29755bce5 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -243,6 +243,7 @@ float autocvar_hud_panel_centerprint_fade_subsequent_minfontsize = 0.75; float autocvar_hud_panel_centerprint_fade_minfontsize = 0; bool autocvar_hud_panel_centerprint_flip; bool autocvar_hud_panel_centerprint_bold; +bool autocvar_hud_panel_centerprint_capitalize; float autocvar_hud_panel_centerprint_fontscale; float autocvar_hud_panel_centerprint_fontscale_bold; float autocvar_hud_panel_centerprint_time; diff --git a/qcsrc/client/hud/hud_config.qc b/qcsrc/client/hud/hud_config.qc index ed4e1b935..4428c4602 100644 --- a/qcsrc/client/hud/hud_config.qc +++ b/qcsrc/client/hud/hud_config.qc @@ -194,6 +194,7 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_Cvar("hud_panel_centerprint_align"); HUD_Write_Cvar("hud_panel_centerprint_flip"); HUD_Write_Cvar("hud_panel_centerprint_bold"); + HUD_Write_Cvar("hud_panel_centerprint_capitalize"); HUD_Write_Cvar("hud_panel_centerprint_fontscale"); HUD_Write_Cvar("hud_panel_centerprint_fontscale_bold"); HUD_Write_Cvar("hud_panel_centerprint_time"); diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 4f99a27a4..1627b227b 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -215,8 +215,16 @@ void HUD_CenterPrint () { // if the notification starts with ^BOLD make it bold (e.g. frag messages) is_bold = (substring(centerprint_messages[j], 0, 5) == BOLD_OPERATOR); - // remove ^BOLD so it doesn't get printed onscreen - centerprint_message = is_bold ? strzone(substring(centerprint_messages[j], 5, -1)) : strzone(centerprint_messages[j]); + // remove ^BOLD so it doesn't get printed onscreen. also capitalize the text if hud_panel_centerprint_capitalize is true + if (is_bold) { + if (autocvar_hud_panel_centerprint_capitalize) { + centerprint_message = strzone(strtoupper(substring(centerprint_messages[j], 5, -1))); + } else { + centerprint_message = strzone(substring(centerprint_messages[j], 5, -1)); + } + } else { + centerprint_message = strzone(centerprint_messages[j]); + } // entries = bound(1, floor(CENTERPRINT_MAX_ENTRIES * 4 * panel_size_y/panel_size_x), CENTERPRINT_MAX_ENTRIES); // height = panel_size_y/entries; diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc index 559f86e85..d392bbb0c 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc +++ b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc @@ -41,6 +41,9 @@ void XonoticHUDCenterprintDialog_fill(entity me) me.TR(me); me.TDempty(me, 0.2); me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_centerprint_bold", _("Enable bold frag messages"))); + me.TR(me); + me.TDempty(me, 0.2); + me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_centerprint_capitalize", _("Capitalize frag messages"))); me.TR(me); me.TDempty(me, 0.2); me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Font scale:"))); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qh b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qh index 0d237d67e..2efe08626 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qh +++ b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qh @@ -6,7 +6,7 @@ CLASS(XonoticHUDCenterprintDialog, XonoticRootDialog) ATTRIB(XonoticHUDCenterprintDialog, title, string, _("Centerprint Panel")); ATTRIB(XonoticHUDCenterprintDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT); ATTRIB(XonoticHUDCenterprintDialog, intendedWidth, float, 0.4); - ATTRIB(XonoticHUDCenterprintDialog, rows, float, 19); + ATTRIB(XonoticHUDCenterprintDialog, rows, float, 20); ATTRIB(XonoticHUDCenterprintDialog, columns, float, 4); ATTRIB(XonoticHUDCenterprintDialog, name, string, "HUDcenterprint"); ATTRIB(XonoticHUDCenterprintDialog, requiresConnection, float, true); -- 2.39.2