]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/scores_rules.qc
0b9d120d43c6ec99c99d3ba902434676a141cbf5
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / scores_rules.qc
1 float c1, c2, c3, c4;
2 void CheckAllowedTeams (entity for_whom);
3
4 // NOTE: SP_ constants may not be >= MAX_SCORE; ST_constants may not be >= MAX_TEAMSCORE
5 // scores that should be in all modes:
6 float ScoreRules_teams;
7 void ScoreRules_basics(float teams, float sprio, float stprio, float score_enabled)
8 {
9         float i;
10         for(i = 0; i < MAX_SCORE; ++i)
11                 ScoreInfo_SetLabel_PlayerScore(i, "", 0);
12         for(i = 0; i < MAX_TEAMSCORE; ++i)
13                 ScoreInfo_SetLabel_TeamScore(i, "", 0);
14
15         ScoreRules_teams = teams;
16
17         if(score_enabled)
18                 ScoreInfo_SetLabel_TeamScore  (ST_SCORE,        "score",     stprio);
19
20         if (!INDEPENDENT_PLAYERS)
21                 ScoreInfo_SetLabel_PlayerScore(SP_KILLS,        "kills",     0);
22
23         ScoreInfo_SetLabel_PlayerScore(SP_DEATHS,       "deaths",    SFL_LOWER_IS_BETTER);
24
25         if (!INDEPENDENT_PLAYERS)
26                 ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES,     "suicides",  SFL_LOWER_IS_BETTER);
27
28         if(score_enabled)
29                 ScoreInfo_SetLabel_PlayerScore(SP_SCORE,        "score",     sprio);
30 }
31 void ScoreRules_basics_end()
32 {
33         ScoreInfo_Init(ScoreRules_teams);
34 }
35 void ScoreRules_generic()
36 {
37         if(teamplay)
38         {
39                 CheckAllowedTeams(world);
40                 ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
41         }
42         else
43                 ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
44         ScoreRules_basics_end();
45 }
46