// announce remaining frags
return true;
}
+
+MUTATOR_HOOKFUNCTION(dm, Scores_AnnounceLeads)
+{
+ // enable leads announcer
+ return true;
+}
return true;
}
+MUTATOR_HOOKFUNCTION(duel, Scores_AnnounceLeads)
+{
+ // enable leads announcer
+ return true;
+}
+
MUTATOR_HOOKFUNCTION(duel, FilterItemDefinition)
{
entity definition = M_ARGV(0, entity);
MSG_ANNCE_NOTIF(VOTE_CALL, N__ALWAYS, "votecall", CH_INFO, VOL_BASEVOICE, ATTEN_NONE)
MSG_ANNCE_NOTIF(VOTE_FAIL, N__ALWAYS, "votefail", CH_INFO, VOL_BASEVOICE, ATTEN_NONE)
+ MSG_ANNCE_NOTIF(LEAD_GAINED, N__ALWAYS, "leadgained", CH_INFO, VOL_BASEVOICE, ATTEN_NONE)
+ MSG_ANNCE_NOTIF(LEAD_LOST, N__ALWAYS, "leadlost", CH_INFO, VOL_BASEVOICE, ATTEN_NONE)
+ MSG_ANNCE_NOTIF(LEAD_TIED, N__ALWAYS, "leadtied", CH_INFO, VOL_BASEVOICE, ATTEN_NONE)
+
#undef N___NEVER
#undef N_GNTLOFF
#undef N__ALWAYS
MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
/** Return error to play frag remaining announcements */
+MUTATOR_HOOKABLE(Scores_AnnounceLeads, EV_NO_ARGS);
MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
#define EV_GrappleHookThink(i, o) \
return result.x;
}
+bool Score_NewLeader()
+{
+ // Returns true if the game leader has changed (no teamplay support yet)
+ if (teamplay) return false;
+ if (WinningConditionHelper_winner != WinningConditionHelper_winner_last && (WinningConditionHelper_second || WinningConditionHelper_equality))
+ {
+ WinningConditionHelper_winner_last = WinningConditionHelper_winner;
+ return true;
+ }
+ return false;
+}
+
void WinningConditionHelper(entity this)
{
float c;
WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, false) == 0);
if(WinningConditionHelper_equality)
+ {
+ WinningConditionHelper_equality_one = WinningConditionHelper_winner;
+ WinningConditionHelper_equality_two = WinningConditionHelper_second;
WinningConditionHelper_winner = WinningConditionHelper_second = NULL;
+ }
+ else
+ WinningConditionHelper_equality_one = WinningConditionHelper_equality_two = NULL;
WinningConditionHelper_topscore = winnerscorekeeper.scores_primary;
WinningConditionHelper_secondscore = secondscorekeeper.scores_primary;
float WinningConditionHelper_equality; ///< we have no winner
entity WinningConditionHelper_winner; ///< the winning player, or NULL if none
entity WinningConditionHelper_second; ///< the second player, or NULL if none
+entity WinningConditionHelper_winner_last;
+entity WinningConditionHelper_equality_one;
+entity WinningConditionHelper_equality_two;
float WinningConditionHelper_lowerisbetter; ///< lower is better, duh
float WinningConditionHelper_zeroisworst; ///< zero is worst, duh
#define WINNINGCONDITIONHELPER_LOWERISBETTER_WORST 999999999
FOREACH_CLIENT(IS_PLAYER(it) || INGAME(it), { it.winning = 0; });
}
+void AnnounceNewLeader()
+{
+ LOG_INFO("Announce new leader");
+ // Don't announce if in warmup or just started
+ if(warmup_stage || time - game_starttime < 1) return;
+ if(teamplay) return; // Not implemented in teamplay yet. We need an announcer for that.
+
+ if (WinningConditionHelper_equality)
+ {
+ Send_Notification(NOTIF_ONE, WinningConditionHelper_equality_one, MSG_ANNCE, ANNCE_LEAD_TIED);
+ Send_Notification(NOTIF_ONE, WinningConditionHelper_equality_two, MSG_ANNCE, ANNCE_LEAD_TIED);
+ }
+ else
+ {
+ Send_Notification(NOTIF_ONE, WinningConditionHelper_winner, MSG_ANNCE, ANNCE_LEAD_GAINED);
+ Send_Notification(NOTIF_ONE, WinningConditionHelper_second, MSG_ANNCE, ANNCE_LEAD_LOST);
+ }
+}
+
int fragsleft_last;
float WinningCondition_Scores(float limit, float leadlimit)
{
}
}
+ // Announce new leader if any
+ if(MUTATOR_CALLHOOK(Scores_AnnounceLeads)) {
+ if (Score_NewLeader()) {
+ LOG_INFO("Pass 2");
+ AnnounceNewLeader();
+ }
+ }
+
bool fraglimit_reached = (limit && WinningConditionHelper_topscore >= limit);
bool leadlimit_reached = (leadlimit && WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit);