GameLogEcho(strcat(":cts:", mode, ":", ((actor != NULL) ? (strcat(":", ftos(actor.playerid))) : "")));
}
-MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
+MUTATOR_HOOKFUNCTION(cts, PlayerPreThink)
{
entity player = M_ARGV(0, entity);
- float dt = M_ARGV(1, float);
+ if(!IS_PLAYER(player))
+ return;
+
+ // we need to perform this in PlayerPreThink as PlayerPhysics may not be called (vehicle support)
+ float dt = frametime;
player.race_movetime_frac += dt;
float f = floor(player.race_movetime_frac);
player.race_movetime_frac -= f;
player.race_movetime_count += f;
player.race_movetime = player.race_movetime_frac + player.race_movetime_count;
+}
+
+MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
+{
+ entity player = M_ARGV(0, entity);
+ //float dt = M_ARGV(1, float);
if(IS_PLAYER(player))
{
race_PreparePlayer(player); // nice try
}
-MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
+MUTATOR_HOOKFUNCTION(rc, PlayerPreThink)
{
entity player = M_ARGV(0, entity);
- float dt = M_ARGV(1, float);
+ if(!IS_PLAYER(player))
+ return;
+
+ // we need to perform this in PlayerPreThink as PlayerPhysics may not be called (vehicle support)
+ float dt = frametime;
player.race_movetime_frac += dt;
float f = floor(player.race_movetime_frac);
player.race_movetime_frac -= f;
player.race_movetime_count += f;
player.race_movetime = player.race_movetime_frac + player.race_movetime_count;
+}
+
+MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
+{
+ entity player = M_ARGV(0, entity);
+ //float dt = M_ARGV(1, float);
#ifdef SVQC
if(IS_PLAYER(player))
void race_SendTime(entity e, float cp, float t, float tvalid)
{
- float snew, l;
-
if(g_race_qualifying)
t += e.race_penalty_accumulator;
GameRules_scoring_add(e, RACE_FASTEST, t - s);
s = GameRules_scoring_add(e, RACE_TIME, 0);
- snew = TIME_ENCODE(time - game_starttime);
+ float snew = TIME_ENCODE(time - game_starttime);
GameRules_scoring_add(e, RACE_TIME, snew - s);
- l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
+ float l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
if(autocvar_fraglimit)
if(l >= autocvar_fraglimit)