]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix some centerprint mess
authorz411 <z411@omaera.org>
Wed, 9 Mar 2022 08:41:21 +0000 (05:41 -0300)
committerz411 <z411@omaera.org>
Wed, 9 Mar 2022 08:41:21 +0000 (05:41 -0300)
_hud_common.cfg
_hud_descriptions.cfg
hud_luma.cfg
qcsrc/client/hud/panel/centerprint.qc
qcsrc/common/notifications/all.inc

index 83eb2490dc132bd8fc19d8f5650f1ceb816e0865..82146b562c4ecd0d9677108c8ecce623d6345abb 100644 (file)
@@ -119,7 +119,7 @@ seta hud_panel_infomessages_group_time 6 "number of seconds a message of a group
 seta hud_panel_infomessages_group_fadetime 0.4 "group message fade in/out time"
 
 seta hud_panel_centerprint_time 3 "message duration (NOTE: certain messages have a fixed duration)"
-seta hud_panel_centerprint_fade_in 0.15 "how long a message takes to fade in"
+seta hud_panel_centerprint_fade_in 0 "how long a message takes to fade in"
 seta hud_panel_centerprint_fade_in_short 0 " "how long a message that lasts 2 or less seconds takes to fade in"
 seta hud_panel_centerprint_fade_out 0.15 "how long a message takes to fade out (this time is included in the message duration and can't be > 5)"
 seta hud_panel_centerprint_fade_subsequent 1 "enable extra fading effects for each additional message, so that the more messages you have the more they become faded out"
@@ -128,7 +128,7 @@ seta hud_panel_centerprint_fade_subsequent_passone_minalpha 0.5 "minimum factor
 seta hud_panel_centerprint_fade_subsequent_passtwo 10 "division factor for the second pass for alpha fading, it applies another fade on top of the first pass to make it more transitioned"
 seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha 0.5 "minimum factor that the second pass can fade to"
 seta hud_panel_centerprint_fade_subsequent_minfontsize 0.75 "minimum factor for the font size from the subsequent fading effects"
-seta hud_panel_centerprint_fade_minfontsize 0 "minimum factor for the font size from the fading in/out effects"
+seta hud_panel_centerprint_fade_minfontsize 1 "minimum factor for the font size from the fading in/out effects"
 
 seta hud_panel_scoreboard_namesize 15 "size limit of player names and relative column (multiplied by fontsize)"
 seta hud_panel_scoreboard_maxheight 0.6 "max height of the scoreboard; a few players that wouldn't fit into the scoreboard are listed in the last row"
index 185eb5c21e2004f0a70107551d0862651d7b29e5..545e0b92b51209e986926dcec132e4fdfe345f6d 100644 (file)
@@ -274,6 +274,7 @@ 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_fontscale "" "scale the text font by this amount"
 seta hud_panel_centerprint_fontscale_bold "" "scale the bold text font by this amount"
+seta hud_panel_centerprint_fontscale_title "" "scale the title text font by this amount"
 
 seta hud_panel_minigameboard_pos "" "position of this panel"
 seta hud_panel_minigameboard_size "" "size of this panel"
index 36f91775c092ef461df9fbcb36065181b28a76a6..c1f668aaf1c3762ac3ddc55d9bc0e04e44de2998 100644 (file)
@@ -273,8 +273,8 @@ seta hud_panel_centerprint_bg_border ""
 seta hud_panel_centerprint_bg_padding ""
 seta hud_panel_centerprint_align "0.5"
 seta hud_panel_centerprint_flip "0"
-seta hud_panel_centerprint_fontscale "1"
-seta hud_panel_centerprint_fontscale_bold "1.4"
+seta hud_panel_centerprint_fontscale "1.4"
+seta hud_panel_centerprint_fontscale_bold "2"
 
 seta hud_panel_minigameboard_pos "0.22 0.15"
 seta hud_panel_minigameboard_size "0.50 0.60"
