]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/scores.qh
add strafe efficiency field for CTS scoreboard
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / scores.qh
1 #pragma once
2
3 #define MAX_SCORE 64
4
5 #define REGISTER_SP(id) REGISTER(Scores, SP, id, m_id, new_pure(PlayerScoreField))
6 REGISTRY(Scores, MAX_SCORE);
7 REGISTER_REGISTRY(Scores)
8 REGISTRY_SORT(Scores);
9 REGISTRY_CHECK(Scores);
10
11 REGISTRY_DEFINE_GET(Scores, NULL)
12 STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
13
14 /*
15  * Score indices
16  */
17
18 // game mode specific indices are not in common/, but in server/scores_rules.qc!
19 #ifdef GAMEQC
20 REGISTER_SP(END);
21
22 REGISTER_SP(PING);
23 REGISTER_SP(PL);
24 REGISTER_SP(NAME);
25 REGISTER_SP(KDRATIO);
26 REGISTER_SP(SUM);
27
28 REGISTER_SP(SEPARATOR);
29
30 REGISTER_SP(SCORE);
31
32 REGISTER_SP(DMG);
33 REGISTER_SP(DMGTAKEN);
34
35 REGISTER_SP(KILLS);
36 REGISTER_SP(DEATHS);
37 REGISTER_SP(SUICIDES);
38 REGISTER_SP(TEAMKILLS);
39 REGISTER_SP(FRAGS);
40
41 REGISTER_SP(ELO);
42
43 REGISTER_SP(FPS);
44
45 // TODO: move to common mutators
46
47 REGISTER_SP(RACE_TIME);
48 REGISTER_SP(RACE_LAPS);
49 REGISTER_SP(RACE_FASTEST);
50
51 //REGISTER_SP(CTS_TIME);
52 //REGISTER_SP(CTS_LAPS);
53 //REGISTER_SP(CTS_FASTEST);
54 REGISTER_SP(CTS_STRAFE);
55
56 REGISTER_SP(ASSAULT_OBJECTIVES);
57
58 REGISTER_SP(CTF_PICKUPS);
59 REGISTER_SP(CTF_FCKILLS);
60 REGISTER_SP(CTF_RETURNS);
61 REGISTER_SP(CTF_CAPS);
62 REGISTER_SP(CTF_CAPTIME);
63 REGISTER_SP(CTF_DROPS);
64
65 REGISTER_SP(DOM_TAKES);
66 REGISTER_SP(DOM_TICKS);
67
68 REGISTER_SP(FREEZETAG_REVIVALS);
69
70 REGISTER_SP(KEEPAWAY_PICKUPS);
71 REGISTER_SP(KEEPAWAY_BCTIME);
72 REGISTER_SP(KEEPAWAY_CARRIERKILLS);
73
74 REGISTER_SP(KH_PICKUPS);
75 REGISTER_SP(KH_CAPS);
76 REGISTER_SP(KH_KCKILLS);
77 REGISTER_SP(KH_PUSHES);
78 REGISTER_SP(KH_DESTROYS);
79 REGISTER_SP(KH_LOSSES);
80
81 REGISTER_SP(LMS_RANK);
82 REGISTER_SP(LMS_LIVES);
83
84 REGISTER_SP(NEXBALL_GOALS);
85 REGISTER_SP(NEXBALL_FAULTS);
86
87 REGISTER_SP(ONS_TAKES);
88 REGISTER_SP(ONS_CAPS);
89 #endif
90
91
92 // the stuff you don't need to see
93
94 /**
95  * Lower scores are better (e.g. suicides)
96  */
97 const int SFL_LOWER_IS_BETTER = BIT(0);
98
99 /**
100  * Don't show zero values as scores
101  */
102 const int SFL_HIDE_ZERO = BIT(1);
103
104 /**
105  * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
106  */
107 const int SFL_ALLOW_HIDE = BIT(4);
108
109 /**
110  * Display as a rank (with st, nd, rd, th suffix)
111  */
112 const int SFL_RANK = BIT(5);
113
114 /**
115  * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
116  */
117 const int SFL_TIME = BIT(6);
118
119 // not an extra constant yet
120 #define SFL_ZERO_IS_WORST SFL_TIME
121
122 /**
123  * Scoring priority (NOTE: PRIMARY is used for fraglimit)
124  */
125 const int SFL_SORT_PRIO_SECONDARY = 4;
126 const int SFL_SORT_PRIO_PRIMARY = 8;
127 const int SFL_SORT_PRIO_MASK = 12;
128
129 #define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER )
130 #define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) )
131
132 USING(PlayerScoreField, entity);
133 .int _scores[MAX_SCORE];
134 .string m_name;
135 .int m_flags;
136
137 #define scores(this) _scores[(this).m_id]
138 #define scores_label(this) ((this).m_name)
139 #define scores_flags(this) ((this).m_flags)
140
141 #define MAX_TEAMSCORE 2
142 USING(ScoreTeam, string);
143 .int _teamscores[MAX_TEAMSCORE];
144 #define teamscores(i) _teamscores[i]
145 string _teamscores_label[MAX_TEAMSCORE];
146 #define teamscores_label(i) _teamscores_label[i]
147 int _teamscores_flags[MAX_TEAMSCORE];
148 #define teamscores_flags(i) _teamscores_flags[i]
149
150 const int ST_SCORE = 0;