Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
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))
6REGISTRY(Scores, MAX_SCORE)
8// do not sort alphabetically, player sort priority is based on score registration order
9//REGISTRY_SORT(Scores)
10REGISTRY_CHECK(Scores)
11
13STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
14
15/*
16 * Score indices
17 */
18#ifdef GAMEQC
19// networked fields
20// NOTE: score registration order is used as player sort priority (after primary and secondary)
21
22// TODO: move gametype scores to gametype files
23// TODO: allow gametypes to fully customize player sorting priority, even the common ones
24
25REGISTER_SP(RACE_LAPS);
26REGISTER_SP(RACE_TIME);
27REGISTER_SP(RACE_FASTEST);
28
29REGISTER_SP(ASSAULT_OBJECTIVES);
30
31REGISTER_SP(CTF_CAPS);
32REGISTER_SP(CTF_FCKILLS);
33REGISTER_SP(CTF_RETURNS);
34REGISTER_SP(CTF_DROPS);
35REGISTER_SP(CTF_PICKUPS);
36REGISTER_SP(CTF_CAPTIME);
37
38REGISTER_SP(DOM_TAKES);
39REGISTER_SP(DOM_TICKS);
40
41REGISTER_SP(FREEZETAG_REVIVALS);
42
43REGISTER_SP(KEEPAWAY_BCTIME);
44REGISTER_SP(KEEPAWAY_CARRIERKILLS);
45REGISTER_SP(KEEPAWAY_PICKUPS);
46
47REGISTER_SP(KH_CAPS);
48REGISTER_SP(KH_KCKILLS);
49REGISTER_SP(KH_LOSSES);
50REGISTER_SP(KH_DESTRUCTIONS);
51REGISTER_SP(KH_PUSHES);
52REGISTER_SP(KH_PICKUPS);
53
54REGISTER_SP(LMS_RANK);
55REGISTER_SP(LMS_LIVES);
56
57REGISTER_SP(NEXBALL_GOALS);
58REGISTER_SP(NEXBALL_FAULTS);
59
60REGISTER_SP(ONS_CAPS);
61REGISTER_SP(ONS_TAKES);
62
63REGISTER_SP(TKA_PICKUPS);
64REGISTER_SP(TKA_BCTIME);
65REGISTER_SP(TKA_CARRIERKILLS);
66
67REGISTER_SP(SURV_SURVIVALS);
68REGISTER_SP(SURV_HUNTS);
69
73REGISTER_SP(TEAMKILLS);
74REGISTER_SP(SUICIDES);
76REGISTER_SP(DMGTAKEN);
77
78REGISTER_SP(ROUNDS_PL);
79
80REGISTER_SP(SKILL); // not sortable
81REGISTER_SP(FPS); // not sortable
82
83// fields not networked via the score system
85
89REGISTER_SP(SEPARATOR);
90
91REGISTER_SP(KDRATIO); // kills / deaths
92REGISTER_SP(SUM); // kills - deaths
93REGISTER_SP(FRAGS); // kills - suicides
94#endif
95
96
97// the stuff you don't need to see
98
103
107const int SFL_HIDE_ZERO = BIT(1);
108
112const int SFL_ALLOW_HIDE = BIT(4);
113
117const int SFL_RANK = BIT(5);
118
122const int SFL_TIME = BIT(6);
123
124const int SFL_NOT_SORTABLE = BIT(7); // don't sort by this field
125
126// not an extra constant yet
127#define SFL_ZERO_IS_WORST SFL_TIME
128
136
137#define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER )
138#define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) )
139
142.string m_name;
144
145#define scores(this) _scores[(this).m_id]
146#define scores_label(this) ((this).m_name)
147#define scores_flags(this) ((this).m_flags)
148
149#define MAX_TEAMSCORE 2
152#define teamscores(i) _teamscores[i]
154#define teamscores_label(i) _teamscores_label[i]
156#define teamscores_flags(i) _teamscores_flags[i]
157
158const int ST_SCORE = 0;
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity PlayerScoreField
Definition scores.qh:140
#define MAX_TEAMSCORE
Definition scores.qh:149
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
Definition scores.qh:102
int _teamscores_flags[MAX_TEAMSCORE]
Definition scores.qh:155
string ScoreTeam
Definition scores.qh:150
#define REGISTER_SP(id)
Definition scores.qh:5
string _teamscores_label[MAX_TEAMSCORE]
Definition scores.qh:153
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:122
const int SFL_RANK
Display as a rank (with st, nd, rd, th suffix)
Definition scores.qh:117
const int ST_SCORE
Definition scores.qh:158
int _scores[MAX_SCORE]
Definition scores.qh:141
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:112
#define MAX_SCORE
Definition scores.qh:3
const int SFL_NOT_SORTABLE
Definition scores.qh:124
string m_name
Definition scores.qh:142
int _teamscores[MAX_TEAMSCORE]
Definition scores.qh:151
const int SFL_SORT_PRIO_MASK
Definition scores.qh:135
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit) NOTE: SFL_SORT_PRIO_SECONDARY value must be lo...
Definition scores.qh:133
int m_flags
Definition scores.qh:143
const int SFL_HIDE_ZERO
Don't show zero values as scores.
Definition scores.qh:107
const int SFL_SORT_PRIO_PRIMARY
Definition scores.qh:134
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define USING(name, T)
Definition _all.inc:72
#define NULL
Definition post.qh:14
#define REGISTER_REGISTRY(id)
Definition registry.qh:229
#define REGISTRY(id, max)
Declare a new registry.
Definition registry.qh:26
#define REGISTRY_CHECK(id)
Definition registry.qh:175
#define REGISTRY_DEFINE_GET(id, null)
Definition registry.qh:40
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:32