#include <common/mutators/mutator/waypoints/waypointsprites.qh>
#include <common/net_linked.qh>
#include <common/notifications/all.qh>
+#include <common/playerstats.qh>
#include <common/state.qh>
#include <common/stats.qh>
#include <common/vehicles/sv_vehicles.qh>
void race_SendTime(entity e, float cp, float t, float tvalid)
{
- float snew, l;
-
if(g_race_qualifying)
t += e.race_penalty_accumulator;
if(cp == race_timed_checkpoint) // finish line
if (!CS(e).race_completed)
{
- float s;
- if(g_race_qualifying)
- {
- s = GameRules_scoring_add(e, RACE_FASTEST, 0);
- if(!s || t < s)
- GameRules_scoring_add(e, RACE_FASTEST, t - s);
- }
- else
+ int s = GameRules_scoring_add(e, RACE_FASTEST, 0);
+ if(!s || t < s)
+ GameRules_scoring_add(e, RACE_FASTEST, t - s);
+ if(!g_race_qualifying)
{
- s = GameRules_scoring_add(e, RACE_FASTEST, 0);
- if(!s || t < s)
- GameRules_scoring_add(e, RACE_FASTEST, t - s);
-
s = GameRules_scoring_add(e, RACE_TIME, 0);
- snew = TIME_ENCODE(time - game_starttime);
+ int snew = TIME_ENCODE(time - game_starttime);
GameRules_scoring_add(e, RACE_TIME, snew - s);
- l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
+ int l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
if(autocvar_fraglimit)
if(l >= autocvar_fraglimit)
void defrag_waypointsprites(entity targeted, entity checkpoint)
{
- for(entity t = findchain(target, targeted.targetname); t; t = t.chain)
- {
- if(t.modelindex)
- {
- entity s = WP_RaceStart;
-
- if(checkpoint.classname == "target_checkpoint")
- s = WP_RaceCheckpoint;
- else if(checkpoint.classname == "target_stopTimer")
- s = WP_RaceFinish;
+ // bones_was_here: spawn a waypoint for every entity with a bmodel
+ // that directly or indirectly targets this checkpoint
+ // (anything a player could touch or shoot to activate this cp)
- vector o = (t.absmin + t.absmax) * 0.5;
-
- WaypointSprite_SpawnFixed(s, o, t, sprite, RADARICON_NONE);
+ entity s = WP_RaceCheckpoint;
+ if (checkpoint.classname == "target_startTimer")
+ s = WP_RaceStart;
+ else if (checkpoint.classname == "target_stopTimer")
+ s = WP_RaceFinish;
+ for (entity t = findchain(target, targeted.targetname); t; t = t.chain)
+ {
+ if (t.modelindex)
+ {
+ WaypointSprite_SpawnFixed(s, (t.absmin + t.absmax) * 0.5, t, sprite, RADARICON_NONE);
t.sprite.realowner = checkpoint;
t.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player;
}
- if(t.targetname)
+ if (t.targetname)
defrag_waypointsprites(t, checkpoint);
}
}
if (have_verified) return;
have_verified = true;
- bool qual = g_race_qualifying;
+ int qual = g_race_qualifying;
int pl_race_checkpoint = 0;
int pl_race_place = 0;
pl_race_checkpoint = race_NextCheckpoint(i);
// race only (middle of the race)
- g_race_qualifying = false;
+ g_race_qualifying = 0;
pl_race_place = 0;
if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false, true)) {
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for respawning in race) - bailing out"));