diff --git a/src/prediction.cpp b/src/prediction.cpp index 8e9e2c66..a44762c1 100644 --- a/src/prediction.cpp +++ b/src/prediction.cpp @@ -546,7 +546,7 @@ std::pair ProjectilePrediction_Engine(CachedEntity *ent, int hb, float rockettime = g_pLocalPlayer->v_Eye.DistTo(current) / speed; // Compensate for ping 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) { besttime = currenttime; @@ -650,7 +650,7 @@ std::pair ProjectilePrediction(CachedEntity *ent, int hb, float float rockettime = g_pLocalPlayer->v_Eye.DistTo(current) / speed; // Compensate for ping 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; bestpos = current;