5 #define REGISTER_SP(id) REGISTER(Scores, SP, id, m_id, new_pure(PlayerScoreField))
6 REGISTRY(Scores, MAX_SCORE);
7 REGISTER_REGISTRY(Scores)
8 // do not sort alphabetically, player sort priority is based on score registration order
9 //REGISTRY_SORT(Scores);
10 REGISTRY_CHECK(Scores);
12 REGISTRY_DEFINE_GET(Scores, NULL)
13 STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
20 // NOTE: score registration order is used as player sort priority (after primary and secondary)
22 // TODO: move gamemode scores to gamemode files
23 // TODO: allow gamemodes to fully customize player sorting priority, even the common ones
25 REGISTER_SP(RACE_LAPS);
26 REGISTER_SP(RACE_TIME);
27 REGISTER_SP(RACE_FASTEST);
29 REGISTER_SP(ASSAULT_OBJECTIVES);
31 REGISTER_SP(CTF_CAPS);
32 REGISTER_SP(CTF_FCKILLS);
33 REGISTER_SP(CTF_RETURNS);
34 REGISTER_SP(CTF_DROPS);
35 REGISTER_SP(CTF_PICKUPS);
36 REGISTER_SP(CTF_CAPTIME);
38 REGISTER_SP(DOM_TAKES);
39 REGISTER_SP(DOM_TICKS);
41 REGISTER_SP(FREEZETAG_REVIVALS);
43 REGISTER_SP(KEEPAWAY_BCTIME);
44 REGISTER_SP(KEEPAWAY_CARRIERKILLS);
45 REGISTER_SP(KEEPAWAY_PICKUPS);
48 REGISTER_SP(KH_KCKILLS);
49 REGISTER_SP(KH_LOSSES);
50 REGISTER_SP(KH_DESTROYS);
51 REGISTER_SP(KH_PUSHES);
52 REGISTER_SP(KH_PICKUPS);
54 REGISTER_SP(LMS_RANK);
55 REGISTER_SP(LMS_LIVES);
57 REGISTER_SP(NEXBALL_GOALS);
58 REGISTER_SP(NEXBALL_FAULTS);
60 REGISTER_SP(ONS_CAPS);
61 REGISTER_SP(ONS_TAKES);
63 REGISTER_SP(TKA_PICKUPS);
64 REGISTER_SP(TKA_BCTIME);
65 REGISTER_SP(TKA_CARRIERKILLS);
67 REGISTER_SP(SURV_SURVIVALS);
68 REGISTER_SP(SURV_HUNTS);
73 REGISTER_SP(TEAMKILLS);
74 REGISTER_SP(SUICIDES);
76 REGISTER_SP(DMGTAKEN);
78 REGISTER_SP(ROUNDS_PL);
80 REGISTER_SP(ELO); // not sortable
81 REGISTER_SP(FPS); // not sortable
83 // fields not networked via the score system
89 REGISTER_SP(SEPARATOR);
91 REGISTER_SP(KDRATIO); // kills / deaths
92 REGISTER_SP(SUM); // kills - deaths
93 REGISTER_SP(FRAGS); // kills - suicides
97 // the stuff you don't need to see
100 * Lower scores are better (e.g. suicides)
102 const int SFL_LOWER_IS_BETTER = BIT(0);
105 * Don't show zero values as scores
107 const int SFL_HIDE_ZERO = BIT(1);
110 * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
112 const int SFL_ALLOW_HIDE = BIT(4);
115 * Display as a rank (with st, nd, rd, th suffix)
117 const int SFL_RANK = BIT(5);
120 * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
122 const int SFL_TIME = BIT(6);
124 const int SFL_NOT_SORTABLE = BIT(7); // don't sort by this field
126 // not an extra constant yet
127 #define SFL_ZERO_IS_WORST SFL_TIME
130 * Scoring priority (NOTE: PRIMARY is used for fraglimit)
131 * NOTE: SFL_SORT_PRIO_SECONDARY value must be lower than SFL_SORT_PRIO_PRIMARY's
133 const int SFL_SORT_PRIO_SECONDARY = BIT(2);
134 const int SFL_SORT_PRIO_PRIMARY = BIT(3);
135 const int SFL_SORT_PRIO_MASK = SFL_SORT_PRIO_PRIMARY | SFL_SORT_PRIO_SECONDARY;
137 #define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER )
138 #define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) )
140 USING(PlayerScoreField, entity);
141 .int _scores[MAX_SCORE];
145 #define scores(this) _scores[(this).m_id]
146 #define scores_label(this) ((this).m_name)
147 #define scores_flags(this) ((this).m_flags)
149 #define MAX_TEAMSCORE 2
150 USING(ScoreTeam, string);
151 .int _teamscores[MAX_TEAMSCORE];
152 #define teamscores(i) _teamscores[i]
153 string _teamscores_label[MAX_TEAMSCORE];
154 #define teamscores_label(i) _teamscores_label[i]
155 int _teamscores_flags[MAX_TEAMSCORE];
156 #define teamscores_flags(i) _teamscores_flags[i]
158 const int ST_SCORE = 0;