Fix mvd ents spawning with the wrong entity in certain cases.

This commit is contained in:
Shpoike 2024-07-21 01:18:21 +01:00
parent ff1a2299f4
commit 541b98edda
2 changed files with 15 additions and 11 deletions

View file

@ -533,6 +533,7 @@ qboolean CL_GetDemoMessage (void)
int demopos = 0; int demopos = 0;
int msglength; int msglength;
static float throttle; static float throttle;
static qboolean newseq;
if (endofdemo) if (endofdemo)
{ {
@ -783,6 +784,7 @@ readnext:
{ {
if ((msecsadded || cls.netchan.incoming_sequence < 2) && olddemotime != demotime) if ((msecsadded || cls.netchan.incoming_sequence < 2) && olddemotime != demotime)
{ {
newseq = true;
cls.netchan.frame_latency = 0; cls.netchan.frame_latency = 0;
cls.netchan.last_received = realtime; // just to happy timeout check cls.netchan.last_received = realtime; // just to happy timeout check
} }
@ -995,8 +997,9 @@ readit:
if (cls.demoplayback == DPB_MVD) if (cls.demoplayback == DPB_MVD)
{ {
if ((msecsadded || cls.netchan.incoming_sequence < 2) && olddemotime != demotime) if (/*(msecsadded || cls.netchan.incoming_sequence < 2) && olddemotime != demotime ||*/ newseq)
{ {
newseq = false;
if (!(cls.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS)) if (!(cls.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS))
{ {
cls.netchan.incoming_sequence++; cls.netchan.incoming_sequence++;

View file

@ -611,6 +611,7 @@ short LerpAngles16(short to, short from, float frac)
void CL_CalcClientTime(void) void CL_CalcClientTime(void)
{ {
extern cvar_t cl_demospeed;
if (!cls.state) if (!cls.state)
{ {
if (!cl.implicitpause) if (!cl.implicitpause)
@ -649,6 +650,7 @@ void CL_CalcClientTime(void)
else else
{ //funky magic drift logic. we be behind the most recent frame in order to attempt to cover network congestions (which is apparently common in germany). { //funky magic drift logic. we be behind the most recent frame in order to attempt to cover network congestions (which is apparently common in germany).
float min, max; float min, max;
float r;
// oldst = cl.servertime; // oldst = cl.servertime;
@ -659,14 +661,13 @@ void CL_CalcClientTime(void)
if (max < min) if (max < min)
max = min; max = min;
if (cls.demoplayback && cl_demospeed.value > 0 && cls.state == ca_active)
r = cl_demospeed.value;
else
r = 1;
if (max) if (max)
{ cl.servertime += host_frametime*r;
extern cvar_t cl_demospeed;
if (cls.demoplayback && cl_demospeed.value > 0 && cls.state == ca_active)
cl.servertime += host_frametime*cl_demospeed.value;
else
cl.servertime += host_frametime;
}
else else
cl.servertime = 0; cl.servertime = 0;
@ -681,7 +682,7 @@ void CL_CalcClientTime(void)
} }
else else
{ {
cl.servertime -= 0.02*(max - cl.servertime); cl.servertime -= 0.02*(max - cl.servertime)*r;
if (cl.servertime < cl.time) if (cl.servertime < cl.time)
cl.servertime = cl.time; cl.servertime = cl.time;
} }
@ -695,12 +696,12 @@ void CL_CalcClientTime(void)
} }
else if (cl.servertime < min-0.3) else if (cl.servertime < min-0.3)
{ {
cl.servertime += 0.02*(min - cl.servertime); cl.servertime += 0.02*(min - cl.servertime)*r;
// Con_Printf("running really slow\n"); // Con_Printf("running really slow\n");
} }
else else
{ {
cl.servertime += 0.01*(min - cl.servertime); cl.servertime += 0.01*(min - cl.servertime)*r;
// Con_Printf("running slow\n"); // Con_Printf("running slow\n");
} }
} }