From: terencehill Date: Sun, 10 Jul 2016 10:16:41 +0000 (+0200) Subject: Display left time only once for multiple server notices with the same time X-Git-Tag: xonotic-v0.8.2~700^2~87^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1d029578808c46b09eec95ba4747401e7d17b495;p=xonotic%2Fxonotic-data.pk3dir.git Display left time only once for multiple server notices with the same time --- diff --git a/qcsrc/common/net_notice.qc b/qcsrc/common/net_notice.qc index 2dcd618c0..20d1351eb 100644 --- a/qcsrc/common/net_notice.qc +++ b/qcsrc/common/net_notice.qc @@ -82,10 +82,18 @@ void cl_notice_run() vector v3 = v1 + '10 10 0'; #define OUT(s, z) MACRO_BEGIN { drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); v3.y += z + 4; } MACRO_END + float cur_time = 0; + float time_width = 48; OUT(_("^1Server notices:"), 32); LL_EACH(cl_notices, it.alpha > time, { - string s = sprintf(_("^7%s (^3%d sec left)"), it.netname , rint(it.alpha - time)); - OUT(s, 16); + if(it.alpha - cur_time > 0.1) + { + cur_time = it.alpha; + string s = sprintf("^3%d", ceil(cur_time - time)); + drawcolorcodedstring(v3 + eX * 0.5 * (time_width - stringwidth(s, true, '1 1 0' * 16)), s, '1 1 0' * 16, 1, DRAWFLAG_NORMAL); + v3.x = v1.x + 10 + time_width; + } + OUT(it.netname, 16); }); #undef OUT }