From: terencehill Date: Tue, 28 Jun 2011 18:04:55 +0000 (+0200) Subject: hud_panel_centerprint_fadetime to customize the msg fade time X-Git-Tag: xonotic-v0.5.0~169 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=25969a0c39d5693caccf2269ae67576ec4985510;p=xonotic%2Fxonotic-data.pk3dir.git hud_panel_centerprint_fadetime to customize the msg fade time --- diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index 067e333bf..2e2302f4d 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -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)" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index a03e9f50f..833337b52 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -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 diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index b0df72958..bc9b9833c 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -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 diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index d012629b0..a12f12c3f 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -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 diff --git a/hud_luminos_xhair_minimal.cfg b/hud_luminos_xhair_minimal.cfg index 94bc482a1..c7126e02f 100644 --- a/hud_luminos_xhair_minimal.cfg +++ b/hud_luminos_xhair_minimal.cfg @@ -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 diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index 416b88d60..829d78edc 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -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 diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 1d86135ae..787f21b42 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -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; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index d671962ca..a601ce17f 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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 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); } diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index a897bdd33..9ff1e0e90 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -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"); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.c b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.c index c413786a6..9628783b1 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.c @@ -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")));