From 10a930300d15ee6948cb8f13c78742e9b517775f Mon Sep 17 00:00:00 2001 From: Morosophos Date: Tue, 10 Sep 2019 17:10:37 +0300 Subject: [PATCH] Enhance record markers inserted into demo files Add player's crypto_idfp Write markers for all records, not just the 1st places --- qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc | 2 +- qcsrc/server/miscfunctions.qc | 19 +++++++++++-------- qcsrc/server/miscfunctions.qh | 2 +- qcsrc/server/race.qc | 4 ++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index 03b2ec9d1d..2799ba1a85 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -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) diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 4cc848b673..a303844613 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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) diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index 2374b4869b..cb9d4dd271 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -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); diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 9a12a04866..6e2d4a68e0 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -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); } -- 2.39.5