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