make Shavit_HijackAngles calculate the number of ticks

This commit is contained in:
rtldg 2021-10-17 05:18:02 +00:00
parent 7493c7d548
commit b09be9f5de
2 changed files with 21 additions and 7 deletions

View File

@ -1452,13 +1452,9 @@ void LoadCheckpointCache(int client, cp_cache_t cpcache, bool isPersistentData)
{
Shavit_SetPracticeMode(client, false, true);
float latency = GetClientLatency(client, NetFlow_Both);
if (gCV_ExperimentalSegmentedEyeAngleFix.BoolValue && latency > 0.0)
if (gCV_ExperimentalSegmentedEyeAngleFix.BoolValue)
{
int ticks = RoundToCeil(latency / GetTickInterval()) + 1;
//PrintToChat(client, "%f %f %d", latency, GetTickInterval(), ticks);
Shavit_HijackAngles(client, cpcache.fAngles[0], cpcache.fAngles[1], ticks);
Shavit_HijackAngles(client, cpcache.fAngles[0], cpcache.fAngles[1], -1);
}
}

View File

@ -593,5 +593,23 @@ public int Native_HijackAngles(Handle handler, int numParams)
gF_HijackedAngles[client][0] = view_as<float>(GetNativeCell(2));
gF_HijackedAngles[client][1] = view_as<float>(GetNativeCell(3));
gI_HijackFrames[client] = GetNativeCell(4);
int ticks = GetNativeCell(4);
if (ticks == -1)
{
float latency = GetClientLatency(client, NetFlow_Both);
if (latency > 0.0)
{
ticks = RoundToCeil(latency / GetTickInterval()) + 1;
//PrintToChat(client, "%f %f %d", latency, GetTickInterval(), ticks);
gI_HijackFrames[client] = ticks;
}
}
else
{
gI_HijackFrames[client] = ticks;
}
}