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