LagCompensation: fix PVS issues?

This commit is contained in:
BotoX 2019-12-21 21:52:53 +01:00
parent 84465de343
commit 4c52227886
2 changed files with 29 additions and 1 deletions

View File

@ -39,6 +39,12 @@
"library" "server"
"linux" "@_ZN18CCollisionProperty24MarkPartitionHandleDirtyEv"
}
"RecomputePVSInformation"
{
"library" "server"
"linux" "@_ZN22CServerNetworkProperty23RecomputePVSInformationEv"
}
}
"Functions"

View File

@ -16,7 +16,7 @@ public Plugin myinfo =
name = "LagCompensation",
author = "BotoX",
description = "",
version = "1.0",
version = "1.1",
url = ""
};
@ -112,6 +112,7 @@ bool g_bCleaningUp = true;
Handle g_hCalcAbsolutePosition;
Handle g_hMarkPartitionHandleDirty;
Handle g_hRecomputePVSInformation;
Handle g_hUTIL_Remove;
Handle g_hRestartRound;
@ -167,6 +168,15 @@ public void OnPluginStart()
}
g_hMarkPartitionHandleDirty = EndPrepSDKCall();
// CServerNetworkProperty::RecomputePVSInformation
StartPrepSDKCall(SDKCall_Raw);
if(!PrepSDKCall_SetFromConf(hGameData, SDKConf_Signature, "RecomputePVSInformation"))
{
delete hGameData;
SetFailState("PrepSDKCall_SetFromConf(hGameData, SDKConf_Signature, \"RecomputePVSInformation\") failed!");
}
g_hRecomputePVSInformation = EndPrepSDKCall();
// ::UTIL_Remove
g_hUTIL_Remove = DHookCreateFromConf(hGameData, "UTIL_Remove");
@ -892,6 +902,14 @@ void RecordDataIntoRecord(int iEntity, LagRecord Record)
GetEntDataArray(iEntity, g_iCoordinateFrame, view_as<int>(Record.rgflCoordinateFrame), COORDINATE_FRAME_SIZE);
Record.flSimulationTime = GetEntDataFloat(iEntity, g_iSimulationTime);
// Make sure to have fresh PVS info before caching it.
// NetworkProp()->RecomputePVSInformation();
Address NetworkProp = GetEntityAddress(iEntity) + view_as<Address>(g_iNetwork);
SDKCall(g_hRecomputePVSInformation, NetworkProp);
if(GetEdictFlags(iEntity) & FL_EDICT_DIRTY_PVS_INFORMATION)
PrintToBoth("POST FL_EDICT_DIRTY_PVS_INFORMATION !!!!!!!!");
// CServerNetworkProperty::GetPVSInfo(): return this + 16;
GetEntDataArray(iEntity, g_iNetwork + PVSINFO_OFFSET, view_as<int>(Record.PVSInfo), PVSINFO_SIZE);
}
@ -942,6 +960,10 @@ void InvalidatePhysicsRecursive(int iEntity, LagRecord Record)
fStateFlags |= FL_EDICT_DIRTY_PVS_INFORMATION;
SetEdictFlags(iEntity, fStateFlags);
*/
if(GetEdictFlags(iEntity) & FL_EDICT_DIRTY_PVS_INFORMATION)
PrintToBoth("RESTORE FL_EDICT_DIRTY_PVS_INFORMATION !!!!!!!!");
SetEntDataArray(iEntity, g_iNetwork + PVSINFO_OFFSET, view_as<int>(Record.PVSInfo), PVSINFO_SIZE);
// CollisionProp()->MarkPartitionHandleDirty();