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

View File

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

View File

@@ -99,7 +99,7 @@ class CBoundedCvar_Interp : public ConVar_ServerBounded
public: public:
CBoundedCvar_Interp() : CBoundedCvar_Interp() :
ConVar_ServerBounded( "cl_interp", ConVar_ServerBounded( "cl_interp",
"0.1", "0.025",
FCVAR_USERINFO | FCVAR_NOT_CONNECTED, FCVAR_USERINFO | FCVAR_NOT_CONNECTED,
"Sets the interpolation amount (bounded on low side by server interp ratio settings).", true, 0.0f, true, 0.5f ) "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 #endif
SendPropInt (SENDINFO( m_ubInterpolationFrame ), NOINTERP_PARITY_MAX_BITS, SPROP_UNSIGNED ), SendPropInt (SENDINFO( m_ubInterpolationFrame ), NOINTERP_PARITY_MAX_BITS, SPROP_UNSIGNED ),
SendPropBool (SENDINFO( m_bForceNoInterpolate )),
SendPropModelIndex(SENDINFO(m_nModelIndex)), SendPropModelIndex(SENDINFO(m_nModelIndex)),
SendPropDataTable( SENDINFO_DT( m_Collision ), &REFERENCE_SEND_TABLE(DT_CollisionProperty) ), SendPropDataTable( SENDINFO_DT( m_Collision ), &REFERENCE_SEND_TABLE(DT_CollisionProperty) ),
SendPropInt (SENDINFO(m_nRenderFX), 8, SPROP_UNSIGNED ), SendPropInt (SENDINFO(m_nRenderFX), 8, SPROP_UNSIGNED ),

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.