index 08fe3e65c3112207b4c5f154743631826c3bc943..e8299414ff76c4ca3aee593b0e02a504cfeb08a4 100644 (file)
@@ -33,7 +33,7 @@ void HUD_CenterPrint_Export(int fh)
 
 const int CENTERPRINT_MAX_MSGS = 10;
 const int CENTERPRINT_MAX_ENTRIES = 50;
-const float CENTERPRINT_SPACING = 0.7;
+const float CENTERPRINT_SPACING = 0.5;
 int cpm_index;
 string centerprint_messages[CENTERPRINT_MAX_MSGS];
 int centerprint_msgID[CENTERPRINT_MAX_MSGS];
@@ -167,10 +167,11 @@ void HUD_CenterPrint()
                                if (r > 0.8)
                                        centerprint_Add(floor(r*1000), sprintf(_("^3Countdown message at time %s, seconds left: ^COUNT"), seconds_tostring(time)), 1, 10);
                                else if (r > 0.55)
-                                       centerprint_Add(0, sprintf(_("^1Multiline message at time %s that\n^1lasts longer than normal"), seconds_tostring(time)), 20, 0);
+                                       centerprint_Add(0, sprintf(_("^1Multiline message at time %s that\n^BOLDlasts longer than normal"), seconds_tostring(time)), 20, 0);
                                else
                                        centerprint_AddStandard(sprintf(_("Message at time %s"), seconds_tostring(time)));
-                               hud_configure_cp_generation_time = time + 1 + random()*4;
+                               //hud_configure_cp_generation_time = time + 1 + random()*4;
+                               hud_configure_cp_generation_time = time + 1;
                        }
                        else
                        {
@@ -261,8 +262,10 @@ void HUD_CenterPrint()
                float fade_in_time = autocvar_hud_panel_centerprint_fade_in;
                float fade_out_time = autocvar_hud_panel_centerprint_fade_out;
 
-               if (centerprint_time[j] == 1)
+               if (centerprint_countdown_num[j]) {
                        fade_in_time = autocvar_hud_panel_centerprint_fade_in_short;
+                       fade_out_time = 0;
+               }
 
                // fade
                a = 1;
@@ -275,8 +278,6 @@ void HUD_CenterPrint()
 
                if(centerprint_msgID[j] == ORDINAL(CPID_TIMEIN))
                        a = 1;
-               if(centerprint_countdown_num[j])
-                       a = 1;
 
                // while counting down show it anyway in order to hold the current message position
                if (a <= 0.5/255.0 && centerprint_countdown_num[j] == 0)  // Guaranteed invisible - don't show.
@@ -296,7 +297,9 @@ void HUD_CenterPrint()
                a *= panel_fg_alpha;
 
                // finally set the size based on the new alpha from subsequent fading
-               sz = sz * (autocvar_hud_panel_centerprint_fade_subsequent_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_subsequent_minfontsize));
+               // TODO: Apply this only if subsequent, otherwise it fucks it up
+               if(g)
+                       sz = sz * (autocvar_hud_panel_centerprint_fade_subsequent_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_subsequent_minfontsize));
                drawfontscale = hud_scale * sz;
 
                if (centerprint_countdown_num[j])
