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