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