Add inverted math for special instances

This commit is contained in:
SheepyChris 2022-02-17 19:14:35 -05:00 committed by LightCat
parent d1a6f4e8df
commit 734832aef6

View File

@ -546,7 +546,7 @@ std::pair<Vector, Vector> ProjectilePrediction_Engine(CachedEntity *ent, int hb,
float rockettime = g_pLocalPlayer->v_Eye.DistTo(current) / speed; float rockettime = g_pLocalPlayer->v_Eye.DistTo(current) / speed;
// Compensate for ping // Compensate for ping
rockettime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat(); rockettime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat();
float timedelta = fabs(currenttime - rockettime); float timedelta = fabs(currenttime > rockettime ? currenttime - rockettime : rockettime - currenttime);
if (timedelta < mindelta) if (timedelta < mindelta)
{ {
besttime = currenttime; besttime = currenttime;
@ -650,7 +650,7 @@ std::pair<Vector, Vector> ProjectilePrediction(CachedEntity *ent, int hb, float
float rockettime = g_pLocalPlayer->v_Eye.DistTo(current) / speed; float rockettime = g_pLocalPlayer->v_Eye.DistTo(current) / speed;
// Compensate for ping // Compensate for ping
rockettime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat(); rockettime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat();
if (fabs(currenttime - rockettime) < mindelta) if (fabs(currenttime > rockettime ? currenttime - rockettime : rockettime - currenttime) < mindelta)
{ {
besttime = currenttime; besttime = currenttime;
bestpos = current; bestpos = current;