From: Martin Taibr Date: Thu, 26 Mar 2020 15:29:15 +0000 (+0100) Subject: simplify frags remaining announcer X-Git-Tag: xonotic-v0.8.5~1133^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=93580497748c949276e4f8c383a7ea85633e3ae4;p=xonotic%2Fxonotic-data.pk3dir.git simplify frags remaining announcer --- diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index b70a1330a..cff673e44 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1705,8 +1705,6 @@ void ShuffleMaplist() cvar_set("g_maplist", shufflewords(autocvar_g_maplist)); } -float leaderscore; -float secondscore; int fragsleft_last; float WinningCondition_Scores(float limit, float leadlimit) { @@ -1739,36 +1737,28 @@ float WinningCondition_Scores(float limit, float leadlimit) leadlimit = 0; // not supported in this mode if(MUTATOR_CALLHOOK(Scores_CountFragsRemaining)) - // these modes always score in increments of 1, thus this makes sense { - if (leaderscore != WinningConditionHelper_topscore || - secondscore != WinningConditionHelper_secondscore) - { - leaderscore = WinningConditionHelper_topscore; - secondscore = WinningConditionHelper_secondscore; - - int fragsleft = FLOAT_MAX, leadingfragsleft = FLOAT_MAX; - if (limit) - fragsleft = limit - leaderscore; - if (leadlimit) - leadingfragsleft = secondscore + leadlimit - leaderscore; + float fragsleft = FLOAT_MAX, leadingfragsleft = FLOAT_MAX; + if (limit) + fragsleft = limit - WinningConditionHelper_topscore; + if (leadlimit) + leadingfragsleft = WinningConditionHelper_secondscore + leadlimit - WinningConditionHelper_topscore; - if (limit && leadlimit && autocvar_leadlimit_and_fraglimit) - fragsleft = max(leadingfragsleft, fragsleft); - else - fragsleft = min(fragsleft, leadingfragsleft); + if (limit && leadlimit && autocvar_leadlimit_and_fraglimit) + fragsleft = max(leadingfragsleft, fragsleft); + else + fragsleft = min(fragsleft, leadingfragsleft); - if (fragsleft_last != fragsleft) // do not announce same remaining frags multiple times - { - if (fragsleft == 1) - Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_1); - else if (fragsleft == 2) - Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_2); - else if (fragsleft == 3) - Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_3); - - fragsleft_last = fragsleft; - } + if (fragsleft_last != fragsleft) // do not announce same remaining frags multiple times + { + if (fragsleft == 1) + Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_1); + else if (fragsleft == 2) + Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_2); + else if (fragsleft == 3) + Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_3); + + fragsleft_last = fragsleft; } }