@@ -314,6 +317,7 @@ void HUD_CenterPrint()
                                {
                                        bool is_bold = (substring(getWrappedLine_remaining, 0, 5) == BOLD_OPERATOR);
                                        vector fontsize = hud_fontsize * (is_bold ? autocvar_hud_panel_centerprint_fontscale_bold : autocvar_hud_panel_centerprint_fontscale);
+
                                        ts = getWrappedLine(panel_size.x * hud_scale.x * sz, fontsize, stringwidth_colors);
                                        if (ts != "")
                                                pos.y -= fontsize.y;
@@ -331,14 +335,14 @@ void HUD_CenterPrint()
 
                        bool is_bold = (substring(getWrappedLine_remaining, 0, 5) == BOLD_OPERATOR);
                        vector fontsize = hud_fontsize * (is_bold ? autocvar_hud_panel_centerprint_fontscale_bold : autocvar_hud_panel_centerprint_fontscale);
+                       if (is_bold)
+                               getWrappedLine_remaining = substring(getWrappedLine_remaining, 5, -1);
 
                        while(getWrappedLine_remaining)
                        {
                                ts = getWrappedLine(panel_size.x * hud_scale.x * sz, fontsize, stringwidth_colors);
                                if (ts != "")
                                {
-                                       if (is_bold)
-                                               ts = substring(ts, 5, -1);
                                        if (align)
                                                pos.x = panel_pos.x + (panel_size.x - stringwidth(ts, true, fontsize) * sz) * align;
                                        if (a > 0.5/255.0)  // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker.
@@ -352,18 +356,15 @@ void HUD_CenterPrint()
                        }
                }
 
-               float height_used = pos.y - msg_size;
-
                ++g; // move next position number up
 
                msg_size = pos.y - msg_size;
+
                if (autocvar_hud_panel_centerprint_flip)
                {
-                       pos.y += height_used;
-                       //pos.y = current_msg_posY - CENTERPRINT_SPACING * fontsize.y;
+                       pos.y -= msg_size + CENTERPRINT_SPACING * hud_fontsize.y;
                        if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
-                               //pos.y += (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz));
-                               pos.y += height_used * (1 - sqrt(sz));
+                               pos.y += (1 - sqrt(a));
 
                        if (pos.y < panel_pos.y) // check if the next message can be shown
                        {
@@ -373,11 +374,9 @@ void HUD_CenterPrint()
                }
                else
                {
-                       //pos.y += CENTERPRINT_SPACING * fontsize.y;
-                       pos.y += height_used;
+                       pos.y += CENTERPRINT_SPACING * hud_fontsize.y;
                        if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
-                               //pos.y -= (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz));
-                               pos.y -= height_used * (1 - sqrt(sz));
+                               pos.y -= (1 - sqrt(a));
 
                        if(pos.y > panel_pos.y + panel_size.y - hud_fontsize.y) // check if the next message can be shown
                        {
index 33fbee3bd8d10d6fae1fc0fe8f9544795b4b5754..ef68e00a3ae0b2484cc67699d71959cf0395fce6 100644 (file)
@@ -526,7 +526,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MSG_CENTER_NOTIF(ASSAULT_DEFENDING,                 N_ENABLE,    0, 0, "",               CPID_ASSAULT_ROLE,      "0 0",  _("^BGYou are defending!"), "")
     MSG_CENTER_NOTIF(ASSAULT_OBJ_DESTROYED,             N_ENABLE,    0, 1, "f1time",         CPID_ASSAULT_ROLE,      "0 0",  _("^BGObjective destroyed in ^F4%s^BG!"), "")
 
-    MSG_CENTER_NOTIF(COUNTDOWN_BEGIN,                   N_ENABLE,    0, 0, "",               CPID_ROUND,             "2 0",  _("^F4Begin!"), "")
+    MSG_CENTER_NOTIF(COUNTDOWN_BEGIN,                   N_ENABLE,    0, 0, "",               CPID_ROUND,             "2 0",  _("^BOLDBegin!"), "")
     MSG_CENTER_NOTIF(COUNTDOWN_GAMESTART,               N_ENABLE,    0, 1, "",               CPID_ROUND,             "1 f1", _("^BGGame starts in\n^BOLD^COUNT"), "")
     MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTART,              N_ENABLE,    0, 1, "",               CPID_ROUND,             "1 f1", _("^BGRound starts in\n^BOLD^COUNT"), "")
     MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTOP,               N_ENABLE,    0, 0, "",               CPID_ROUND,             "2 0",  _("^F4Round cannot start"), "")