From: Mario Date: Wed, 3 Feb 2021 23:25:25 +0000 (+1000) Subject: Revert "Record player race move time in PlayerPreThink so it can be recorded while... X-Git-Tag: xonotic-v0.8.5~577 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d10d9806f97cfa0ebcdae72a5705abbdf9a2def5;p=xonotic%2Fxonotic-data.pk3dir.git Revert "Record player race move time in PlayerPreThink so it can be recorded while inside a vehicle, fixes #2263" This reverts commit cd9380e44806612f8eb2d04f27ca283ae8f0a461. --- diff --git a/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc b/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc index 7c83260d0..144788917 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc +++ b/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc @@ -71,26 +71,16 @@ void cts_EventLog(string mode, entity actor) // use an alias for easy changing a GameLogEcho(strcat(":cts:", mode, ":", ((actor != NULL) ? (strcat(":", ftos(actor.playerid))) : ""))); } -MUTATOR_HOOKFUNCTION(cts, PlayerPreThink) +MUTATOR_HOOKFUNCTION(cts, PlayerPhysics) { 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)) { diff --git a/qcsrc/common/gamemodes/gamemode/race/sv_race.qc b/qcsrc/common/gamemodes/gamemode/race/sv_race.qc index c87384c94..a69a43522 100644 --- a/qcsrc/common/gamemodes/gamemode/race/sv_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/sv_race.qc @@ -128,26 +128,16 @@ MUTATOR_HOOKFUNCTION(rc, AbortSpeedrun) race_PreparePlayer(player); // nice try } -MUTATOR_HOOKFUNCTION(rc, PlayerPreThink) +MUTATOR_HOOKFUNCTION(rc, PlayerPhysics) { 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)) diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 4e166214c..70a98083e 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -424,6 +424,8 @@ void race_deleteTime(string map, float pos) void race_SendTime(entity e, float cp, float t, float tvalid) { + float snew, l; + if(g_race_qualifying) t += e.race_penalty_accumulator; @@ -447,9 +449,9 @@ void race_SendTime(entity e, float cp, float t, float tvalid) GameRules_scoring_add(e, RACE_FASTEST, t - s); s = GameRules_scoring_add(e, RACE_TIME, 0); - float snew = TIME_ENCODE(time - game_starttime); + snew = TIME_ENCODE(time - game_starttime); GameRules_scoring_add(e, RACE_TIME, snew - s); - float l = GameRules_scoring_add_team(e, RACE_LAPS, 1); + l = GameRules_scoring_add_team(e, RACE_LAPS, 1); if(autocvar_fraglimit) if(l >= autocvar_fraglimit)