]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/morosophos/enhance-demo-record-markers' into...
authorNick S <nick@teichisma.info>
Thu, 27 Jan 2022 15:51:23 +0000 (17:51 +0200)
committerNick S <nick@teichisma.info>
Thu, 27 Jan 2022 15:51:23 +0000 (17:51 +0200)
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/server/race.qc
qcsrc/server/race.qh

index 670b00fa42c0a2b56877c395efa355b535b88259..3a739a293fc14fff1ddffd795d7142db5a3261e8 100644 (file)
@@ -131,7 +131,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 9281d2d6e24795b57760cc4fd2821949d9367992..75d009a40da1fb2bef98d8f0290f5bd44133f768 100644 (file)
@@ -53,15 +53,23 @@ string uid2name(string myuid)
        return s;
 }
 
-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)));
+    GameLogEcho(strcat(":recordset:", ftos(newpos), ":", ftos(pl.playerid), ":", ftos(etof(pl)), ":", 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"));
+    if (pl.crypto_idfp != "") {
+      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")));
+    } else {
+      stuffcmd(pl,
+               strcat(
+                   strcat("//", strconv(2, 0, 0, GetGametype()), " RECORD SET ", TIME_ENCODED_TOSTRING(TIME_ENCODE(dt))),
+                   strcat(" ", ftos(tstart), " ", ftos(dt), " ", ftos(newpos), " ANONYMOUS")));
+    }
 }
 
 IntrusiveList g_race_targets;
@@ -401,6 +409,8 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e,
                return;
        }
 
+        write_recordmarker(e, newpos, time - TIME_DECODE(t), TIME_DECODE(t));
+
        // if we didn't hit a return yet, we have a new record!
 
        // if the player does not have a UID we can unfortunately not store the record, as the rankings system relies on UIDs
@@ -424,9 +434,8 @@ 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));
                race_send_recordtime(MSG_ALL);
        }
 
index ee792a4f9d3e68bf8ddb4fa55bf0760d113d86ae..537082da7b283ae61ecfff8011864f18fbaba858 100644 (file)
@@ -35,7 +35,7 @@ float race_completing;
 .entity race_respawn_spotref; // try THIS spawn in case you respawn
 
 // definitions for functions used outside race.qc
-void write_recordmarker(entity pl, float tstart, float dt);
+void write_recordmarker(entity pl, float newpos, float tstart, float dt);
 
 float race_PreviousCheckpoint(float f);
 float race_NextCheckpoint(float f);