LagCompensation: Fix everything???

This commit is contained in:
BotoX 2019-11-13 17:21:47 +01:00
parent 074c926896
commit 02f992aedb
2 changed files with 41 additions and 1 deletions

View File

@ -22,6 +22,12 @@
"linux" "@_ZN21CLogicMeasureMovement9SetTargetEPKc"
}
"CEntityTouchManager::FrameUpdatePostEntityThink"
{
"library" "server"
"linux" "@_ZN19CEntityTouchManager26FrameUpdatePostEntityThinkEv"
}
"CalcAbsolutePosition"
{
"library" "server"
@ -59,6 +65,14 @@
"this" "ignore"
}
"CEntityTouchManager__FrameUpdatePostEntityThink"
{
"signature" "CEntityTouchManager::FrameUpdatePostEntityThink"
"callconv" "thiscall"
"return" "void"
"this" "ignore"
}
"CLogicMeasureMovement__SetTarget"
{
"signature" "CLogicMeasureMovement::SetTarget"

View File

@ -90,6 +90,7 @@ Handle g_hUTIL_Remove;
Handle g_hRestartRound;
Handle g_hSetTarget;
Handle g_hSetTargetPost;
Handle g_hFrameUpdatePostEntityThink;
int g_iTouchStamp;
int g_iCollision;
@ -188,6 +189,20 @@ public void OnPluginStart()
SetFailState("Failed to detour CLogicMeasureMovement__SetTarget_post.");
}
// CEntityTouchManager::FrameUpdatePostEntityThink
g_hFrameUpdatePostEntityThink = DHookCreateFromConf(hGameData, "CEntityTouchManager__FrameUpdatePostEntityThink");
if(!g_hFrameUpdatePostEntityThink)
{
delete hGameData;
SetFailState("Failed to setup detour for CEntityTouchManager__FrameUpdatePostEntityThink");
}
if(!DHookEnableDetour(g_hFrameUpdatePostEntityThink, false, Detour_OnFrameUpdatePostEntityThink))
{
delete hGameData;
SetFailState("Failed to detour CEntityTouchManager__FrameUpdatePostEntityThink.");
}
delete hGameData;
RegAdminCmd("sm_unlag", Command_AddLagCompensation, ADMFLAG_RCON, "sm_unlag <entidx>");
@ -437,6 +452,8 @@ public void OnMapStart()
public void OnRunThinkFunctions(bool simulating)
{
FilterTriggerTouchPlayers(g_aBlockTriggerTouch, false);
for(int i = 0; i < g_iNumEntities; i++)
{
if(!IsValidEntity(g_aEntityLagData[i].iEntity))
@ -684,8 +701,17 @@ public void OnRunThinkFunctionsPost(bool simulating)
);
#endif
}
}
FilterTriggerTouchPlayers(g_aBlockTriggerTouch, false);
public MRESReturn Detour_OnFrameUpdatePostEntityThink()
{
// VPhysics runs stuff again after QPhysics entity simulation so do this again...
for(int i = 0; i < g_iNumEntities; i++)
{
int EFlags = GetEntData(g_aEntityLagData[i].iEntity, g_iEFlags);
EFlags &= ~EFL_CHECK_UNTOUCH;
SetEntData(g_aEntityLagData[i].iEntity, g_iEFlags, EFlags);
}
}
void RecordDataIntoRecord(int iEntity, LagRecord Record)