1 #include "scores_rules.qh"
9 void CheckAllowedTeams (entity for_whom);
11 int NumTeams(int teams)
13 return boolean(teams & BIT(0)) + boolean(teams & BIT(1)) + boolean(teams & BIT(2)) + boolean(teams & BIT(3));
18 return NumTeams(ScoreRules_teams);
19 // NOTE: this method is unreliable, as forced teams set the c* globals to weird values
20 //return boolean(c1 >= 0) + boolean(c2 >= 0) + boolean(c3 >= 0) + boolean(c4 >= 0);
23 // NOTE: ST_constants may not be >= MAX_TEAMSCORE
24 // scores that should be in all modes:
25 void ScoreRules_basics(int teams, float sprio, float stprio, float score_enabled)
27 FOREACH(Scores, true, {
28 ScoreInfo_SetLabel_PlayerScore(it, "", 0);
30 for(int i = 0; i < MAX_TEAMSCORE; ++i)
31 ScoreInfo_SetLabel_TeamScore(i, "", 0);
33 ScoreRules_teams = teams;
36 ScoreInfo_SetLabel_TeamScore (ST_SCORE, "score", stprio);
38 if (!INDEPENDENT_PLAYERS)
39 ScoreInfo_SetLabel_PlayerScore(SP_KILLS, "kills", 0);
41 ScoreInfo_SetLabel_PlayerScore(SP_DEATHS, "deaths", SFL_LOWER_IS_BETTER);
43 if (!INDEPENDENT_PLAYERS)
44 ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES, "suicides", SFL_LOWER_IS_BETTER);
47 ScoreInfo_SetLabel_PlayerScore(SP_SCORE, "score", sprio);
49 ScoreInfo_SetLabel_PlayerScore(SP_DMG, "dmg", 0);
50 ScoreInfo_SetLabel_PlayerScore(SP_DMGTAKEN, "dmgtaken", SFL_LOWER_IS_BETTER);
51 ScoreInfo_SetLabel_PlayerScore(SP_ELO, "elo", 0);
53 void ScoreRules_basics_end()
55 ScoreInfo_Init(ScoreRules_teams);
57 void ScoreRules_generic()
61 CheckAllowedTeams(NULL);
63 if(c1 >= 0) teams |= BIT(0);
64 if(c2 >= 0) teams |= BIT(1);
65 if(c3 >= 0) teams |= BIT(2);
66 if(c4 >= 0) teams |= BIT(3);
67 ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
70 ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
71 ScoreRules_basics_end();