1#pragma once
2
3const int RANKINGS_CNT = 15;
4
5const int SPRITERULE_DEFAULT = 0;
6const int SPRITERULE_TEAMPLAY = 1;
7const int SPRITERULE_SPECTATOR = 2;
8
9///////////////////////////
10// keys pressed
11const int KEY_FORWARD = BIT(0);
12const int KEY_BACKWARD = BIT(1);
13const int KEY_LEFT = BIT(2);
14const int KEY_RIGHT = BIT(3);
15const int KEY_JUMP = BIT(4);
16const int KEY_CROUCH = BIT(5);
17const int KEY_ATCK = BIT(6);
18const int KEY_ATCK2 = BIT(7);
19
20///////////////////////////
21// cvar constants
22
23const int CVAR_SAVE = 1;
24const int CVAR_NOTIFY = 2;
25const int CVAR_READONLY = 4;
26
27///////////////////////////
28// csqc communication stuff
29
30const int HUD_NORMAL = 0;
31const int HUD_BUMBLEBEE_GUN = 25;
32
33// moved that here so the client knows the max.
34// # of maps, I'll use arrays for them :P
35const int MAPVOTE_COUNT = 30;
36
37/**
38 * Lower scores are better (e.g. suicides)
39 */
40const int SFL_LOWER_IS_BETTER = BIT(0);
41
42/**
43 * Don't show zero values as scores
44 */
45const int SFL_HIDE_ZERO = BIT(1);
46
47/**
48 * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
49 */
50const int SFL_ALLOW_HIDE = BIT(4);
51
52/**
53 * Display as a rank (with st, nd, rd, th suffix)
54 */
55const int SFL_RANK = BIT(5);
56
57/**
58 * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
59 */
60const int SFL_TIME = BIT(6);
61
62// not an extra constant yet
63#define SFL_ZERO_IS_WORST SFL_TIME
64
65/**
66 * Scoring priority (NOTE: PRIMARY is used for fraglimit)
67 */
68const int SFL_SORT_PRIO_SECONDARY = 4;
69const int SFL_SORT_PRIO_PRIMARY = 8;
70const int SFL_SORT_PRIO_MASK = 12;
71
72/*
73 * Score indices
74 */
75
76#ifdef GAMEQC
77
78#define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER )
79#define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) )
80
81
82#define MAX_SCORE 64
83
84#define REGISTER_SP(id) REGISTER(Scores, SP, id, m_id, new_pure(PlayerScoreField))
85REGISTRY(Scores, MAX_SCORE);
86#define Scores_from(i) _Scores_from(i, NULL)
87REGISTER_REGISTRY(Scores)
88REGISTRY_SORT(Scores);
89REGISTRY_CHECK(Scores);
90STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
91
92USING(PlayerScoreField, entity);
93.int _scores[MAX_SCORE];
94.string m_name;
95.int m_flags;
96
97#define scores(this) _scores[(this).m_id]
98#define scores_label(this) ((this).m_name)
99#define scores_flags(this) ((this).m_flags)
100
101REGISTER_SP(END);
102
103REGISTER_SP(PING);
104REGISTER_SP(PL);
105REGISTER_SP(NAME);
106REGISTER_SP(KDRATIO);
107REGISTER_SP(SUM);
108
109REGISTER_SP(SEPARATOR);
110
111REGISTER_SP(SCORE);
112
113REGISTER_SP(DMG);
114REGISTER_SP(DMGTAKEN);
115
116REGISTER_SP(KILLS);
117REGISTER_SP(DEATHS);
118REGISTER_SP(SUICIDES);
119REGISTER_SP(FRAGS);
120
121REGISTER_SP(ELO);
122
123// TODO: move to common mutators
124
125REGISTER_SP(RACE_TIME);
126REGISTER_SP(RACE_LAPS);
127REGISTER_SP(RACE_FASTEST);
128
129//REGISTER_SP(CTS_TIME);
130//REGISTER_SP(CTS_LAPS);
131//REGISTER_SP(CTS_FASTEST);
132
133REGISTER_SP(ASSAULT_OBJECTIVES);
134
135REGISTER_SP(CTF_PICKUPS);
136REGISTER_SP(CTF_FCKILLS);
137REGISTER_SP(CTF_RETURNS);
138REGISTER_SP(CTF_CAPS);
139REGISTER_SP(CTF_CAPTIME);
140REGISTER_SP(CTF_DROPS);
141
142REGISTER_SP(DOM_TAKES);
143REGISTER_SP(DOM_TICKS);
144
145REGISTER_SP(FREEZETAG_REVIVALS);
146
147REGISTER_SP(KEEPAWAY_PICKUPS);
148REGISTER_SP(KEEPAWAY_BCTIME);
149REGISTER_SP(KEEPAWAY_CARRIERKILLS);
150
151REGISTER_SP(KH_PICKUPS);
152REGISTER_SP(KH_CAPS);
153REGISTER_SP(KH_KCKILLS);
154REGISTER_SP(KH_PUSHES);
155REGISTER_SP(KH_DESTROYS);
156REGISTER_SP(KH_LOSSES);
157
158REGISTER_SP(LMS_RANK);
159REGISTER_SP(LMS_LIVES);
160
161REGISTER_SP(NEXBALL_GOALS);
162REGISTER_SP(NEXBALL_FAULTS);
163
164REGISTER_SP(ONS_TAKES);
165REGISTER_SP(ONS_CAPS);
166
167#define MAX_TEAMSCORE 2
168USING(ScoreTeam, string);
169.int _teamscores[MAX_TEAMSCORE];
170#define teamscores(i) _teamscores[i]
171string _teamscores_label[MAX_TEAMSCORE];
172#define teamscores_label(i) _teamscores_label[i]
173int _teamscores_flags[MAX_TEAMSCORE];
174#define teamscores_flags(i) _teamscores_flags[i]
175
176#endif
177
178const int ST_SCORE = 0;
179
180// game mode specific indices are not in common/, but in server/scores_rules.qc!
181
182// WEAPONTODO: move this into separate/new projectile handling code // this sets sounds and other properties of the projectiles in csqc
183const int PROJECTILE_ELECTRO = 1;
184const int PROJECTILE_ROCKET = 2;
185const int PROJECTILE_TAG = 3;
186const int PROJECTILE_CRYLINK = 5;
187const int PROJECTILE_ELECTRO_BEAM = 6;
188const int PROJECTILE_GRENADE = 7;
189const int PROJECTILE_GRENADE_BOUNCING = 8;
190const int PROJECTILE_MINE = 9;
191const int PROJECTILE_BLASTER = 10;
192const int PROJECTILE_HLAC = 11;
193const int PROJECTILE_SEEKER = 12;
194const int PROJECTILE_FLAC = 13;
195const int PROJECTILE_PORTO_RED = 14;
196const int PROJECTILE_PORTO_BLUE = 15;
197const int PROJECTILE_HOOKBOMB = 16;
198const int PROJECTILE_HAGAR = 17;
199const int PROJECTILE_HAGAR_BOUNCING = 18;
200const int PROJECTILE_CRYLINK_BOUNCING = 20;
201const int PROJECTILE_FIREBALL = 21;
202const int PROJECTILE_FIREMINE = 22;
203
204const int PROJECTILE_RAPTORCANNON = 24;
205const int PROJECTILE_RAPTORBOMB = 25;
206const int PROJECTILE_RAPTORBOMBLET = 26;
207const int PROJECTILE_SPIDERROCKET = 27;
208const int PROJECTILE_WAKIROCKET = 28;
209const int PROJECTILE_WAKICANNON = 29;
210
211const int PROJECTILE_BUMBLE_GUN = 30;
212const int PROJECTILE_BUMBLE_BEAM = 31;
213
214const int PROJECTILE_MAGE_SPIKE = 32;
215const int PROJECTILE_SHAMBLER_LIGHTNING = 33;
216
217const int PROJECTILE_ROCKETMINSTA_LASER = 34;
218
219const int PROJECTILE_ARC_BOLT = 35;
220
221// projectile IDs 40-50 reserved
222
223const int PROJECTILE_RPC = 60;
224
225const int SPECIES_HUMAN = 0;
226const int SPECIES_ROBOT_SOLID = 1;
227const int SPECIES_ALIEN = 2;
228const int SPECIES_ANIMAL = 3;
229const int SPECIES_ROBOT_RUSTY = 4;
230const int SPECIES_ROBOT_SHINY = 5;
231const int SPECIES_RESERVED = 15;
232
233const int FRAGS_PLAYER = 0;
234const int FRAGS_SPECTATOR = -666;
235const int FRAGS_LMS_LOSER = -616;
236const int FRAGS_PLAYER_NONSOLID = FRAGS_LMS_LOSER;
237// we can use this frags value for both
238
239// water levels
240const int WATERLEVEL_NONE = 0;
241const int WATERLEVEL_WETFEET = 1;
242const int WATERLEVEL_SWIMMING = 2;
243const int WATERLEVEL_SUBMERGED = 3;
244
245// server flags
246const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
247const int SERVERFLAG_TEAMPLAY = 2;
248const int SERVERFLAG_PLAYERSTATS = 4;
249
250#ifdef SVQC
251// FIXME/EXPLAINME: why? Mario: because
252vector autocvar_sv_player_maxs = '16 16 45';
253vector autocvar_sv_player_mins = '-16 -16 -24';
254vector autocvar_sv_player_viewoffset = '0 0 20';
255vector autocvar_sv_player_crouch_maxs = '16 16 25';
256vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
257vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
258//vector autocvar_sv_player_headsize = '24 24 12';
259#endif
260
261
262// a bit more constant
263const vector PL_MAX_CONST = '16 16 45';
264const vector PL_MIN_CONST = '-16 -16 -24';
265
266// spawnpoint prios
267const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200;
268const int SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM = 100;
269const int SPAWN_PRIO_RACE_PREVIOUS_SPAWN = 50;
270const int SPAWN_PRIO_GOOD_DISTANCE = 10;
271
272// gametype vote flags
273const int GTV_FORBIDDEN = 0; // Cannot be voted
274const int GTV_AVAILABLE = 1; // Can be voted
275const int GTV_CUSTOM    = 2; // Custom entry
276