Xonotic
scores.qh
Go to the documentation of this file.
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 
12 STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
13 
14 /*
15  * Score indices
16  */
17 
18 #ifdef GAMEQC
19 // fields not networked via the score system
20 REGISTER_SP(END);
21 
22 REGISTER_SP(PING);
23 REGISTER_SP(PL);
24 REGISTER_SP(NAME);
25 REGISTER_SP(SEPARATOR);
26 
27 REGISTER_SP(KDRATIO); // kills / deaths
28 REGISTER_SP(SUM); // kills - deaths
29 REGISTER_SP(FRAGS); // kills - suicides
30 
31 // networked fields
32 
33 REGISTER_SP(SCORE);
34 
35 REGISTER_SP(DMG);
36 REGISTER_SP(DMGTAKEN);
37 
38 REGISTER_SP(KILLS);
39 REGISTER_SP(DEATHS);
40 REGISTER_SP(SUICIDES);
41 REGISTER_SP(TEAMKILLS);
42 
43 REGISTER_SP(ELO);
44 
45 REGISTER_SP(FPS);
46 
47 // TODO: move to common mutators
48 
49 REGISTER_SP(RACE_TIME);
50 REGISTER_SP(RACE_LAPS);
51 REGISTER_SP(RACE_FASTEST);
52 
53 //REGISTER_SP(CTS_TIME);
54 //REGISTER_SP(CTS_LAPS);
55 //REGISTER_SP(CTS_FASTEST);
56 
57 REGISTER_SP(ASSAULT_OBJECTIVES);
58 
59 REGISTER_SP(CTF_PICKUPS);
60 REGISTER_SP(CTF_FCKILLS);
61 REGISTER_SP(CTF_RETURNS);
62 REGISTER_SP(CTF_CAPS);
63 REGISTER_SP(CTF_CAPTIME);
64 REGISTER_SP(CTF_DROPS);
65 
66 REGISTER_SP(DOM_TAKES);
67 REGISTER_SP(DOM_TICKS);
68 
69 REGISTER_SP(FREEZETAG_REVIVALS);
70 
71 REGISTER_SP(KEEPAWAY_PICKUPS);
72 REGISTER_SP(KEEPAWAY_BCTIME);
73 REGISTER_SP(KEEPAWAY_CARRIERKILLS);
74 
75 REGISTER_SP(KH_PICKUPS);
76 REGISTER_SP(KH_CAPS);
77 REGISTER_SP(KH_KCKILLS);
78 REGISTER_SP(KH_PUSHES);
79 REGISTER_SP(KH_DESTROYS);
80 REGISTER_SP(KH_LOSSES);
81 
82 REGISTER_SP(LMS_RANK);
83 REGISTER_SP(LMS_LIVES);
84 
85 REGISTER_SP(NEXBALL_GOALS);
86 REGISTER_SP(NEXBALL_FAULTS);
87 
88 REGISTER_SP(ONS_TAKES);
89 REGISTER_SP(ONS_CAPS);
90 #endif
91 
92 
93 // the stuff you don't need to see
94 
98 const int SFL_LOWER_IS_BETTER = BIT(0);
99 
103 const int SFL_HIDE_ZERO = BIT(1);
104 
108 const int SFL_ALLOW_HIDE = BIT(4);
109 
113 const int SFL_RANK = BIT(5);
114 
118 const int SFL_TIME = BIT(6);
119 
120 // not an extra constant yet
121 #define SFL_ZERO_IS_WORST SFL_TIME
122 
127 const int SFL_SORT_PRIO_PRIMARY = 8;
128 const int SFL_SORT_PRIO_MASK = 12;
129 
130 #define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER )
131 #define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) )
132 
135 .string m_name;
136 .int m_flags;
137 
138 #define scores(this) _scores[(this).m_id]
139 #define scores_label(this) ((this).m_name)
140 #define scores_flags(this) ((this).m_flags)
141 
142 #define MAX_TEAMSCORE 2
143 USING(ScoreTeam, string);
145 #define teamscores(i) _teamscores[i]
147 #define teamscores_label(i) _teamscores_label[i]
149 #define teamscores_flags(i) _teamscores_flags[i]
150 
151 const int ST_SCORE = 0;
#define MAX_SCORE
Definition: scores.qh:3
const int ST_SCORE
Definition: scores.qh:151
const int SFL_SORT_PRIO_MASK
Definition: scores.qh:128
const int SFL_HIDE_ZERO
Don't show zero values as scores.
Definition: scores.qh:103
int _teamscores_flags[MAX_TEAMSCORE]
Definition: scores.qh:148
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit)
Definition: scores.qh:126
entity() spawn
REGISTRY(Scores, MAX_SCORE)
const int SFL_SORT_PRIO_PRIMARY
Definition: scores.qh:127
int _scores[MAX_SCORE]
Definition: scores.qh:134
const int SFL_RANK
Display as a rank (with st, nd, rd, th suffix)
Definition: scores.qh:113
STATIC_INIT(Scores_renumber)
Definition: scores.qh:12
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
Definition: scores.qh:98
#define REGISTER_REGISTRY(id)
Definition: registry.qh:212
#define REGISTRY_DEFINE_GET(id, null)
Definition: registry.qh:40
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
string _teamscores_label[MAX_TEAMSCORE]
Definition: scores.qh:146
REGISTRY_CHECK(Scores)
#define MAX_TEAMSCORE
Definition: scores.qh:142
int m_flags
Definition: scores.qh:136
#define NULL
Definition: post.qh:17
int _teamscores[MAX_TEAMSCORE]
Definition: scores.qh:144
string ScoreTeam
Definition: scores.qh:143
#define REGISTER_SP(id)
Definition: scores.qh:5
#define USING(name, T)
Definition: _all.inc:72
#define FOREACH(list, cond, body)
Definition: iter.qh:19
const int SFL_TIME
Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!) ...
Definition: scores.qh:118
entity PlayerScoreField
Definition: scores.qh:133
const int SFL_ALLOW_HIDE
Allow a column to be hidden (do not automatically add it even if it is a sorting key) ...
Definition: scores.qh:108
REGISTRY_SORT(Scores)
string m_name
Definition: scores.qh:135