LagCompensation: optimization, cache PVS info
This commit is contained in:
parent
d83497c0cb
commit
48d07eaa63
@ -31,6 +31,8 @@ bool g_bHasPhysHooks = true;
|
||||
#define EFL_DIRTY_SURROUNDING_COLLISION_BOUNDS (1<<14)
|
||||
#define EFL_CHECK_UNTOUCH (1<<24)
|
||||
#define COORDINATE_FRAME_SIZE 14
|
||||
#define PVSINFO_OFFSET 16
|
||||
#define PVSINFO_SIZE 32/4
|
||||
|
||||
enum
|
||||
{
|
||||
@ -85,6 +87,7 @@ enum struct LagRecord
|
||||
float angAbsRotation[3];
|
||||
float flSimulationTime;
|
||||
float rgflCoordinateFrame[COORDINATE_FRAME_SIZE];
|
||||
int PVSInfo[PVSINFO_SIZE];
|
||||
}
|
||||
|
||||
enum struct EntityLagData
|
||||
@ -122,6 +125,7 @@ int g_iParent;
|
||||
int g_iSpawnFlags;
|
||||
int g_iTouchStamp;
|
||||
int g_iCollision;
|
||||
int g_iNetwork;
|
||||
int g_iSolidFlags;
|
||||
int g_iSolidType;
|
||||
int g_iSurroundType;
|
||||
@ -321,6 +325,7 @@ public void OnMapStart()
|
||||
g_iSpawnFlags = FindDataMapInfo(0, "m_spawnflags");
|
||||
g_iTouchStamp = FindDataMapInfo(0, "touchStamp");
|
||||
g_iCollision = FindDataMapInfo(0, "m_Collision");
|
||||
g_iNetwork = FindDataMapInfo(0, "m_Network");
|
||||
g_iSolidFlags = FindDataMapInfo(0, "m_usSolidFlags");
|
||||
g_iSolidType = FindDataMapInfo(0, "m_nSolidType");
|
||||
g_iSurroundType = FindDataMapInfo(0, "m_nSurroundType");
|
||||
@ -886,6 +891,9 @@ void RecordDataIntoRecord(int iEntity, LagRecord Record)
|
||||
GetEntDataVector(iEntity, g_iAngAbsRotation, Record.angAbsRotation);
|
||||
GetEntDataArray(iEntity, g_iCoordinateFrame, view_as<int>(Record.rgflCoordinateFrame), COORDINATE_FRAME_SIZE);
|
||||
Record.flSimulationTime = GetEntDataFloat(iEntity, g_iSimulationTime);
|
||||
|
||||
// CServerNetworkProperty::GetPVSInfo(): return this + 16;
|
||||
GetEntDataArray(iEntity, g_iNetwork + PVSINFO_OFFSET, view_as<int>(Record.PVSInfo), PVSINFO_SIZE);
|
||||
}
|
||||
|
||||
bool DoesRotationInvalidateSurroundingBox(int iEntity)
|
||||
@ -926,12 +934,15 @@ bool DoesRotationInvalidateSurroundingBox(int iEntity)
|
||||
}
|
||||
}
|
||||
|
||||
void InvalidatePhysicsRecursive(int iEntity)
|
||||
void InvalidatePhysicsRecursive(int iEntity, LagRecord Record)
|
||||
{
|
||||
/*
|
||||
// NetworkProp()->MarkPVSInformationDirty()
|
||||
int fStateFlags = GetEdictFlags(iEntity);
|
||||
fStateFlags |= FL_EDICT_DIRTY_PVS_INFORMATION;
|
||||
SetEdictFlags(iEntity, fStateFlags);
|
||||
*/
|
||||
SetEntDataArray(iEntity, g_iNetwork + PVSINFO_OFFSET, view_as<int>(Record.PVSInfo), PVSINFO_SIZE);
|
||||
|
||||
// CollisionProp()->MarkPartitionHandleDirty();
|
||||
Address CollisionProp = GetEntityAddress(iEntity) + view_as<Address>(g_iCollision);
|
||||
@ -955,7 +966,7 @@ void RestoreEntityFromRecord(int iEntity, LagRecord Record)
|
||||
SetEntDataArray(iEntity, g_iCoordinateFrame, view_as<int>(Record.rgflCoordinateFrame), COORDINATE_FRAME_SIZE);
|
||||
SetEntDataFloat(iEntity, g_iSimulationTime, Record.flSimulationTime);
|
||||
|
||||
InvalidatePhysicsRecursive(iEntity);
|
||||
InvalidatePhysicsRecursive(iEntity, Record);
|
||||
}
|
||||
|
||||
|
||||
@ -1110,6 +1121,11 @@ void LagRecord_Copy(LagRecord obj, const LagRecord other)
|
||||
{
|
||||
obj.rgflCoordinateFrame[i] = other.rgflCoordinateFrame[i];
|
||||
}
|
||||
|
||||
for(int i = 0; i < PVSINFO_SIZE; i++)
|
||||
{
|
||||
obj.PVSInfo[i] = other.PVSInfo[i];
|
||||
}
|
||||
}
|
||||
|
||||
bool CompareVectors(const float vec1[3], const float vec2[3])
|
||||
|
Loading…
Reference in New Issue
Block a user