1 #include "scores_rules.qh"
3 #include <server/defs.qh>
4 #include <server/miscfunctions.qh>
7 #include <common/gamemodes/rules.qh>
11 void CheckAllowedTeams (entity for_whom);
13 int NumTeams(int teams)
15 return boolean(teams & BIT(0)) + boolean(teams & BIT(1)) + boolean(teams & BIT(2)) + boolean(teams & BIT(3));
20 return NumTeams(ScoreRules_teams);
21 // NOTE: this method is unreliable, as forced teams set the c* globals to weird values
22 //return boolean(c1 >= 0) + boolean(c2 >= 0) + boolean(c3 >= 0) + boolean(c4 >= 0);
25 // NOTE: ST_constants may not be >= MAX_TEAMSCORE
26 // scores that should be in all modes:
27 void ScoreRules_basics(int teams, float sprio, float stprio, float score_enabled)
29 FOREACH(Scores, true, {
30 ScoreInfo_SetLabel_PlayerScore(it, "", 0);
32 for(int i = 0; i < MAX_TEAMSCORE; ++i)
33 ScoreInfo_SetLabel_TeamScore(i, "", 0);
35 ScoreRules_teams = teams;
38 ScoreInfo_SetLabel_TeamScore (ST_SCORE, "score", stprio);
40 if (!INDEPENDENT_PLAYERS)
41 ScoreInfo_SetLabel_PlayerScore(SP_KILLS, "kills", 0);
43 ScoreInfo_SetLabel_PlayerScore(SP_DEATHS, "deaths", SFL_LOWER_IS_BETTER);
45 if (!INDEPENDENT_PLAYERS)
46 ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES, "suicides", SFL_LOWER_IS_BETTER);
49 ScoreInfo_SetLabel_PlayerScore(SP_SCORE, "score", sprio);
51 ScoreInfo_SetLabel_PlayerScore(SP_DMG, "dmg", 0);
52 ScoreInfo_SetLabel_PlayerScore(SP_DMGTAKEN, "dmgtaken", SFL_LOWER_IS_BETTER);
53 ScoreInfo_SetLabel_PlayerScore(SP_ELO, "elo", 0);
55 void ScoreRules_basics_end()
57 ScoreInfo_Init(ScoreRules_teams);
59 void ScoreRules_generic()
63 CheckAllowedTeams(NULL);
64 if (c1 >= 0) teams |= BIT(0);
65 if (c2 >= 0) teams |= BIT(1);
66 if (c3 >= 0) teams |= BIT(2);
67 if (c4 >= 0) teams |= BIT(3);
69 GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {});