Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_race.qc File Reference
#include "sv_race.qh"
#include <server/client.qh>
#include <server/world.qh>
#include <server/gamelog.qh>
#include <server/intermission.qh>
#include <server/race.qh>
#include <common/ent_cs.qh>
#include <common/mapobjects/triggers.qh>
Include dependency graph for sv_race.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define autocvar_g_race_laps_limit   cvar("g_race_laps_limit")

Functions

void havocbot_role_race (entity this)
 MUTATOR_HOOKFUNCTION (rc, AbortSpeedrun)
 MUTATOR_HOOKFUNCTION (rc, CheckRules_World)
 MUTATOR_HOOKFUNCTION (rc, ClientConnect)
 MUTATOR_HOOKFUNCTION (rc, ClientKill)
 MUTATOR_HOOKFUNCTION (rc, FixClientCvars)
 MUTATOR_HOOKFUNCTION (rc, ForbidPlayerScore_Clear)
 MUTATOR_HOOKFUNCTION (rc, GetPressedKeys)
 MUTATOR_HOOKFUNCTION (rc, GetRecords)
 MUTATOR_HOOKFUNCTION (rc, HavocBot_ChooseRole)
 MUTATOR_HOOKFUNCTION (rc, MakePlayerObserver)
 MUTATOR_HOOKFUNCTION (rc, PlayerDamaged)
 MUTATOR_HOOKFUNCTION (rc, PlayerDies)
 MUTATOR_HOOKFUNCTION (rc, PlayerPhysics)
 MUTATOR_HOOKFUNCTION (rc, PlayerSpawn)
 MUTATOR_HOOKFUNCTION (rc, PutClientInServer)
 MUTATOR_HOOKFUNCTION (rc, ReadLevelCvars)
 MUTATOR_HOOKFUNCTION (rc, reset_map_global)
 MUTATOR_HOOKFUNCTION (rc, Scores_CountFragsRemaining)
 MUTATOR_HOOKFUNCTION (rc, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE)
void race_EventLog (string mode, entity actor)
void race_Initialize ()
void race_ScoreRules ()
void rc_SetLimits ()
float WinningCondition_QualifyingThenRace (float limit)
float WinningCondition_Race (float fraglimit)

Variables

float autocvar_g_race_qualifying_timelimit
float autocvar_g_race_qualifying_timelimit_override
int autocvar_g_race_teams
float race_checkpoint

Macro Definition Documentation

◆ autocvar_g_race_laps_limit

#define autocvar_g_race_laps_limit   cvar("g_race_laps_limit")

Definition at line 11 of file sv_race.qc.

Referenced by rc_SetLimits().

Function Documentation

◆ havocbot_role_race()

void havocbot_role_race ( entity this)

Definition at line 18 of file sv_race.qc.

19{
20 if(IS_DEAD(this))
21 return;
22
24 {
26
27 bool raw_touch_check = true;
28 int cp = this.race_checkpoint;
29
30 LABEL(search_racecheckpoints)
32 {
33 if(it.cnt == cp || cp == -1)
34 {
35 // redirect bot to next goal if it touched the waypoint of an untouchable checkpoint
36 // e.g. checkpoint in front of Stormkeep's warpzone
37 // the same workaround is applied in CTS gametype
38 if (raw_touch_check && vdist(this.origin - it.nearestwaypoint.origin, <, 30))
39 {
40 cp = race_NextCheckpoint(cp);
41 raw_touch_check = false;
42 goto search_racecheckpoints;
43 }
44 navigation_routerating(this, it, 1000000, 5000);
45 }
46 });
47
49
51 }
52}
void navigation_goalrating_start(entity this)
void navigation_goalrating_timeout_set(entity this)
Definition navigation.qc:20
bool navigation_goalrating_timeout(entity this)
Definition navigation.qc:44
void navigation_routerating(entity this, entity e, float f, float rangebias)
void navigation_goalrating_end(entity this)
#define IS_DEAD(s)
Definition player.qh:245
#define LABEL(id)
Definition compiler.qh:34
vector origin
#define IL_EACH(this, cond, body)
float race_checkpoint
Definition racetimer.qh:8
float race_NextCheckpoint(float f)
Definition race.qc:175
IntrusiveList g_racecheckpoints
Definition race.qc:67
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References entity(), g_racecheckpoints, IL_EACH, IS_DEAD, LABEL, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), navigation_routerating(), origin, race_checkpoint, race_NextCheckpoint(), and vdist.

Referenced by MUTATOR_HOOKFUNCTION().

◆ MUTATOR_HOOKFUNCTION() [1/19]

MUTATOR_HOOKFUNCTION ( rc ,
AbortSpeedrun  )

Definition at line 121 of file sv_race.qc.

122{
123 entity player = M_ARGV(0, entity);
124
126 race_PreparePlayer(player); // nice try
127}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define M_ARGV(x, type)
Definition events.qh:17
void race_PreparePlayer(entity this)
Definition race.qc:1246
bool autocvar_g_allow_checkpoints
Definition race.qh:3

References autocvar_g_allow_checkpoints, entity(), M_ARGV, and race_PreparePlayer().

◆ MUTATOR_HOOKFUNCTION() [2/19]

MUTATOR_HOOKFUNCTION ( rc ,
CheckRules_World  )

Definition at line 367 of file sv_race.qc.

368{
369 float checkrules_timelimit = M_ARGV(1, float);
370 float checkrules_fraglimit = M_ARGV(2, float);
371
372 if(checkrules_timelimit >= 0)
373 {
375 {
376 M_ARGV(0, float) = WinningCondition_Race(checkrules_fraglimit);
377 return true;
378 }
379 else if(g_race_qualifying == 2)
380 {
381 M_ARGV(0, float) = WinningCondition_QualifyingThenRace(checkrules_fraglimit);
382 return true;
383 }
384 }
385}
int g_race_qualifying
Definition race.qh:13
float WinningCondition_QualifyingThenRace(float limit)
Definition sv_race.qc:101
float WinningCondition_Race(float fraglimit)
Definition sv_race.qc:77

References CheckRules_World(), g_race_qualifying, M_ARGV, WinningCondition_QualifyingThenRace(), and WinningCondition_Race().

◆ MUTATOR_HOOKFUNCTION() [3/19]

MUTATOR_HOOKFUNCTION ( rc ,
ClientConnect  )

Definition at line 230 of file sv_race.qc.

231{
232 entity player = M_ARGV(0, entity);
233
234 race_PreparePlayer(player);
235 player.race_checkpoint = -1;
236
237 race_SendAll(player, false);
238}
void race_SendAll(entity player, bool only_rankings)
Definition race.qc:333

References ClientConnect, entity(), M_ARGV, race_PreparePlayer(), and race_SendAll().

◆ MUTATOR_HOOKFUNCTION() [4/19]

MUTATOR_HOOKFUNCTION ( rc ,
ClientKill  )

Definition at line 115 of file sv_race.qc.

116{
118 M_ARGV(1, float) = 0; // killtime
119}

References ClientKill, g_race_qualifying, and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [5/19]

MUTATOR_HOOKFUNCTION ( rc ,
FixClientCvars  )

Definition at line 360 of file sv_race.qc.

361{
362 entity player = M_ARGV(0, entity);
363
364 stuffcmd(player, "cl_cmd settemp cl_movecliptokeyboard 2\n");
365}
#define stuffcmd(cl,...)
Definition progsdefs.qh:23

References entity(), FixClientCvars(), M_ARGV, and stuffcmd.

◆ MUTATOR_HOOKFUNCTION() [6/19]

MUTATOR_HOOKFUNCTION ( rc ,
ForbidPlayerScore_Clear  )

Definition at line 319 of file sv_race.qc.

320{
322 return true; // in qualifying, you don't lose score by observing
323}

References g_race_qualifying.

◆ MUTATOR_HOOKFUNCTION() [7/19]

MUTATOR_HOOKFUNCTION ( rc ,
GetPressedKeys  )

Definition at line 311 of file sv_race.qc.

312{
313 entity player = M_ARGV(0, entity);
314
316 race_SpeedAwardFrame(player);
317}
void race_SpeedAwardFrame(entity player)
Definition race.qc:305
void race_checkAndWriteName(entity player)
Definition race.qc:134

References entity(), GetPressedKeys(), M_ARGV, race_checkAndWriteName(), and race_SpeedAwardFrame().

◆ MUTATOR_HOOKFUNCTION() [8/19]

MUTATOR_HOOKFUNCTION ( rc ,
GetRecords  )

Definition at line 338 of file sv_race.qc.

339{
340 int record_page = M_ARGV(0, int);
341 string ret_string = M_ARGV(1, string);
342
343 for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
344 {
345 if(MapInfo_Get_ByID(i))
346 {
348
349 if(!r)
350 continue;
351
352 string h = race_readName(MapInfo_Map_bspname, 1);
353 ret_string = strcat(ret_string, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r, false)), " ", h, "\n");
354 }
355 }
356
357 M_ARGV(1, string) = ret_string;
358}
#define TIME_ENCODED_TOSTRING(n, compact)
Definition util.qh:96
bool MapInfo_Get_ByID(int i)
Definition mapinfo.qc:275
float MapInfo_count
Definition mapinfo.qh:166
string MapInfo_Map_bspname
Definition mapinfo.qh:6
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
float race_readTime(string map, float pos)
Definition race.qc:69
string race_readName(string map, float pos)
Definition race.qc:129

References M_ARGV, MapInfo_count, MapInfo_Get_ByID(), MapInfo_Map_bspname, race_readName(), race_readTime(), strcat(), and TIME_ENCODED_TOSTRING.

◆ MUTATOR_HOOKFUNCTION() [9/19]

MUTATOR_HOOKFUNCTION ( rc ,
HavocBot_ChooseRole  )

Definition at line 303 of file sv_race.qc.

304{
305 entity bot = M_ARGV(0, entity);
306
307 bot.havocbot_role = havocbot_role_race;
308 return true;
309}
void havocbot_role_race(entity this)
Definition sv_race.qc:18

References entity(), havocbot_role_race(), and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [10/19]

MUTATOR_HOOKFUNCTION ( rc ,
MakePlayerObserver  )

Definition at line 240 of file sv_race.qc.

241{
242 entity player = M_ARGV(0, entity);
243
245 {
246 if(GameRules_scoring_add(player, RACE_FASTEST, 0))
247 player.frags = FRAGS_PLAYER_OUT_OF_GAME;
248 else
249 player.frags = FRAGS_SPECTATOR;
250 }
251
252 race_PreparePlayer(player);
253 player.race_checkpoint = -1;
254}
const int FRAGS_PLAYER_OUT_OF_GAME
Definition constants.qh:5
const int FRAGS_SPECTATOR
Definition constants.qh:4
#define GameRules_scoring_add(client, fld, value)
Definition sv_rules.qh:85

References entity(), FRAGS_PLAYER_OUT_OF_GAME, FRAGS_SPECTATOR, g_race_qualifying, GameRules_scoring_add, M_ARGV, and race_PreparePlayer().

◆ MUTATOR_HOOKFUNCTION() [11/19]

MUTATOR_HOOKFUNCTION ( rc ,
PlayerDamaged  )

Definition at line 288 of file sv_race.qc.

289{
290 int frag_deathtype = M_ARGV(5, int);
291 if (frag_deathtype == DEATH_KILL.m_id)
292 return true; // forbid logging damage
293}

References M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [12/19]

MUTATOR_HOOKFUNCTION ( rc ,
PlayerDies  )

Definition at line 295 of file sv_race.qc.

296{
298
299 frag_target.respawn_flags |= RESPAWN_FORCE;
301}
const int RESPAWN_FORCE
Definition client.qh:326
void race_AbandonRaceCheck(entity p)
Definition race.qc:1229
entity frag_target
Definition sv_ctf.qc:2321

References entity(), frag_target, M_ARGV, race_AbandonRaceCheck(), and RESPAWN_FORCE.

◆ MUTATOR_HOOKFUNCTION() [13/19]

MUTATOR_HOOKFUNCTION ( rc ,
PlayerPhysics  )

Definition at line 129 of file sv_race.qc.

130{
131 entity player = M_ARGV(0, entity);
132 float dt = M_ARGV(1, float);
133
134 player.race_movetime_frac += dt;
135 float f = floor(player.race_movetime_frac);
136 player.race_movetime_frac -= f;
137 player.race_movetime_count += f;
138 player.race_movetime = player.race_movetime_frac + player.race_movetime_count;
139
140 if(IS_PLAYER(player))
141 {
142 if (player.race_penalty)
143 if (time > player.race_penalty)
144 player.race_penalty = 0;
145 if(player.race_penalty)
146 {
147 player.velocity = '0 0 0';
149 player.disableclientprediction = 2;
150 }
151 }
152
153 // force kbd movement for fairness
154 float wishspeed;
155 vector wishvel;
156
157 // if record times matter
158 // ensure nothing EVIL is being done (i.e. div0_evade)
159 // this hinders joystick users though
160 // but it still gives SOME analog control
161 wishvel.x = fabs(CS(player).movement.x);
162 wishvel.y = fabs(CS(player).movement.y);
163 if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
164 {
165 wishvel.z = 0;
166 wishspeed = vlen(wishvel);
167 if(wishvel.x >= 2 * wishvel.y)
168 {
169 // pure X motion
170 if(CS(player).movement.x > 0)
171 CS(player).movement_x = wishspeed;
172 else
173 CS(player).movement_x = -wishspeed;
174 CS(player).movement_y = 0;
175 }
176 else if(wishvel.y >= 2 * wishvel.x)
177 {
178 // pure Y motion
179 CS(player).movement_x = 0;
180 if(CS(player).movement.y > 0)
181 CS(player).movement_y = wishspeed;
182 else
183 CS(player).movement_y = -wishspeed;
184 }
185 else
186 {
187 // diagonal
188 if(CS(player).movement.x > 0)
189 CS(player).movement_x = M_SQRT1_2 * wishspeed;
190 else
191 CS(player).movement_x = -M_SQRT1_2 * wishspeed;
192 if(CS(player).movement.y > 0)
193 CS(player).movement_y = M_SQRT1_2 * wishspeed;
194 else
195 CS(player).movement_y = -M_SQRT1_2 * wishspeed;
196 }
197 }
198}
vector movement
Definition player.qh:229
#define IS_PLAYER(s)
Definition player.qh:243
float time
const float M_SQRT1_2
Definition mathlib.qh:115
float vlen(vector v)
float fabs(float f)
float floor(float f)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_NONE
Definition movetypes.qh:129
vector
Definition self.qh:92
ClientState CS(Client this)
Definition state.qh:47

References CS(), entity(), fabs(), floor(), IS_PLAYER, M_ARGV, M_SQRT1_2, movement, MOVETYPE_NONE, set_movetype(), time, vector, and vlen().

◆ MUTATOR_HOOKFUNCTION() [14/19]

MUTATOR_HOOKFUNCTION ( rc ,
PlayerSpawn  )

Definition at line 256 of file sv_race.qc.

257{
258 entity player = M_ARGV(0, entity);
259 entity spawn_spot = M_ARGV(1, entity);
260
261 if(spawn_spot.target == "")
262 // Emergency: this wasn't a real spawnpoint. Can this ever happen?
263 race_PreparePlayer(player);
264
265 // if we need to respawn, do it right
266 player.race_respawn_checkpoint = player.race_checkpoint;
267 player.race_respawn_spotref = spawn_spot;
268
269 player.race_place = 0;
270}

References entity(), M_ARGV, and race_PreparePlayer().

◆ MUTATOR_HOOKFUNCTION() [15/19]

MUTATOR_HOOKFUNCTION ( rc ,
PutClientInServer  )

Definition at line 272 of file sv_race.qc.

273{
274 entity player = M_ARGV(0, entity);
275
276 if(IS_PLAYER(player))
277 if(!game_stopped)
278 {
279 if(CS(player).killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
280 race_PreparePlayer(player);
281 else // respawn
282 race_RetractPlayer(player);
283
284 race_AbandonRaceCheck(player);
285 }
286}
float game_stopped
Definition stats.qh:81
int killcount
Definition client.qh:315
void race_RetractPlayer(entity this)
Definition race.qc:1255

References CS(), entity(), FRAGS_SPECTATOR, g_race_qualifying, game_stopped, IS_PLAYER, killcount, M_ARGV, PutClientInServer, race_AbandonRaceCheck(), race_PreparePlayer(), and race_RetractPlayer().

◆ MUTATOR_HOOKFUNCTION() [16/19]

MUTATOR_HOOKFUNCTION ( rc ,
ReadLevelCvars  )

Definition at line 387 of file sv_race.qc.

388{
389 if(g_race_qualifying == 2)
390 warmup_stage = 0;
391}
bool warmup_stage
Definition main.qh:120

References g_race_qualifying, and warmup_stage.

◆ MUTATOR_HOOKFUNCTION() [17/19]

MUTATOR_HOOKFUNCTION ( rc ,
reset_map_global  )

Definition at line 200 of file sv_race.qc.

201{
202 float s;
203
205
207 PlayerScore_Sort(race_place, 0, true, false);
208
209 FOREACH_CLIENT(true, {
210 if(it.race_place)
211 {
212 s = GameRules_scoring_add(it, RACE_FASTEST, 0);
213 if(!s)
214 it.race_place = 0;
215 }
216 race_EventLog(ftos(it.race_place), it);
217 });
218
219 if(g_race_qualifying == 2)
220 {
223 cvar_set("fraglimit", ftos(race_fraglimit));
224 cvar_set("leadlimit", ftos(race_leadlimit));
225 cvar_set("timelimit", ftos(race_timelimit));
227 }
228}
void cvar_set(string name, string value)
string ftos(float f)
#define NULL
Definition post.qh:14
void Score_NicePrint(entity to)
Prints the scores to the console of a player.
Definition scores.qc:917
entity PlayerScore_Sort(.float field, int teams, bool strict, bool nospectators)
Sorts the players and stores their place in the given field, starting with.
Definition scores.qc:748
bool independent_players
Definition client.qh:310
void race_ClearRecords()
Definition race.qc:1285
float race_timelimit
Definition race.qh:23
float race_place
Definition race.qh:24
float race_fraglimit
Definition race.qh:21
float race_leadlimit
Definition race.qh:22
void race_EventLog(string mode, entity actor)
Definition sv_race.qc:71
void race_ScoreRules()
Definition sv_race.qc:54
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50

References cvar_set(), FOREACH_CLIENT, ftos(), g_race_qualifying, GameRules_scoring_add, independent_players, NULL, PlayerScore_Sort(), race_ClearRecords(), race_EventLog(), race_fraglimit, race_leadlimit, race_place, race_ScoreRules(), race_timelimit, and Score_NicePrint().

◆ MUTATOR_HOOKFUNCTION() [18/19]

MUTATOR_HOOKFUNCTION ( rc ,
Scores_CountFragsRemaining  )

Definition at line 331 of file sv_race.qc.

332{
333 // announce remaining frags if not in qualifying mode
335 return true;
336}

References g_race_qualifying.

◆ MUTATOR_HOOKFUNCTION() [19/19]

MUTATOR_HOOKFUNCTION ( rc ,
TeamBalance_CheckAllowedTeams ,
CBC_ORDER_EXCLUSIVE  )

Definition at line 325 of file sv_race.qc.

326{
327 M_ARGV(0, float) = race_teams;
328 return true;
329}
float race_teams
Definition race.qh:5

References CBC_ORDER_EXCLUSIVE, M_ARGV, race_teams, and TeamBalance_CheckAllowedTeams().

◆ race_EventLog()

void race_EventLog ( string mode,
entity actor )

Definition at line 71 of file sv_race.qc.

72{
74 GameLogEcho(strcat(":race:", mode, ":", ((actor != NULL) ? (strcat(":", ftos(actor.playerid))) : "")));
75}
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog
Definition gamelog.qh:3

References autocvar_sv_eventlog, entity(), ftos(), GameLogEcho(), NULL, and strcat().

Referenced by MUTATOR_HOOKFUNCTION().

◆ race_Initialize()

void race_Initialize ( )

Definition at line 393 of file sv_race.qc.

394{
396 if(g_race_qualifying == 2)
397 warmup_stage = 0;
398 radar_showenemies = true;
399}
bool radar_showenemies
Definition ent_cs.qh:50

References g_race_qualifying, race_ScoreRules(), radar_showenemies, and warmup_stage.

Referenced by REGISTER_MUTATOR().

◆ race_ScoreRules()

void race_ScoreRules ( )

Definition at line 54 of file sv_race.qc.

55{
58 if (race_teams)
59 field_team(ST_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
60 else if (g_race_qualifying)
61 field(SP_RACE_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
63 {
64 field(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
65 field(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
66 field(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
67 }
68 });
69}
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
Definition scores.qh:102
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_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit) NOTE: SFL_SORT_PRIO_SECONDARY value must be lo...
Definition scores.qh:133
const int SFL_SORT_PRIO_PRIMARY
Definition scores.qh:134
const float ST_RACE_LAPS
Definition race.qh:8
#define GameRules_score_enabled(value)
Definition sv_rules.qh:41
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition sv_rules.qh:58

References g_race_qualifying, GameRules_score_enabled, GameRules_scoring, race_teams, SFL_LOWER_IS_BETTER, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, SFL_TIME, and ST_RACE_LAPS.

Referenced by MUTATOR_HOOKFUNCTION(), and race_Initialize().

◆ rc_SetLimits()

void rc_SetLimits ( )

Definition at line 401 of file sv_race.qc.

402{
403 int fraglimit_override, leadlimit_override;
404 float timelimit_override, qualifying_override;
405
407 {
408 GameRules_teams(true);
410 }
411 else
412 race_teams = 0;
413
415 fraglimit_override = autocvar_g_race_laps_limit;
416 leadlimit_override = 0; // currently not supported by race
417 timelimit_override = autocvar_timelimit_override;
418
419 float want_qualifying = ((qualifying_override >= 0) ? qualifying_override : autocvar_g_race_qualifying_timelimit) > 0;
420
422
424 {
427 }
428 else if(want_qualifying)
429 {
432 race_fraglimit = (fraglimit_override >= 0) ? fraglimit_override : autocvar_fraglimit;
433 race_leadlimit = (leadlimit_override >= 0) ? leadlimit_override : autocvar_leadlimit;
434 race_timelimit = (timelimit_override >= 0) ? timelimit_override : autocvar_timelimit;
435 qualifying_override = (qualifying_override >= 0) ? qualifying_override : autocvar_g_race_qualifying_timelimit;
436 fraglimit_override = 0;
437 leadlimit_override = 0;
438 timelimit_override = qualifying_override;
439 }
440 else
442 GameRules_limit_score(fraglimit_override);
443 GameRules_limit_lead(leadlimit_override);
444 GameRules_limit_time(timelimit_override);
445 GameRules_limit_time_qualifying(qualifying_override);
446}
#define BITS(n)
Definition bits.qh:9
#define autocvar_timelimit_override
Definition stats.qh:93
#define autocvar_timelimit
Definition stats.qh:92
#define autocvar_fraglimit
Definition stats.qh:90
int autocvar_leadlimit
Definition stats.qh:84
#define RACE_RECORD
Definition util.qh:97
bool autocvar_g_campaign
Definition menu.qc:747
float bound(float min, float value, float max)
float autocvar_g_race_qualifying_timelimit
Definition sv_race.qc:12
#define autocvar_g_race_laps_limit
Definition sv_race.qc:11
float autocvar_g_race_qualifying_timelimit_override
Definition sv_race.qc:13
int autocvar_g_race_teams
Definition sv_race.qc:14
void GameRules_limit_score(int limit)
Definition sv_rules.qc:23
void GameRules_teams(bool value)
Definition sv_rules.qc:3
void GameRules_limit_time_qualifying(int limit)
Definition sv_rules.qc:53
void GameRules_limit_lead(int limit)
Definition sv_rules.qc:33
void GameRules_limit_time(int limit)
Definition sv_rules.qc:43
string record_type
Definition world.qh:55

References autocvar_fraglimit, autocvar_g_campaign, autocvar_g_race_laps_limit, autocvar_g_race_qualifying_timelimit, autocvar_g_race_qualifying_timelimit_override, autocvar_g_race_teams, autocvar_leadlimit, autocvar_timelimit, autocvar_timelimit_override, BITS, bound(), g_race_qualifying, GameRules_limit_lead(), GameRules_limit_score(), GameRules_limit_time(), GameRules_limit_time_qualifying(), GameRules_teams(), independent_players, race_fraglimit, race_leadlimit, RACE_RECORD, race_teams, race_timelimit, and record_type.

Referenced by REGISTER_MUTATOR().

◆ WinningCondition_QualifyingThenRace()

float WinningCondition_QualifyingThenRace ( float limit)

Definition at line 101 of file sv_race.qc.

102{
103 float wc;
104 wc = WinningCondition_Scores(limit, 0);
105
106 // NEVER initiate overtime
108 {
109 return WINNING_YES;
110 }
111
112 return wc;
113}
float WinningCondition_Scores(float limit, float leadlimit)
Definition world.qc:1540
const int WINNING_STARTSUDDENDEATHOVERTIME
Definition world.qh:135
const int WINNING_YES
Definition world.qh:133

References WINNING_STARTSUDDENDEATHOVERTIME, WINNING_YES, and WinningCondition_Scores().

Referenced by MUTATOR_HOOKFUNCTION().

◆ WinningCondition_Race()

float WinningCondition_Race ( float fraglimit)

Definition at line 77 of file sv_race.qc.

78{
79 float wc;
80 float n, c;
81
82 n = 0;
83 c = 0;
85 ++n;
86 if(CS(it).race_completed)
87 ++c;
88 });
89 if(n && (n == c))
90 return WINNING_YES;
91 wc = WinningCondition_Scores(fraglimit, 0);
92
93 // ALWAYS initiate overtime, unless EVERYONE has finished the race!
95 // do NOT support equality when the laps are all raced!
97 else
98 return WINNING_NEVER;
99}
float race_completed
Definition race.qh:26
const int WINNING_NEVER
Definition world.qh:134

References CS(), FOREACH_CLIENT, IS_PLAYER, race_completed, WINNING_NEVER, WINNING_STARTSUDDENDEATHOVERTIME, WINNING_YES, and WinningCondition_Scores().

Referenced by MUTATOR_HOOKFUNCTION().

Variable Documentation

◆ autocvar_g_race_qualifying_timelimit

float autocvar_g_race_qualifying_timelimit

Definition at line 12 of file sv_race.qc.

Referenced by rc_SetLimits().

◆ autocvar_g_race_qualifying_timelimit_override

float autocvar_g_race_qualifying_timelimit_override

Definition at line 13 of file sv_race.qc.

Referenced by rc_SetLimits().

◆ autocvar_g_race_teams

int autocvar_g_race_teams

Definition at line 14 of file sv_race.qc.

Referenced by rc_SetLimits().

◆ race_checkpoint

float race_checkpoint

Definition at line 17 of file sv_race.qc.