Compare commits

2 Commits

13 changed files with 90 additions and 55 deletions

View File

@@ -433,6 +433,7 @@ BEGIN_RECV_TABLE_NOBASE(C_BaseEntity, DT_BaseEntity)
RecvPropDataTable( "AnimTimeMustBeFirst", 0, 0, &REFERENCE_RECV_TABLE(DT_AnimTimeMustBeFirst) ),
RecvPropInt( RECVINFO(m_flSimulationTime), 0, RecvProxy_SimulationTime ),
RecvPropInt( RECVINFO( m_ubInterpolationFrame ) ),
RecvPropInt( RECVINFO( m_bForceNoInterpolate ) ),
RecvPropVector( RECVINFO_NAME( m_vecNetworkOrigin, m_vecOrigin ) ),
#if PREDICTION_ERROR_CHECK_LEVEL > 1
@@ -967,6 +968,7 @@ C_BaseEntity::C_BaseEntity() :
#endif
ParticleProp()->Init( this );
m_bForceNoInterpolate = false;
}
@@ -2994,6 +2996,9 @@ void C_BaseEntity::MoveToLastReceivedPosition( bool force )
bool C_BaseEntity::ShouldInterpolate()
{
if(m_bForceNoInterpolate)
return false;
if ( render->GetViewEntity() == index )
return true;

View File

@@ -1307,6 +1307,8 @@ public:
byte m_ubInterpolationFrame;
byte m_ubOldInterpolationFrame;
bool m_bForceNoInterpolate;
private:
// Effects to apply
int m_fEffects;

View File

@@ -99,7 +99,7 @@ class CBoundedCvar_Interp : public ConVar_ServerBounded
public:
CBoundedCvar_Interp() :
ConVar_ServerBounded( "cl_interp",
"0.1",
"0.025",
FCVAR_USERINFO | FCVAR_NOT_CONNECTED,
"Sets the interpolation amount (bounded on low side by server interp ratio settings).", true, 0.0f, true, 0.5f )
{

View File

@@ -269,6 +269,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CBaseEntity, DT_BaseEntity )
#endif
SendPropInt (SENDINFO( m_ubInterpolationFrame ), NOINTERP_PARITY_MAX_BITS, SPROP_UNSIGNED ),
SendPropBool (SENDINFO( m_bForceNoInterpolate )),
SendPropModelIndex(SENDINFO(m_nModelIndex)),
SendPropDataTable( SENDINFO_DT( m_Collision ), &REFERENCE_SEND_TABLE(DT_CollisionProperty) ),
SendPropInt (SENDINFO(m_nRenderFX), 8, SPROP_UNSIGNED ),

View File

@@ -814,6 +814,8 @@ public:
CNetworkVar( int, m_ubInterpolationFrame );
CNetworkVar( bool, m_bForceNoInterpolate );
int m_nLastThinkTick;
#if !defined( NO_ENTITY_PREDICTION )

View File

@@ -594,7 +594,7 @@ CBasePlayer::CBasePlayer( )
m_hZoomOwner = NULL;
m_nUpdateRate = 20; // cl_updaterate defualt
m_fLerpTime = 0.1f; // cl_interp default
m_fLerpTime = 0.025f; // cl_interp default
m_bPredictWeapons = true;
m_bLagCompensation = false;
m_flLaggedMovementValue = 1.0f;

View File

@@ -176,7 +176,11 @@ void CCrossbowBolt::Spawn( void )
SetThink( &CCrossbowBolt::BubbleThink );
SetNextThink( gpGlobals->curtime + 0.1f );
#ifdef CLIENT_DLL
m_bForceNoInterpolate = true;
#endif
CreateSprites();
// Make us glow until we've hit the wall

View File

@@ -578,6 +578,9 @@ void CGrabController::AttachEntity( CBasePlayer *pPlayer, CBaseEntity *pEntity,
{
m_bHasPreferredCarryAngles = false;
}
if(pEntity)
pEntity->m_bForceNoInterpolate = true;
#else
m_bHasPreferredCarryAngles = false;
@@ -635,6 +638,11 @@ void CGrabController::DetachEntity( bool bClearVelocity )
}
}
#ifndef CLIENT_DLL
if(pEntity)
pEntity->m_bForceNoInterpolate = true;
#endif
m_attachedEntity = NULL;
if ( physenv )
{
@@ -1109,7 +1117,7 @@ public:
CNetworkHandle( CBaseEntity, m_hAttachedObject );
EHANDLE m_hOldAttachedObject;
CNetworkHandle(CBaseEntity, m_hOldAttachedObject );
protected:
enum FindObjectResult_t
@@ -1206,7 +1214,7 @@ protected:
virtual void OnDataChanged( DataUpdateType_t type );
virtual void ClientThink( void );
void ManagePredictedObject( void );
//void ManagePredictedObject( void );
void DrawEffects( void );
void GetEffectParameters( EffectType_t effectID, color32 &color, float &scale, IMaterial **pMaterial, Vector &vecAttachment );
void DrawEffectSprite( EffectType_t effectID );
@@ -1261,6 +1269,7 @@ BEGIN_NETWORK_TABLE( CWeaponPhysCannon, DT_WeaponPhysCannon )
#ifdef CLIENT_DLL
RecvPropBool( RECVINFO( m_bActive ) ),
RecvPropEHandle( RECVINFO( m_hAttachedObject ) ),
RecvPropEHandle( RECVINFO( m_hOldAttachedObject ) ),
RecvPropVector( RECVINFO( m_attachedPositionObjectSpace ) ),
RecvPropFloat( RECVINFO( m_attachedAnglesPlayerSpace[0] ) ),
RecvPropFloat( RECVINFO( m_attachedAnglesPlayerSpace[1] ) ),
@@ -1270,6 +1279,7 @@ BEGIN_NETWORK_TABLE( CWeaponPhysCannon, DT_WeaponPhysCannon )
#else
SendPropBool( SENDINFO( m_bActive ) ),
SendPropEHandle( SENDINFO( m_hAttachedObject ) ),
SendPropEHandle( SENDINFO( m_hOldAttachedObject ) ),
SendPropVector(SENDINFO( m_attachedPositionObjectSpace ), -1, SPROP_COORD),
SendPropAngle( SENDINFO_VECTORELEM(m_attachedAnglesPlayerSpace, 0 ), 11 ),
SendPropAngle( SENDINFO_VECTORELEM(m_attachedAnglesPlayerSpace, 1 ), 11 ),
@@ -2425,53 +2435,53 @@ void CWeaponPhysCannon::DetachObject( bool playSound, bool wasLaunched )
}
#ifdef CLIENT_DLL
void CWeaponPhysCannon::ManagePredictedObject( void )
{
CBaseEntity *pAttachedObject = m_hAttachedObject.Get();
if ( m_hAttachedObject )
{
// NOTE :This must happen after OnPhysGunPickup because that can change the mass
if ( pAttachedObject != GetGrabController().GetAttached() )
{
IPhysicsObject *pPhysics = pAttachedObject->VPhysicsGetObject();
if ( pPhysics == NULL )
{
solid_t tmpSolid;
PhysModelParseSolid( tmpSolid, m_hAttachedObject, pAttachedObject->GetModelIndex() );
pAttachedObject->VPhysicsInitNormal( SOLID_VPHYSICS, 0, false, &tmpSolid );
}
pPhysics = pAttachedObject->VPhysicsGetObject();
if ( pPhysics )
{
m_grabController.SetIgnorePitch( false );
m_grabController.SetAngleAlignment( 0 );
GetGrabController().AttachEntity( ToBasePlayer( GetOwner() ), pAttachedObject, pPhysics, false, vec3_origin, false );
GetGrabController().m_attachedPositionObjectSpace = m_attachedPositionObjectSpace;
GetGrabController().m_attachedAnglesPlayerSpace = m_attachedAnglesPlayerSpace;
}
}
}
else
{
if ( m_hOldAttachedObject && m_hOldAttachedObject->VPhysicsGetObject() )
{
GetGrabController().DetachEntity( false );
m_hOldAttachedObject->VPhysicsDestroyObject();
}
}
m_hOldAttachedObject = m_hAttachedObject;
}
#endif
//#ifdef CLIENT_DLL
//void CWeaponPhysCannon::ManagePredictedObject( void )
//{
// CBaseEntity *pAttachedObject = m_hAttachedObject.Get();
//
// if ( m_hAttachedObject )
// {
// // NOTE :This must happen after OnPhysGunPickup because that can change the mass
// if ( pAttachedObject != GetGrabController().GetAttached() )
// {
// IPhysicsObject *pPhysics = pAttachedObject->VPhysicsGetObject();
//
// if ( pPhysics == NULL )
// {
// solid_t tmpSolid;
// PhysModelParseSolid( tmpSolid, m_hAttachedObject, pAttachedObject->GetModelIndex() );
//
// pAttachedObject->VPhysicsInitNormal( SOLID_VPHYSICS, 0, false, &tmpSolid );
// }
//
// pPhysics = pAttachedObject->VPhysicsGetObject();
//
// if ( pPhysics )
// {
// m_grabController.SetIgnorePitch( false );
// m_grabController.SetAngleAlignment( 0 );
//
// GetGrabController().AttachEntity( ToBasePlayer( GetOwner() ), pAttachedObject, pPhysics, false, vec3_origin, false );
// GetGrabController().m_attachedPositionObjectSpace = m_attachedPositionObjectSpace;
// GetGrabController().m_attachedAnglesPlayerSpace = m_attachedAnglesPlayerSpace;
// }
// }
// }
// else
// {
// if ( m_hOldAttachedObject && m_hOldAttachedObject->VPhysicsGetObject() )
// {
// GetGrabController().DetachEntity( false );
//
// m_hOldAttachedObject->VPhysicsDestroyObject();
// }
// }
//
// m_hOldAttachedObject = m_hAttachedObject;
//}
//
//#endif
#ifdef CLIENT_DLL
@@ -2524,10 +2534,16 @@ void CWeaponPhysCannon::ItemPreFrame()
BaseClass::ItemPreFrame();
#ifdef CLIENT_DLL
C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
//C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
if ( localplayer && !localplayer->IsObserver() )
ManagePredictedObject();
//if ( localplayer && !localplayer->IsObserver() )
// ManagePredictedObject();
if(m_hAttachedObject)
m_hAttachedObject.Get()->m_bForceNoInterpolate = true;
else
if(m_hOldAttachedObject)
m_hOldAttachedObject.Get()->m_bForceNoInterpolate = false;
#endif
// Update the object if the weapon is switched on.

View File

@@ -147,6 +147,9 @@ class CWeaponRPG;
CMissile::CMissile()
{
m_hRocketTrail = NULL;
#ifdef CLIENT_DLL
m_bForceNoInterpolate = true;
#endif
}
CMissile::~CMissile()
@@ -2123,6 +2126,8 @@ CLaserDot::CLaserDot( void )
m_bIsOn = true;
#ifndef CLIENT_DLL
g_LaserDotList.Insert( this );
#else
m_bForceNoInterpolate = true;
#endif
}

Binary file not shown.

Binary file not shown.

Binary file not shown.