cl_dll/c_baseentity.cpp
75767778798081828384
}
}
static ConVar cl_extrapolate( "cl_extrapolate", "1", FCVAR_CHEAT, "Enable/disable extrapolation if interpolation history runs out." );
static ConVar cl_interpolate( "cl_interpolate", "1.0", FCVAR_USERINFO, "Interpolate entities on the client." );
static ConVar cl_interp ( "cl_interp", "0.1", FCVAR_USERINFO | FCVAR_DEMO, "Interpolate object positions starting this many seconds in past", true, 0.01, true, 1.0, cc_cl_interp_changed );
static ConVar cl_interp_npcs( "cl_interp_npcs", "0.0", FCVAR_USERINFO, "Interpolate NPC positions starting this many seconds in past (or cl_interp, if greater)", 0, 0, 0, 0, cc_cl_interp_changed );
static ConVar cl_interp_all( "cl_interp_all", "0", 0, "Disable interpolation list optimizations.", 0, 0, 0, 0, cc_cl_interp_all_changed );
//APSFIXME - Temp until I fix
75767778798081828384858687
}
}
// --> Mirv: Using this to select interp
static ConVar cl_interp_ratio("cl_interp_ratio", "2.0", FCVAR_USERINFO|FCVAR_DEMO, "This is best kept to 2.0, don't you know.", true, 0.1f, true, 4.0f, cc_cl_interp_changed);
// <--
static ConVar cl_extrapolate( "cl_extrapolate", "1", FCVAR_CHEAT, "Enable/disable extrapolation if interpolation history runs out." );
static ConVar cl_interpolate( "cl_interpolate", "1.0", FCVAR_CHEAT, "Interpolate entities on the client." );
//static ConVar cl_interp ( "cl_interp", "0.1", FCVAR_USERINFO | FCVAR_DEMO, "Interpolate object positions starting this many seconds in past", true, 0.01, true, 1.0, cc_cl_interp_changed );
static ConVar cl_interp_npcs( "cl_interp_npcs", "0.0", FCVAR_USERINFO, "Interpolate NPC positions starting this many seconds in past (or cl_interp, if greater)", 0, 0, 0, 0, cc_cl_interp_changed );
static ConVar cl_interp_all( "cl_interp_all", "0", 0, "Disable interpolation list optimizations.", 0, 0, 0, 0, cc_cl_interp_all_changed );
//APSFIXME - Temp until I fix
468469470471472473
RecvPropEHandle( RECVINFO(m_hEffectEntity) ),
RecvPropInt( RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent ),
RecvPropInt( RECVINFO( m_iParentAttachment ) ),
RecvPropInt( "movetype", 0, SIZEOF_IGNORE, 0, RecvProxy_MoveType ),
RecvPropInt( "movecollide", 0, SIZEOF_IGNORE, 0, RecvProxy_MoveCollide ),
471472473474475476477
RecvPropEHandle( RECVINFO(m_hEffectEntity) ),
RecvPropInt( RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent ),
RecvPropInt( RECVINFO( m_iParentAttachment ) ),
RecvPropInt(RECVINFO(m_takedamage), 0),
RecvPropInt( "movetype", 0, SIZEOF_IGNORE, 0, RecvProxy_MoveType ),
RecvPropInt( "movecollide", 0, SIZEOF_IGNORE, 0, RecvProxy_MoveCollide ),
821822823824825826827
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
825826827828829830
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
107810791080108110821083
UpdateOnRemove();
delete this;
}
1081108210831084108510861087
UpdateOnRemove();
PrintDeleteInfo();
delete this;
}
148514861487148814891490149114921493
// Purpose: Last received origin
// Output : const float
//-----------------------------------------------------------------------------
const Vector& C_BaseEntity::GetAbsOrigin( void ) const
{
Assert( s_bAbsQueriesValid );
const_cast(this)->CalcAbsolutePosition();
return m_vecAbsOrigin;
}
14891490149114921493149414951496149714981499150015011502
// Purpose: Last received origin
// Output : const float
//-----------------------------------------------------------------------------
ConVar sDebugAbsQueriesValid("ffdev_debugabsqueriesvalid", "0", FCVAR_CHEAT);
const Vector& C_BaseEntity::GetAbsOrigin( void ) const
{
if (!s_bAbsQueriesValid && sDebugAbsQueriesValid.GetBool())
Warning("!s_bAbsQueriesValid: %s\n", const_cast(this)->GetClassname());
Assert(s_bAbsQueriesValid);
const_cast(this)->CalcAbsolutePosition();
return m_vecAbsOrigin;
}
149915001501150215031504
//-----------------------------------------------------------------------------
const QAngle& C_BaseEntity::GetAbsAngles( void ) const
{
Assert( s_bAbsQueriesValid );
const_cast(this)->CalcAbsolutePosition();
return m_angAbsRotation;
150815091510151115121513151415151516
//-----------------------------------------------------------------------------
const QAngle& C_BaseEntity::GetAbsAngles( void ) const
{
if (!s_bAbsQueriesValid && sDebugAbsQueriesValid.GetBool())
Warning("!s_bAbsQueriesValid: %s\n", const_cast(this)->GetClassname());
Assert( s_bAbsQueriesValid );
const_cast(this)->CalcAbsolutePosition();
return m_angAbsRotation;
180918101811181218131814
else if (shouldCollide == ENTITY_SHOULD_RESPOND)
list |= PARTITION_CLIENT_RESPONSIVE_EDICTS;
// add the entity to the KD tree so we will collide against it
partition->RemoveAndInsert( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, list, CollisionProp()->GetPartitionHandle() );
}
1821182218231824182518261827182818291830
else if (shouldCollide == ENTITY_SHOULD_RESPOND)
list |= PARTITION_CLIENT_RESPONSIVE_EDICTS;
// HACKHACK: Fix to allow laser beam to shine off ragdolls
else if (shouldCollide == ENTITY_SHOULD_COLLIDE_RESPOND)
list |= PARTITION_CLIENT_SOLID_EDICTS|PARTITION_CLIENT_RESPONSIVE_EDICTS;
// add the entity to the KD tree so we will collide against it
partition->RemoveAndInsert( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, list, CollisionProp()->GetPartitionHandle() );
}
1917191819191920192119221923
// If the entity moves itself every FRAME on the server but doesn't update animtime,
// then use the current server time as the time for interpolation.
if ( !IsSelfAnimating() )
{
m_flAnimTime = engine->GetLastTimeStamp();
}
1933193419351936193719381939
// If the entity moves itself every FRAME on the server but doesn't update animtime,
// then use the current server time as the time for interpolation.
if ( !IsSelfAnimating() && !IsNPC() && !IsPlayer() ) // |-- Mirv: Apparently this fixes jittery anims
{
m_flAnimTime = engine->GetLastTimeStamp();
}
326232633264326532663267326832693270
//-----------------------------------------------------------------------------
// A method to apply a decal to an entity
//-----------------------------------------------------------------------------
void C_BaseEntity::AddDecal( const Vector& rayStart, const Vector& rayEnd,
const Vector& decalCenter, int hitbox, int decalIndex, bool doTrace, trace_t& tr, int maxLODToDecal )
{
Ray_t ray;
ray.Init( rayStart, rayEnd );
32783279328032813282328332843285328632873288328932903291329232933294
//-----------------------------------------------------------------------------
// A method to apply a decal to an entity
//-----------------------------------------------------------------------------
extern ConVar ffdev_disableentitydecals;
void C_BaseEntity::AddDecal( const Vector& rayStart, const Vector& rayEnd,
const Vector& decalCenter, int hitbox, int decalIndex, bool doTrace, trace_t& tr, int maxLODToDecal )
{
if(ffdev_disableentitydecals.GetBool())
{
if(Classify() != CLASS_NONE && Classify() < NUM_AI_CLASSES)
return;
}
Ray_t ray;
ray.Init( rayStart, rayEnd );
3392339333943395339633973398
// Purpose:
// Output : int
//-----------------------------------------------------------------------------
int C_BaseEntity::GetTeamNumber( void )
{
return m_iTeamNum;
}
3416341734183419342034213422
// Purpose:
// Output : int
//-----------------------------------------------------------------------------
int C_BaseEntity::GetTeamNumber( void ) const
{
return m_iTeamNum;
}
4369437043714372437343744375
}
}
return NULL;
}
// Try to create it
43934394439543964397439843994400
}
}
// Mirv: For predicted rockets...
//return NULL;
}
// Try to create it
52885289529052915292529352945295
//-------------------------------------
float C_BaseEntity::GetInterpolationAmount( int flags )
{
// If single player server is "skipping ticks" everything needs to interpolate for a bit longer
int serverTickMultiple = 1;
if ( IsSimulatingOnAlternateTicks() )
531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342
//-------------------------------------
static const ConVar *pUpdateRateCvar = NULL;
static const ConVar *pMaxUpdateRateCvar = NULL;
int nLastUpdateRate = 0;
float C_BaseEntity::GetInterpolationAmount( int flags )
{
// --> Mirv: Interpolation based on ratio
if (!pUpdateRateCvar || !pMaxUpdateRateCvar)
{
pUpdateRateCvar = cvar->FindVar("cl_updaterate");
pMaxUpdateRateCvar = cvar->FindVar("sv_maxupdaterate");
nLastUpdateRate = pUpdateRateCvar->GetFloat();
}
// Since it's not safe to hack in a handler we'll just have to test
// for the value changing here...
int nUpdateRate = min(pMaxUpdateRateCvar->GetInt(), pUpdateRateCvar->GetInt());
//if (nUpdateRate != nLastUpdateRate)
//{
// nLastUpdateRate = nUpdateRate;
// cc_cl_interp_changed(NULL, NULL);
//}
float flInterp = cl_interp_ratio.GetFloat() / nUpdateRate;
// <-- Mirv
// If single player server is "skipping ticks" everything needs to interpolate for a bit longer
int serverTickMultiple = 1;
if ( IsSimulatingOnAlternateTicks() )
5305530653075308530953105311
// Always fully interpolation in multiplayer or during demo playback...
if ( gpGlobals->maxClients > 1 || engine->IsPlayingDemo() )
{
return AdjustInterpolationAmount( this, TICKS_TO_TIME ( TIME_TO_TICKS( cl_interp.GetFloat() ) + serverTickMultiple ) );
}
if ( IsAnimatedEveryTick() && IsSimulatedEveryTick() )
5352535353545355535653575358
// Always fully interpolation in multiplayer or during demo playback...
if ( gpGlobals->maxClients > 1 || engine->IsPlayingDemo() )
{
return AdjustInterpolationAmount( this, TICKS_TO_TIME ( TIME_TO_TICKS( flInterp ) + serverTickMultiple ) ); // |-- Mirv: Use dynamic interp
}
if ( IsAnimatedEveryTick() && IsSimulatedEveryTick() )
5322532353245325532653275328
return TICK_INTERVAL * serverTickMultiple;
}
return AdjustInterpolationAmount( this, TICK_INTERVAL * ( TIME_TO_TICKS( cl_interp.GetFloat() ) + serverTickMultiple ) );
}
5369537053715372537353745375
return TICK_INTERVAL * serverTickMultiple;
}
return AdjustInterpolationAmount( this, TICK_INTERVAL * ( TIME_TO_TICKS( flInterp ) + serverTickMultiple ) ); // |-- Mirv: Use dynamic interp
}