Change to FL_EDICT_ALWAYS

This commit is contained in:
Kamay Xutax 2024-08-24 04:52:57 +02:00
parent 1856a9ee30
commit 7a92c3afde
5 changed files with 57 additions and 56 deletions

View file

@ -3140,38 +3140,38 @@ void _Host_RunFrame (float time)
#ifndef SWDS #ifndef SWDS
const auto CalcInterpolationAmount = [&]() const auto CalcInterpolationAmount = [&]()
{ {
// TODO_ENHANCED: // TODO_ENHANCED:
// Notice_Enhanced: // Notice_Enhanced:
// This check permits to fix interpolation problems on the // This check permits to fix interpolation problems on the
// local player that valve has been (fucking finally) // local player that valve has been (fucking finally)
// caring about on counter-strike 2. // caring about on counter-strike 2.
// //
// To recall the original issue, the // To recall the original issue, the
// problem that Valve cared about is that interpolation // problem that Valve cared about is that interpolation
// had some problems with interpolating the local // had some problems with interpolating the local
// player because the screen would never in the first // player because the screen would never in the first
// place match the tick "screen", because interpolation // place match the tick "screen", because interpolation
// amount could never reach 0.0 or 1.0 // amount could never reach 0.0 or 1.0
// //
// Valve solution was to introduce bugs with lag // Valve solution was to introduce bugs with lag
// compensating the local player and made the game worse, // compensating the local player and made the game worse,
// introducing a new way for cheaters to cheat even more // introducing a new way for cheaters to cheat even more
// on their games. // on their games.
// I'm joking, but you can clearly see the outcome anyway. // I'm joking, but you can clearly see the outcome anyway.
// //
// My solution is to simply set interpolation amount // My solution is to simply set interpolation amount
// to 0.0 when a tick arrives. // to 0.0 when a tick arrives.
// //
// So when we shoot, we get the frame we shot with an // So when we shoot, we get the frame we shot with an
// interpolation amount at 0.0, perfectly aligned to user // interpolation amount at 0.0, perfectly aligned to user
// commands which is ideal for us. // commands which is ideal for us.
// //
// Now includes smoothing. // Now includes smoothing.
static ConVar cl_interpolation_amount_fix("cl_interpolation_amount_fix", "1"); static ConVar cl_interpolation_amount_fix("cl_interpolation_amount_fix", "1");
static float flLastInterpolationAmountOnTick = 0.0f; static float flLastInterpolationAmountOnTick = 0.0f;
float flInterpAmount = cl.m_tickRemainder / host_state.interval_per_tick; float flInterpAmount = cl.m_tickRemainder / host_state.interval_per_tick;
if (!cl_interpolation_amount_fix.GetBool()) if (!cl_interpolation_amount_fix.GetBool())
{ {
@ -3179,37 +3179,37 @@ void _Host_RunFrame (float time)
return; return;
} }
if (numticks > 0 || host_frametime >= host_state.interval_per_tick) if (numticks > 0 || host_frametime >= host_state.interval_per_tick)
{ {
#ifdef false #ifdef false
printf("interpolation amount was %f, corrected to " printf("interpolation amount was %f, corrected to "
"fix interpolation issues.\n", "fix interpolation issues.\n",
flInterpAmount); flInterpAmount);
#endif #endif
g_ClientGlobalVariables.interpolation_amount = 0.0f; g_ClientGlobalVariables.interpolation_amount = 0.0f;
flLastInterpolationAmountOnTick = flInterpAmount; flLastInterpolationAmountOnTick = flInterpAmount;
} }
else else
{ {
float flEstimatedAmountToAdd = host_frametime / host_state.interval_per_tick; float flEstimatedAmountToAdd = host_frametime / host_state.interval_per_tick;
g_ClientGlobalVariables.interpolation_amount += flEstimatedAmountToAdd; g_ClientGlobalVariables.interpolation_amount += flEstimatedAmountToAdd;
// Accumulate also the one we diddn't account for. // Accumulate also the one we didn't account for.
g_ClientGlobalVariables.interpolation_amount += flLastInterpolationAmountOnTick * flEstimatedAmountToAdd; g_ClientGlobalVariables.interpolation_amount += flLastInterpolationAmountOnTick * flEstimatedAmountToAdd;
ErrorIfNot(g_ClientGlobalVariables.interpolation_amount >= 0.0f, ErrorIfNot(g_ClientGlobalVariables.interpolation_amount >= 0.0f,
("Interpolation amount was lower than 0 (%f)\n", g_ClientGlobalVariables.interpolation_amount)); ("Interpolation amount was lower than 0 (%f)\n", g_ClientGlobalVariables.interpolation_amount));
ErrorIfNot(g_ClientGlobalVariables.interpolation_amount < 1.0f, ErrorIfNot(g_ClientGlobalVariables.interpolation_amount < 1.0f,
("Interpolation amount was higher than or equal to 1 (%f)\n", g_ClientGlobalVariables.interpolation_amount)); ("Interpolation amount was higher than or equal to 1 (%f)\n", g_ClientGlobalVariables.interpolation_amount));
#ifdef false #ifdef false
printf("current interp: %f, old amount: %f, time: %f, frametime: %f, last remainder not interpolated: %f\n", printf("current interp: %f, old amount: %f, time: %f, frametime: %f, last remainder not interpolated: %f\n",
g_ClientGlobalVariables.interpolation_amount, g_ClientGlobalVariables.interpolation_amount,
flInterpAmount, flInterpAmount,
time, time,
host_frametime, host_frametime,
flLastInterpolationAmountOnTick); flLastInterpolationAmountOnTick);
#endif #endif
} }
}; };
#endif #endif
{ {

View file

@ -3493,7 +3493,7 @@ void CMortarShell::Precache()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int CMortarShell::UpdateTransmitState( void ) int CMortarShell::UpdateTransmitState( void )
{ {
return SetTransmitState( FL_EDICT_PVSCHECK ); return SetTransmitState( FL_EDICT_ALWAYS );
} }
//--------------------------------------------------------- //---------------------------------------------------------

View file

@ -438,6 +438,6 @@ void CGrenadeBeam::Precache( void )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int CGrenadeBeam::UpdateTransmitState(void) int CGrenadeBeam::UpdateTransmitState(void)
{ {
return SetTransmitState( FL_EDICT_PVSCHECK ); return SetTransmitState( FL_EDICT_ALWAYS );
} }

View file

@ -8,6 +8,7 @@
//=============================================================================// //=============================================================================//
#include "cbase.h" #include "cbase.h"
#include "edict.h"
#include "physics_prop_ragdoll.h" #include "physics_prop_ragdoll.h"
#include "npc_barnacle.h" #include "npc_barnacle.h"
#include "npcevent.h" #include "npcevent.h"
@ -2587,7 +2588,7 @@ void CBarnacleTongueTip::Spawn( void )
int CBarnacleTongueTip::UpdateTransmitState( void ) int CBarnacleTongueTip::UpdateTransmitState( void )
{ {
return SetTransmitState( FL_EDICT_PVSCHECK ); return SetTransmitState( FL_EDICT_ALWAYS );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -275,7 +275,7 @@ bool CBoneFollower::Init( CBaseEntity *pOwner, const char *pModelName, solid_t &
int CBoneFollower::UpdateTransmitState() int CBoneFollower::UpdateTransmitState()
{ {
// Send to the client for client-side collisions and visualization // Send to the client for client-side collisions and visualization
return SetTransmitState( FL_EDICT_PVSCHECK ); return SetTransmitState( FL_EDICT_ALWAYS );
} }
void CBoneFollower::VPhysicsUpdate( IPhysicsObject *pPhysics ) void CBoneFollower::VPhysicsUpdate( IPhysicsObject *pPhysics )