]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
hud_panel_centerprint_fadetime to customize the msg fade time
authorterencehill <piuntn@gmail.com>
Tue, 28 Jun 2011 18:04:55 +0000 (20:04 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 28 Jun 2011 21:20:19 +0000 (23:20 +0200)
_hud_descriptions.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_old.cfg
hud_luminos_xhair_minimal.cfg
hud_nexuiz.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud_config.qc
qcsrc/menu/xonotic/dialog_hudpanel_centerprint.c

index 067e333bf14748ea67ccb597e14c4d32b039cbe2..2e2302f4d22081f3daadd6303b1cd70960a3394d 100644 (file)
@@ -248,3 +248,4 @@ 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_time "" "message duration (NOTE: certain messages have a fixed duration)"
+seta hud_panel_centerprint_fadetime "" "how long a message takes to fade out (this time is included in the message duration and can't be > 1)"
index a03e9f50fa5c56e984718dd674fbc2c563a285ec..833337b5233ccbd5e7d8c07574d47501c2ec08f4 100644 (file)
@@ -244,5 +244,6 @@ seta hud_panel_centerprint_align "0.5"
 seta hud_panel_centerprint_flip "0"
 seta hud_panel_centerprint_fontscale "1"
 seta hud_panel_centerprint_time "2"
+seta hud_panel_centerprint_fadetime "0.25"
 
 menu_sync
index b0df729588e34338720c6e25af7f922ce7d97913..bc9b9833ca9ef7277c9b3389e57bb00c03616e08 100644 (file)
@@ -246,5 +246,6 @@ seta hud_panel_centerprint_align "0.5"
 seta hud_panel_centerprint_flip "0"
 seta hud_panel_centerprint_fontscale "1"
 seta hud_panel_centerprint_time "2"
+seta hud_panel_centerprint_fadetime "0.25"
 
 menu_sync
index d012629b0eda097ba75e458bb0607e8a4fcfbcc2..a12f12c3fa8fa799578c2cdd39b132e3d4deec17 100644 (file)
@@ -246,5 +246,6 @@ seta hud_panel_centerprint_align "0.5"
 seta hud_panel_centerprint_flip "0"
 seta hud_panel_centerprint_fontscale "1"
 seta hud_panel_centerprint_time "2"
+seta hud_panel_centerprint_fadetime "0.25"
 
 menu_sync
index 94bc482a1362de6d76058af282a6f12e2921c0ea..c7126e02fa4cbb90117388243d3de640231ae968 100644 (file)
@@ -246,5 +246,6 @@ seta hud_panel_centerprint_align "0.5"
 seta hud_panel_centerprint_flip "0"
 seta hud_panel_centerprint_fontscale "1"
 seta hud_panel_centerprint_time "2"
+seta hud_panel_centerprint_fadetime "0.25"
 
 menu_sync
index 416b88d60e0b8539318360879137b17902fefbf9..829d78edcbb78ab2efe7b0fb6a387d38b13718e5 100644 (file)
@@ -246,5 +246,6 @@ seta hud_panel_centerprint_align "0.5"
 seta hud_panel_centerprint_flip "0"
 seta hud_panel_centerprint_fontscale "1"
 seta hud_panel_centerprint_time "2"
+seta hud_panel_centerprint_fadetime "0.25"
 
 menu_sync
index 1d86135ae3a4f2172dfd0a9d6e31fef4b31a9e97..787f21b42ef74fcd4316a012243e12f4317c2cd3 100644 (file)
@@ -217,6 +217,7 @@ float autocvar_hud_panel_healtharmor_progressbar_gfx_smooth;
 
 float autocvar_hud_panel_centerprint;
 float autocvar_hud_panel_centerprint_align;
+float autocvar_hud_panel_centerprint_fadetime;
 float autocvar_hud_panel_centerprint_flip;
 float autocvar_hud_panel_centerprint_fontscale;
 float autocvar_hud_panel_centerprint_time;
index d671962ca458de8743d49b259d68f93a5e08015f..a601ce17fecb61790d133c17d9a9d76f2811eef4 100644 (file)
@@ -4349,13 +4349,13 @@ void HUD_Physics(void)
 
 #define CENTERPRINT_MAX_MSGS 10
 #define CENTERPRINT_MAX_ENTRIES 50
-#define CENTERPRINT_FADETIME 0.25
 float cpm_index;
 string centerprint_messages[CENTERPRINT_MAX_MSGS];
 float centerprint_msgID[CENTERPRINT_MAX_MSGS];
 float centerprint_time[CENTERPRINT_MAX_MSGS];
 float centerprint_expire_time[CENTERPRINT_MAX_MSGS];
 float centerprint_countdown_num[CENTERPRINT_MAX_MSGS];
+float centerprint_fadetime;
 float centerprint_showing;
 
 void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num)
@@ -4388,6 +4388,8 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
        if (!centerprint_showing)
                centerprint_showing = TRUE;
 
+       centerprint_fadetime = bound(0, autocvar_hud_panel_centerprint_fadetime, 1);
+
        for (i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
        {
                if (j == CENTERPRINT_MAX_MSGS)
@@ -4397,9 +4399,9 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
                        if (strMessage == "" && centerprint_messages[j] != "" && centerprint_countdown_num[j] == 0)
                        {
                                // fade out the current msg (duration and countdown_num are ignored)
-                               centerprint_time[j] = CENTERPRINT_FADETIME;
-                               if (centerprint_expire_time[j] > time + CENTERPRINT_FADETIME || centerprint_expire_time[j] < time)
-                                       centerprint_expire_time[j] = time + CENTERPRINT_FADETIME;
+                               centerprint_time[j] = centerprint_fadetime;
+                               if (centerprint_expire_time[j] > time + centerprint_fadetime || centerprint_expire_time[j] < time)
+                                       centerprint_expire_time[j] = time + centerprint_fadetime;
                                return;
                        }
                        break; // found a msg with the same id, at position j
@@ -4544,14 +4546,14 @@ void HUD_CenterPrint (void)
                        else
                                continue;
                }
-               if (centerprint_time[j] < 0 || centerprint_expire_time[j] - CENTERPRINT_FADETIME > time)
+               if (centerprint_time[j] < 0 || centerprint_expire_time[j] - centerprint_fadetime > time)
                {
                        a = 1;
                        sz = 1;
                }
                else if (centerprint_expire_time[j] > time)
                {
-                       a = (centerprint_expire_time[j] - time) / CENTERPRINT_FADETIME;
+                       a = (centerprint_expire_time[j] - time) / centerprint_fadetime;
                        sz = 0.8 + a * (1 - 0.8);
                }
 
index a897bdd33d299b20f84e83f1e5dc9566e58b05f5..9ff1e0e90a5c1b5ae651c65a25d0d295323d3281 100644 (file)
@@ -126,6 +126,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_flip");
                                        HUD_Write_PanelCvar_q("_fontscale");
                                        HUD_Write_PanelCvar_q("_time");
+                                       HUD_Write_PanelCvar_q("_fadetime");
                                        break;
                        }
                        HUD_Write("\n");
index c413786a6edc1d1b7deee674b1d881d9e7f4b584..9628783b146b48c3be261fa2eee1e4d78d3bd1e5 100644 (file)
@@ -22,6 +22,10 @@ void XonoticHUDCenterprintDialog_fill(entity me)
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Message duration:")));
                me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 10, 1, "hud_panel_centerprint_time"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Fade time:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.05, "hud_panel_centerprint_fadetime"));
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_centerprint_flip", _("Flip messages order")));