]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Enhance record markers inserted into demo files
authorMorosophos <morosophos@teichisma.info>
Tue, 10 Sep 2019 14:10:37 +0000 (17:10 +0300)
committerMorosophos <morosophos@teichisma.info>
Tue, 10 Sep 2019 14:10:37 +0000 (17:10 +0300)
Add player's crypto_idfp
Write markers for all records, not just the 1st places

qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/race.qc

index 03b2ec9d1d428a3c7dfce3b0d3cbcb2d5fe05bd1..2799ba1a85cc57f1995350fa04c4581df295a875 100644 (file)
@@ -118,7 +118,7 @@ void ctf_CaptureRecord(entity flag, entity player)
                ctf_captimerecord = cap_time;
                db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(cap_time));
                db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), player.netname);
-               write_recordmarker(player, flag.ctf_pickuptime, cap_time);
+               write_recordmarker(player, 1, flag.ctf_pickuptime, cap_time);
        }
 
        if(autocvar_g_ctf_leaderboard && !ctf_oneflag)
index 4cc848b67342e53181701fe6b06f1463d9319db3..a3038446137fb7e20e663f054bfbed9427535ceb 100644 (file)
@@ -1392,15 +1392,18 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
        return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance);
 }
 
-void write_recordmarker(entity pl, float tstart, float dt)
+void write_recordmarker(entity pl, float newpos, float tstart, float dt)
 {
-    GameLogEcho(strcat(":recordset:", ftos(pl.playerid), ":", ftos(dt)));
-
-    // also write a marker into demo files for demotc-race-record-extractor to find
-    stuffcmd(pl,
-             strcat(
-                 strcat("//", strconv(2, 0, 0, GetGametype()), " RECORD SET ", TIME_ENCODED_TOSTRING(TIME_ENCODE(dt))),
-                 " ", ftos(tstart), " ", ftos(dt), "\n"));
+    GameLogEcho(strcat(":recordset:", ":", ftos(pl.playerid), ":", ftos(dt)));
+
+    if (pl.crypto_idfp != "") {
+      // also write a marker into demo files for demotc-race-record-extractor to find
+      stuffcmd(pl,
+               strcat(
+                   strcat("//", strconv(2, 0, 0, GetGametype()), " RECORD SET ", TIME_ENCODED_TOSTRING(TIME_ENCODE(dt))),
+                   strcat(" ", ftos(tstart), " ", ftos(dt), " ", ftos(newpos), " "),
+                   strcat(pl.crypto_idfp, "\n")));
+      }
 }
 
 void attach_sameorigin(entity e, entity to, string tag)
index 2374b4869bc6c5415c08c319a162850ca9871440..cb9d4dd27173ca157e26d1dce777927e9c9aa76e 100644 (file)
@@ -34,7 +34,7 @@ float cvar_normal(string n)
 entity eliminatedPlayers;
 void EliminatedPlayers_Init(float(entity) isEliminated_func);
 
-void write_recordmarker(entity pl, float tstart, float dt);
+void write_recordmarker(entity pl, float newpos, float tstart, float dt);
 
 void play2all(string samp);
 
index 9a12a04866c2c251fdd333725f0a22c4af757fff..6e2d4a68e00b4cf0c70d29810cab755121f37667 100644 (file)
@@ -324,9 +324,9 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e,
        // store new ranking
        race_writeTime(GetMapname(), t, myuid);
 
-       if (newpos == 1 && showmessage)
+       if (showmessage)
        {
-               write_recordmarker(e, time - TIME_DECODE(t), TIME_DECODE(t));
+                write_recordmarker(e, newpos, time - TIME_DECODE(t), TIME_DECODE(t));
                race_send_recordtime(MSG_ALL);
        }