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)"
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
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
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
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
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
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;
#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)
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)
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
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);
}
HUD_Write_PanelCvar_q("_flip");
HUD_Write_PanelCvar_q("_fontscale");
HUD_Write_PanelCvar_q("_time");
+ HUD_Write_PanelCvar_q("_fadetime");
break;
}
HUD_Write("\n");
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")));