race_previousbesttime = ReadInt24_t();
race_mypreviousbesttime = ReadInt24_t();
string pbestname = ReadString();
+ race_timespeed = ReadFloat();
+ race_timebestspeed = ReadFloat();
+ race_mybestspeed = ReadFloat();
if(autocvar_cl_race_cptimes_onlyself)
{
race_previousbesttime = race_mypreviousbesttime;
if(b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING) // not while spectating (matches server)
race_mybesttime = ReadInt24_t();
string newname = ReadString();
+ race_nextbestspeed = ReadFloat();
+ if(b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING) // not while spectating (matches server)
+ race_mybestspeed = ReadFloat();
if(autocvar_cl_race_cptimes_onlyself && b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING)
{
race_nextbesttime = race_mybesttime;
+ race_nextbestspeed = race_mybestspeed;
race_mybesttime = 0;
+ race_mybestspeed = 0;
strcpy(race_nextbestname, "");
}
else
.entity sprite;
float race_checkpoint_records[MAX_CHECKPOINTS];
+float race_checkpoint_recordspeeds[MAX_CHECKPOINTS];
string race_checkpoint_recordholders[MAX_CHECKPOINTS];
float race_checkpoint_lasttimes[MAX_CHECKPOINTS];
float race_checkpoint_lastlaps[MAX_CHECKPOINTS];
entity race_checkpoint_lastplayers[MAX_CHECKPOINTS];
.float race_checkpoint_record[MAX_CHECKPOINTS];
+.float race_checkpoint_recordspeed[MAX_CHECKPOINTS];
float race_highest_checkpoint;
float race_timed_checkpoint;
int cp = e.race_checkpoint;
float recordtime;
+ float recordspeed;
float myrecordtime = e.race_checkpoint_record[cp];
+ float myrecordspeed = e.race_checkpoint_recordspeed[cp];
string recordholder;
if (autocvar_g_race_cptimes_onlyself) {
recordtime = myrecordtime;
+ recordspeed = myrecordspeed;
recordholder = "";
} else {
recordtime = race_checkpoint_records[cp];
+ recordspeed = race_checkpoint_recordspeeds[cp];
recordholder = race_checkpoint_recordholders[cp];
if(recordholder == e.netname)
if(!spec)
WriteInt24_t(MSG_ONE, myrecordtime);
WriteString(MSG_ONE, recordholder);
+ // All speeds networked as floats to have decimal precision
+ WriteFloat(MSG_ONE, recordspeed);
+ if(!spec)
+ WriteFloat(MSG_ONE, myrecordspeed);
});
}
if(g_race_qualifying)
{
float recordtime;
+ float recordtimespeed;
string recordholder;
if(tvalid)
{
// return their own checkpoint time
recordtime = e.race_checkpoint_record[cp];
+ recordtimespeed = e.race_checkpoint_recordspeed[cp];
recordholder = "";
}
else
{
recordtime = race_checkpoint_records[cp];
+ recordtimespeed = race_checkpoint_recordspeeds[cp];
// make a tempstring copy, as we'll possibly strunzone it
recordholder = strcat(race_checkpoint_recordholders[cp]);
if(t < recordtime || recordtime == 0)
{
race_checkpoint_records[cp] = t;
+ race_checkpoint_recordspeeds[cp] = vlen(vec2(e.velocity));
strcpy(race_checkpoint_recordholders[cp], e.netname);
if(g_race_qualifying)
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, { race_SendNextCheckpoint(it, 0); });
// dummies
t = 0;
recordtime = 0;
+ recordtimespeed = 0;
recordholder = "";
}
WriteInt24_t(MSG_ONE, recordtime); // previously best time
WriteInt24_t(MSG_ONE, ((tvalid) ? it.race_checkpoint_record[cp] : 0)); // previously best time
WriteString(MSG_ONE, recordholder); // record holder
+ // All speeds networked as floats to have decimal precision
+ WriteFloat(MSG_ONE, vlen(vec2(e.velocity))); // speed of cp hit
+ WriteFloat(MSG_ONE, recordtimespeed); // speed of previous best cp hit
+ WriteFloat(MSG_ONE, ((tvalid) ? it.race_checkpoint_recordspeed[cp] : 0)); // speed of my previous best cp hit
}
});
}
float myrecordtime = e.race_checkpoint_record[cp];
if(t != 0)
if(t < myrecordtime || myrecordtime == 0)
+ {
e.race_checkpoint_record[cp] = t;
+ e.race_checkpoint_recordspeed[cp] = vlen(vec2(e.velocity));
+ }
}
}
else // RACE! Not Qualifying
void race_ClearPlayerRecords(entity player)
{
for(int i = 0; i < MAX_CHECKPOINTS; ++i)
+ {
player.race_checkpoint_record[i] = 0;
+ player.race_checkpoint_recordspeed[i] = 0;
+ }
}
void race_ClearRecords()
for(int j = 0; j < MAX_CHECKPOINTS; ++j)
{
race_checkpoint_records[j] = 0;
+ race_checkpoint_recordspeeds[j] = 0;
strfree(race_checkpoint_recordholders[j]);
}