From f8771c4f5043c105146029af2d8310ecd627ee40 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 30 Jan 2017 09:37:28 +0100 Subject: [PATCH] Properly round race times since they seem to always match timer display (that 0.4 was introduced when race times were to 1 decimal place) --- qcsrc/common/notifications/all.inc | 10 +++++----- qcsrc/common/notifications/all.qh | 4 ++-- qcsrc/common/util.qh | 4 +--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 8b5edbf6f..cba6023bd 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -239,10 +239,10 @@ MSG_INFO_NOTIF(CHAT_NOSPECTATORS, N_CHATCON, 0, 0, "", "", "", _("^F4NOTE: ^BGSpectator chat is not sent to players during the match"), "") MULTITEAM_INFO(CTF_CAPTURE, 4, N_CONSOLE, 1, 0, "s1", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag"), "", FLAG) - MULTITEAM_INFO(CTF_CAPTURE_BROKEN, 4, N_CONSOLE, 2, 2, "s1 f1p2dec s2 f2p2dec", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds, breaking ^BG%s^BG's previous record of ^F2%s^BG seconds"), "", FLAG) + MULTITEAM_INFO(CTF_CAPTURE_BROKEN, 4, N_CONSOLE, 2, 2, "s1 f1dtime s2 f2dtime", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds, breaking ^BG%s^BG's previous record of ^F2%s^BG seconds"), "", FLAG) MSG_INFO_NOTIF(CTF_CAPTURE_NEUTRAL, N_CONSOLE, 1, 0, "s1", "s1", "notify_neutral_captured", _("^BG%s^BG captured the flag"), "") - MULTITEAM_INFO(CTF_CAPTURE_TIME, 4, N_CONSOLE, 1, 1, "s1 f1p2dec", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds"), "", FLAG) - MULTITEAM_INFO(CTF_CAPTURE_UNBROKEN, 4, N_CONSOLE, 2, 2, "s1 f1p2dec s2 f2p2dec", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag in ^F2%s^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%s^BG seconds"), "", FLAG) + MULTITEAM_INFO(CTF_CAPTURE_TIME, 4, N_CONSOLE, 1, 1, "s1 f1dtime", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds"), "", FLAG) + MULTITEAM_INFO(CTF_CAPTURE_UNBROKEN, 4, N_CONSOLE, 2, 2, "s1 f1dtime s2 f2dtime", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag in ^F2%s^BG seconds, failing to break ^BG%s^BG's previous record of ^F1%s^BG seconds"), "", FLAG) MULTITEAM_INFO(CTF_FLAGRETURN_ABORTRUN, 4, N_CONSOLE, 0, 0, "", "", "", _("^BGThe ^TC^TT^BG flag was returned to base by its owner"), "", FLAG) MSG_INFO_NOTIF(CTF_FLAGRETURN_ABORTRUN_NEUTRAL, N_CONSOLE, 0, 0, "", "", "", _("^BGThe flag was returned by its owner"), "") MULTITEAM_INFO(CTF_FLAGRETURN_DAMAGED, 4, N_CONSOLE, 0, 0, "", "", "", _("^BGThe ^TC^TT^BG flag was destroyed and returned to base"), "", FLAG) @@ -251,8 +251,8 @@ MSG_INFO_NOTIF(CTF_FLAGRETURN_DROPPED_NEUTRAL, N_CONSOLE, 0, 0, "", "", "", _("^BGThe flag was dropped in the base and returned itself"), "") MULTITEAM_INFO(CTF_FLAGRETURN_NEEDKILL, 4, N_CONSOLE, 0, 0, "", "", "", _("^BGThe ^TC^TT^BG flag fell somewhere it couldn't be reached and returned to base"), "", FLAG) MSG_INFO_NOTIF(CTF_FLAGRETURN_NEEDKILL_NEUTRAL, N_CONSOLE, 0, 0, "", "", "", _("^BGThe flag fell somewhere it couldn't be reached and returned to base"), "") - MULTITEAM_INFO(CTF_FLAGRETURN_SPEEDRUN, 4, N_CONSOLE, 0, 1, "f1p2dec", "", "", _("^BGThe ^TC^TT^BG flag became impatient after ^F1%.2f^BG seconds and returned itself"), "", FLAG) - MSG_INFO_NOTIF(CTF_FLAGRETURN_SPEEDRUN_NEUTRAL, N_CONSOLE, 0, 1, "f1p2dec", "", "", _("^BGThe flag became impatient after ^F1%.2f^BG seconds and returned itself"), "") + MULTITEAM_INFO(CTF_FLAGRETURN_SPEEDRUN, 4, N_CONSOLE, 0, 1, "f1dtime", "", "", _("^BGThe ^TC^TT^BG flag became impatient after ^F1%.2f^BG seconds and returned itself"), "", FLAG) + MSG_INFO_NOTIF(CTF_FLAGRETURN_SPEEDRUN_NEUTRAL, N_CONSOLE, 0, 1, "f1dtime", "", "", _("^BGThe flag became impatient after ^F1%.2f^BG seconds and returned itself"), "") MULTITEAM_INFO(CTF_FLAGRETURN_TIMEOUT, 4, N_CONSOLE, 0, 0, "", "", "", _("^BGThe ^TC^TT^BG flag has returned to the base"), "", FLAG) MSG_INFO_NOTIF(CTF_FLAGRETURN_TIMEOUT_NEUTRAL, N_CONSOLE, 0, 0, "", "", "", _("^BGThe flag has returned to the base"), "") MULTITEAM_INFO(CTF_LOST, 4, N_CONSOLE, 1, 0, "s1", "s1", "notify_%s_lost", _("^BG%s^BG lost the ^TC^TT^BG flag"), "", FLAG) diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index 4bd827a6e..aea0ccd62 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -402,8 +402,8 @@ string BUFF_NAME(int i); ARG_CASE(ARG_CS_SV_DC, "f2", ftos(f2)) \ ARG_CASE(ARG_CS_SV, "f3", ftos(f3)) \ ARG_CASE(ARG_CS_SV, "f4", ftos(f4)) \ - ARG_CASE(ARG_CS_SV, "f1p2dec", ftos_decimals(f1/100, 2)) \ - ARG_CASE(ARG_CS_SV, "f2p2dec", ftos_decimals(f2/100, 2)) \ + ARG_CASE(ARG_CS_SV, "f1dtime", ftos_decimals(TIME_DECODE(f1), 2)) \ + ARG_CASE(ARG_CS_SV, "f2dtime", ftos_decimals(TIME_DECODE(f2), 2)) \ ARG_CASE(ARG_CS, "f2primsec", (f2 ? _("secondary") : _("primary"))) \ ARG_CASE(ARG_CS, "f3primsec", (f3 ? _("secondary") : _("primary"))) \ ARG_CASE(ARG_CS, "f1secs", count_seconds(f1)) \ diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 6e9b31a74..3304d0e7a 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -33,9 +33,7 @@ string draw_UseSkinFor(string pic); // for each element, funcPre is called first, then funcPre and funcPost for all its children, and funcPost last void depthfirst(entity start, .entity up, .entity downleft, .entity right, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass); -// adding just 0.4 for race times so it rounds down in the .5 case (matching the timer display) -// FIXME it doesn't round properly -#define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4) +#define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.5) const int TIME_DECIMALS = 2; const float TIME_FACTOR = 100; -- 2.39.2