From: terencehill Date: Fri, 29 Jul 2016 11:40:50 +0000 (+0200) Subject: Display vote binds and counts in the vote panel in a cleaner way X-Git-Tag: xonotic-v0.8.2~758^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=52fe0feba71dd3c2323a6aa8eda4a8725ffe55c9;p=xonotic%2Fxonotic-data.pk3dir.git Display vote binds and counts in the vote panel in a cleaner way --- diff --git a/qcsrc/client/hud/panel/vote.qc b/qcsrc/client/hud/panel/vote.qc index 6770b3049..a732b0c5e 100644 --- a/qcsrc/client/hud/panel/vote.qc +++ b/qcsrc/client/hud/panel/vote.qc @@ -118,10 +118,10 @@ void HUD_Vote() drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, eX * mySize.x + eY * (1.75/8) * mySize.y, a, DRAWFLAG_NORMAL); // print the yes/no counts - s = sprintf(_("Yes (%s): %d"), getcommandkey(_("vote YES"), "vyes"), vote_yescount); - drawstring_aspect(pos + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, '0 1 0', a, DRAWFLAG_NORMAL); - s = sprintf(_("No (%s): %d"), getcommandkey(_("vote NO"), "vno"), vote_nocount); - drawstring_aspect(pos + eX * 0.5 * mySize.x + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, '1 0 0', a, DRAWFLAG_NORMAL); + 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); + 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); // 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); diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 65ee03aaf..5ce3eada7 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1220,13 +1220,13 @@ NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew) } } -string getcommandkey(string text, string command) +string _getcommandkey(string cmd_name, string command, bool forcename) { string keys; float n, j, k, l = 0; if (!autocvar_hud_showbinds) - return text; + return cmd_name; keys = db_get(binddb, command); if (keys == "") @@ -1260,12 +1260,12 @@ string getcommandkey(string text, string command) if (keys == "NO_KEY") { if (autocvar_hud_showbinds > 1) - return sprintf(_("%s (not bound)"), text); + return sprintf(_("%s (not bound)"), cmd_name); else - return text; + return cmd_name; } - else if (autocvar_hud_showbinds > 1) - return sprintf("%s (%s)", text, keys); + else if (autocvar_hud_showbinds > 1 || forcename) + return sprintf("%s (%s)", cmd_name, keys); else return keys; } diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 15362aad3..1265331ae 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -103,7 +103,9 @@ float warmup_stage; void Fog_Force(); -string getcommandkey(string text, string command); +string _getcommandkey(string text, string command, bool forcename); +#define getcommandkey(cmd_name, command) _getcommandkey(cmd_name, command, false) +#define getcommandkey_forcename(cmd_name, command) _getcommandkey(cmd_name, command, true) string vote_called_vote; float ready_waiting;