]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Revert "Record player race move time in PlayerPreThink so it can be recorded while...
authorMario <mario.mario@y7mail.com>
Wed, 3 Feb 2021 23:25:25 +0000 (09:25 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 3 Feb 2021 23:25:44 +0000 (09:25 +1000)
This reverts commit cd9380e44806612f8eb2d04f27ca283ae8f0a461.

qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc
qcsrc/common/gamemodes/gamemode/race/sv_race.qc
qcsrc/server/race.qc

index 7c83260d005376c01f72644c750369b08202e35b..144788917415c2557d8fd5f5da7a81e3d803fb7b 100644 (file)
@@ -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))
        {
index c87384c94bc3377c45f27fa6d7ac422585c6657f..a69a435227785f7172f65558155049abaddbbc4e 100644 (file)
@@ -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))
index 4e166214ca29ad0fa40a794b727dbd9c027b5144..70a98083efb22a03171f78a0adae0fe623c189ac 100644 (file)
@@ -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)