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