From: terencehill Date: Tue, 16 Aug 2016 11:29:55 +0000 (+0200) Subject: Apply alpha to the vote panel in another way so it can display the bg too while the... X-Git-Tag: xonotic-v0.8.2~674^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bd0a1c3f291f09fe0433e1a183521f600d64d266;p=xonotic%2Fxonotic-data.pk3dir.git Apply alpha to the vote panel in another way so it can display the bg too while the menu is shown --- diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 0ac857754..296cffbe2 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -324,7 +324,6 @@ bool autocvar_hud_panel_timer_increment; float autocvar_hud_panel_update_interval; bool autocvar_hud_panel_vote; float autocvar_hud_panel_vote_alreadyvoted_alpha; -string autocvar_hud_panel_vote_bg_alpha; bool autocvar_hud_panel_weapons; bool autocvar_hud_panel_weapons_accuracy; bool autocvar_hud_panel_weapons_ammo; diff --git a/qcsrc/client/hud/panel/vote.qc b/qcsrc/client/hud/panel/vote.qc index e78cd2806..08aa9bcab 100644 --- a/qcsrc/client/hud/panel/vote.qc +++ b/qcsrc/client/hud/panel/vote.qc @@ -9,10 +9,9 @@ void HUD_Vote() { // this dialog gets overriden by the uid2name menu dialog, if it exists // TODO remove this client side uid2name dialog in the next release - if(autocvar__menu_alpha) - hud_fade_alpha = 0; - else + if(!autocvar__menu_alpha) uid2name_dialog = 0; + if (!uid2name_dialog) localcmd("menu_cmd directmenu Uid2Name\n"); @@ -33,14 +32,6 @@ void HUD_Vote() if(!autocvar__hud_configure) { if(!autocvar_hud_panel_vote) return; - - panel_fg_alpha = autocvar_hud_panel_fg_alpha; - panel_bg_alpha_str = autocvar_hud_panel_vote_bg_alpha; - - if(panel_bg_alpha_str == "") { - panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha); - } - panel_bg_alpha = stof(panel_bg_alpha_str); } else { @@ -56,6 +47,13 @@ void HUD_Vote() vote_prev = vote_active; } + /* + if(cvar("hud_panel_vote_test")) { + if(vote_called_vote) strunzone(vote_called_vote); vote_called_vote = strzone("^1test the vote panel"); + vote_active = true; vote_yescount = 3; vote_nocount = 2; vote_needed = 4; + } else vote_active = false; + */ + if(vote_active || autocvar__hud_configure) vote_alpha = bound(0, (time - vote_change) * 2, 1); else @@ -64,7 +62,15 @@ void HUD_Vote() a = vote_alpha * (vote_highlighted ? autocvar_hud_panel_vote_alreadyvoted_alpha : 1); if(a <= 0) return; - HUD_Panel_UpdateCvars(a); + //HUD_Panel_UpdateCvars(a); + // nothing can hide this panel, not even the menu + float hud_fade_alpha_save = hud_fade_alpha; + if(uid2name_dialog && autocvar__menu_alpha) + hud_fade_alpha = 0; + else + hud_fade_alpha = a; + HUD_Panel_UpdateCvars(1); + hud_fade_alpha = hud_fade_alpha_save; if(uid2name_dialog) { @@ -109,42 +115,42 @@ void HUD_Vote() s = _("A vote has been called for:"); if(uid2name_dialog) s = _("Allow servers to store and display your name?"); - drawstring_aspect(pos, s, eX * mySize.x + eY * (2/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); + drawstring_aspect(pos, s, eX * mySize.x + eY * (2/8) * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); s = textShortenToWidth(vote_called_vote, mySize.x, '1 1 0' * mySize.y * (1/8), stringwidth_colors); if(autocvar__hud_configure) s = _("^1Configure the HUD"); - drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, eX * mySize.x + eY * (1.75/8) * mySize.y, a, DRAWFLAG_NORMAL); + drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, eX * mySize.x + eY * (1.75/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL); // print the yes/no counts s = sprintf("^2%s ^7(%d)", getcommandkey_forcename(_("Yes"), "vyes"), vote_yescount); - drawcolorcodedstring_aspect(pos + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, a, DRAWFLAG_NORMAL); + drawcolorcodedstring_aspect(pos + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL); s = sprintf("^1%s ^7(%d)", getcommandkey_forcename(_("No"), "vno"), vote_nocount); - drawcolorcodedstring_aspect(pos + eX * 0.5 * mySize.x + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, a, DRAWFLAG_NORMAL); + drawcolorcodedstring_aspect(pos + eX * 0.5 * mySize.x + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL); // draw the progress bar backgrounds - drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_back", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_back", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); // draw the highlights if(vote_highlighted == 1) { drawsetcliparea(pos.x, pos.y, mySize.x * 0.5, mySize.y); - drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } else if(vote_highlighted == -1) { drawsetcliparea(pos.x + 0.5 * mySize.x, pos.y, mySize.x * 0.5, mySize.y); - drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } // draw the progress bars if(vote_yescount && vote_needed) { drawsetcliparea(pos.x, pos.y, mySize.x * 0.5 * (vote_yescount/vote_needed), mySize.y); - drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } if(vote_nocount && vote_needed) { drawsetcliparea(pos.x + mySize.x - mySize.x * 0.5 * (vote_nocount/vote_needed), pos.y, mySize.x * 0.5, mySize.y); - drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } drawresetcliparea();