#include "racetimer.qh"
#include <client/draw.qh>
+#include <common/ent_cs.qh>
// Race timer (#8)
s = MakeRaceString(race_checkpoint, 0, -1, 0, 0, race_previousbestname);
if(race_time)
forcetime = TIME_ENCODED_TOSTRING(race_time, false);
+
+ // store checkpoint splits string for later printing
+ // check if we advanced to next cp
+ if (!entcs_IsSpectating(player_localnum) && race_checkpoint_splits_previous != race_checkpoint)
+ {
+ // are we somehow overwriting something? how?
+ if (race_checkpoint_splits[race_checkpoint_splits_previous+1])
+ {
+ LOG_WARNF("race_checkpoint_splits: overwriting #%f %s\n",
+ race_checkpoint_splits_previous+1,
+ race_checkpoint_splits[race_checkpoint_splits_previous+1]);
+ strfree(race_checkpoint_splits[race_checkpoint_splits_previous+1]);
+ }
+
+ strcpy(race_checkpoint_splits[race_checkpoint_splits_previous+1], sprintf("%s %s", forcetime, s));
+
+ // don't use ++ in case that checkpoints have jumps like 10th to 20th
+ race_checkpoint_splits_previous = race_checkpoint;
+ }
}
}
else
float race_time;
float race_laptime;
float race_checkpointtime;
+string race_checkpoint_splits[255];
+int race_checkpoint_splits_previous = 0;
float race_previousbesttime;
float race_mypreviousbesttime;
string race_previousbestname;
race_penaltyaccumulator = 0;
race_laptime = time; // valid
}
+
+ // show checkpoint splits after a run
+ // specs can switch players for confusing splits, deny service
+ // if hit 255 finish line or if finish line is 0 or if restarted
+ if (!entcs_IsSpectating(player_localnum)
+ && (race_checkpoint == 255
+ || race_checkpoint < race_checkpoint_splits_previous))
+ {
+ LOG_HELP("Checkpoint Splits:\n");
+ for (int i = 0; i < 255; ++i)
+ {
+ // does this index have a split?
+ if (race_checkpoint_splits[i])
+ {
+ // print it and free it
+ LOG_HELP(race_checkpoint_splits[i]);
+ strfree(race_checkpoint_splits[i]);
+ }
+ }
+
+ // allow registering 0th cp in case we start at 254 start line
+ race_checkpoint_splits_previous = 0;
+ }
break;
case RACE_NET_CHECKPOINT_CLEAR: