aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/c_baseentity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/game/client/c_baseentity.cpp')
-rw-r--r--mp/src/game/client/c_baseentity.cpp50
1 files changed, 32 insertions, 18 deletions
diff --git a/mp/src/game/client/c_baseentity.cpp b/mp/src/game/client/c_baseentity.cpp
index 8f40d7ef..25b089cd 100644
--- a/mp/src/game/client/c_baseentity.cpp
+++ b/mp/src/game/client/c_baseentity.cpp
@@ -571,7 +571,8 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar )
{
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
- CApparentVelocity<Vector> apparent;
+ Vector v0(0, 0, 0);
+ CApparentVelocity<Vector> apparent(v0);
float prevtime = 0.0f;
while ( 1 )
{
@@ -594,7 +595,8 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
- CApparentVelocity<Vector> apparent;
+ Vector v0(0, 0, 0);
+ CApparentVelocity<Vector> apparent(v0);
float newtime = 999999.0f;
Vector newVec( 0, 0, 0 );
bool bSpew = true;
@@ -662,7 +664,7 @@ void SpewInterpolatedVar( CInterpolatedVar< float > *pVar )
{
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
- CApparentVelocity<float> apparent;
+ CApparentVelocity<float> apparent(0.0f);
while ( 1 )
{
float changetime;
@@ -684,7 +686,8 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar<T> *pVar, float &flMin, float
flMax = -1e23;
int i = pVar->GetHead();
- CApparentVelocity<Vector> apparent;
+ Vector v0(0, 0, 0);
+ CApparentVelocity<Vector> apparent(v0);
while ( 1 )
{
float changetime;
@@ -892,6 +895,8 @@ C_BaseEntity::C_BaseEntity() :
m_iv_angRotation( "C_BaseEntity::m_iv_angRotation" ),
m_iv_vecVelocity( "C_BaseEntity::m_iv_vecVelocity" )
{
+ m_pAttributes = NULL;
+
AddVar( &m_vecOrigin, &m_iv_vecOrigin, LATCH_SIMULATION_VAR );
AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR );
// Removing this until we figure out why velocity introduces view hitching.
@@ -1299,19 +1304,6 @@ bool C_BaseEntity::VPhysicsIsFlesh( void )
return false;
}
-//-----------------------------------------------------------------------------
-// Returns the health fraction
-//-----------------------------------------------------------------------------
-float C_BaseEntity::HealthFraction() const
-{
- if (GetMaxHealth() == 0)
- return 1.0f;
-
- float flFraction = (float)GetHealth() / (float)GetMaxHealth();
- flFraction = clamp( flFraction, 0.0f, 1.0f );
- return flFraction;
-}
-
//-----------------------------------------------------------------------------
// Purpose: Retrieves the coordinate frame for this entity.
@@ -2625,6 +2617,25 @@ void C_BaseEntity::PostDataUpdate( DataUpdateType_t updateType )
}
//-----------------------------------------------------------------------------
+// Purpose: Latch simulation values when the entity has not changed
+//-----------------------------------------------------------------------------
+void C_BaseEntity::OnDataUnchangedInPVS()
+{
+ Interp_RestoreToLastNetworked( GetVarMapping() );
+
+ // For non-predicted and non-client only ents, we need to latch network values into the interpolation histories
+ if ( !GetPredictable() && !IsClientCreated() )
+ {
+ OnLatchInterpolatedVariables( LATCH_SIMULATION_VAR );
+ }
+
+ Assert( m_hNetworkMoveParent.Get() || !m_hNetworkMoveParent.IsValid() );
+ HierarchySetParent(m_hNetworkMoveParent);
+
+ MarkMessageReceived();
+}
+
+//-----------------------------------------------------------------------------
// Purpose:
// Input : *context -
//-----------------------------------------------------------------------------
@@ -3741,7 +3752,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd
case mod_brush:
{
- color32 cColor32 = { cColor.r(), cColor.g(), cColor.b(), cColor.a() };
+ color32 cColor32 = { (byte)cColor.r(), (byte)cColor.g(), (byte)cColor.b(), (byte)cColor.a() };
effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
}
break;
@@ -6309,6 +6320,9 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
if ( FStrEq( pszModel, "models/props_lakeside_event/bomb_temp_hat.mdl" ) )
return true;
+
+ if ( FStrEq( pszModel, "models/props_moonbase/powersupply_flag.mdl" ) )
+ return true;
}
// Any entity that's not an item parented to a player is invalid.