add source-sdk-2013

This commit is contained in:
nillerusr
2022-03-01 23:00:42 +03:00
parent 88b8830e8b
commit edc8d6c584
3288 changed files with 3731 additions and 1062455 deletions
+70 -102
View File
@@ -41,10 +41,6 @@
#include "inetchannelinfo.h"
#include "proto_version.h"
#ifdef TF_CLIENT_DLL
#include "c_tf_player.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -80,7 +76,7 @@ void cc_cl_interp_all_changed( IConVar *pConVar, const char *pOldString, float f
static ConVar cl_extrapolate( "cl_extrapolate", "1", FCVAR_CHEAT, "Enable/disable extrapolation if interpolation history runs out." );
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)" );
static ConVar cl_interp_all( "cl_interp_all", "0", 0, "Disable interpolation list optimizations.", 0, 0, 0, 0, cc_cl_interp_all_changed );
ConVar r_drawmodeldecals( "r_drawmodeldecals", "1", FCVAR_ALLOWED_IN_COMPETITIVE );
ConVar r_drawmodeldecals( "r_drawmodeldecals", "1" );
extern ConVar cl_showerror;
int C_BaseEntity::m_nPredictionRandomSeed = -1;
C_BasePlayer *C_BaseEntity::m_pPredictionPlayer = NULL;
@@ -575,8 +571,7 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar )
{
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
Vector v0(0, 0, 0);
CApparentVelocity<Vector> apparent(v0);
CApparentVelocity<Vector> apparent;
float prevtime = 0.0f;
while ( 1 )
{
@@ -599,8 +594,7 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
Vector v0(0, 0, 0);
CApparentVelocity<Vector> apparent(v0);
CApparentVelocity<Vector> apparent;
float newtime = 999999.0f;
Vector newVec( 0, 0, 0 );
bool bSpew = true;
@@ -668,7 +662,7 @@ void SpewInterpolatedVar( CInterpolatedVar< float > *pVar )
{
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
CApparentVelocity<float> apparent(0.0f);
CApparentVelocity<float> apparent;
while ( 1 )
{
float changetime;
@@ -690,8 +684,7 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar<T> *pVar, float &flMin, float
flMax = -1e23;
int i = pVar->GetHead();
Vector v0(0, 0, 0);
CApparentVelocity<Vector> apparent(v0);
CApparentVelocity<Vector> apparent;
while ( 1 )
{
float changetime;
@@ -899,8 +892,6 @@ 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.
@@ -1154,13 +1145,6 @@ bool C_BaseEntity::InitializeAsClientEntityByIndex( int iIndex, RenderGroup_t re
return true;
}
void C_BaseEntity::TrackAngRotation( bool bTrack )
{
if ( bTrack )
AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR );
else
RemoveVar( &m_angRotation, false );
}
void C_BaseEntity::Term()
{
@@ -1315,6 +1299,19 @@ 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.
@@ -1749,9 +1746,9 @@ void C_BaseEntity::SetNetworkAngles( const QAngle& ang )
// Purpose:
// Input : index -
//-----------------------------------------------------------------------------
void C_BaseEntity::SetModelIndex( int index_ )
void C_BaseEntity::SetModelIndex( int index )
{
m_nModelIndex = index_;
m_nModelIndex = index;
const model_t *pModel = modelinfo->GetModel( m_nModelIndex );
SetModelPointer( pModel );
}
@@ -2043,7 +2040,7 @@ void C_BaseEntity::UpdatePartitionListEntry()
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() );
partition->RemoveAndInsert( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, list, CollisionProp()->GetPartitionHandle() );
}
@@ -2099,7 +2096,7 @@ void C_BaseEntity::NotifyShouldTransmit( ShouldTransmitState_t state )
SetDormant( true );
// remove the entity from the KD tree so we won't collide against it
::partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
}
break;
@@ -2173,7 +2170,6 @@ void C_BaseEntity::PreDataUpdate( DataUpdateType_t updateType )
}
m_ubOldInterpolationFrame = m_ubInterpolationFrame;
m_bOldShouldDraw = ShouldDraw();
}
const Vector& C_BaseEntity::GetOldOrigin()
@@ -2471,36 +2467,37 @@ void C_BaseEntity::UnlinkFromHierarchy()
void C_BaseEntity::ValidateModelIndex( void )
{
#ifdef TF_CLIENT_DLL
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_HALLOWEEN ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_PYRO ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_PYRO] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_PYRO] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_ROME ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_ROME] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_ROME] );
return;
}
}
if ( m_nModelIndexOverrides[VISION_MODE_NONE] > 0 )
{
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_HALLOWEEN ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_PYRO ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_PYRO] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_PYRO] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_ROME ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_ROME] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_ROME] );
return;
}
}
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_NONE] );
return;
}
#endif
@@ -2625,23 +2622,6 @@ void C_BaseEntity::PostDataUpdate( DataUpdateType_t updateType )
{
UpdateVisibility();
}
// if ShouldDraw state changes, recalculate visibility
if ( m_bOldShouldDraw != ShouldDraw() )
{
UpdateVisibility();
}
}
//-----------------------------------------------------------------------------
// Purpose: Latch simulation values when the entity has not changed
//-----------------------------------------------------------------------------
void C_BaseEntity::OnDataUnchangedInPVS()
{
Assert( m_hNetworkMoveParent.Get() || !m_hNetworkMoveParent.IsValid() );
HierarchySetParent(m_hNetworkMoveParent);
MarkMessageReceived();
}
//-----------------------------------------------------------------------------
@@ -3323,6 +3303,7 @@ void C_BaseEntity::ComputeFxBlend( void )
if ( m_nFXComputeFrame == gpGlobals->framecount )
return;
MDLCACHE_CRITICAL_SECTION();
int blend=0;
float offset;
@@ -3760,7 +3741,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd
case mod_brush:
{
color32 cColor32 = { (byte)cColor.r(), (byte)cColor.g(), (byte)cColor.b(), (byte)cColor.a() };
color32 cColor32 = { cColor.r(), cColor.g(), cColor.b(), cColor.a() };
effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
}
break;
@@ -3859,7 +3840,7 @@ void C_BaseEntity::operator delete( void *pMem )
//========================================================================================
// TEAM HANDLING
//========================================================================================
C_Team *C_BaseEntity::GetTeam( void ) const
C_Team *C_BaseEntity::GetTeam( void )
{
return GetGlobalTeam( m_iTeamNum );
}
@@ -3884,7 +3865,7 @@ int C_BaseEntity::GetRenderTeamNumber( void )
//-----------------------------------------------------------------------------
// Purpose: Returns true if these entities are both in at least one team together
//-----------------------------------------------------------------------------
bool C_BaseEntity::InSameTeam( const C_BaseEntity *pEntity ) const
bool C_BaseEntity::InSameTeam( C_BaseEntity *pEntity )
{
if ( !pEntity )
return false;
@@ -5598,22 +5579,16 @@ void C_BaseEntity::DrawBBoxVisualizations( void )
{
if ( m_fBBoxVisFlags & VISUALIZE_COLLISION_BOUNDS )
{
if ( debugoverlay )
{
debugoverlay->AddBoxOverlay( CollisionProp()->GetCollisionOrigin(), CollisionProp()->OBBMins(),
CollisionProp()->OBBMaxs(), CollisionProp()->GetCollisionAngles(), 190, 190, 0, 0, 0.01 );
}
debugoverlay->AddBoxOverlay( CollisionProp()->GetCollisionOrigin(), CollisionProp()->OBBMins(),
CollisionProp()->OBBMaxs(), CollisionProp()->GetCollisionAngles(), 190, 190, 0, 0, 0.01 );
}
if ( m_fBBoxVisFlags & VISUALIZE_SURROUNDING_BOUNDS )
{
Vector vecSurroundMins, vecSurroundMaxs;
CollisionProp()->WorldSpaceSurroundingBounds( &vecSurroundMins, &vecSurroundMaxs );
if ( debugoverlay )
{
debugoverlay->AddBoxOverlay( vec3_origin, vecSurroundMins,
vecSurroundMaxs, vec3_angle, 0, 255, 255, 0, 0.01 );
}
debugoverlay->AddBoxOverlay( vec3_origin, vecSurroundMins,
vecSurroundMaxs, vec3_angle, 0, 255, 255, 0, 0.01 );
}
if ( m_fBBoxVisFlags & VISUALIZE_RENDER_BOUNDS || r_drawrenderboxes.GetInt() )
@@ -5645,6 +5620,13 @@ RenderGroup_t C_BaseEntity::GetRenderGroup()
if ( m_nRenderMode == kRenderNone )
return RENDER_GROUP_OPAQUE_ENTITY;
// When an entity has a material proxy, we have to recompute
// translucency here because the proxy may have changed it.
if (modelinfo->ModelHasMaterialProxy( GetModel() ))
{
modelinfo->RecomputeTranslucency( const_cast<model_t*>(GetModel()), GetSkin(), GetBody(), GetClientRenderable() );
}
// NOTE: Bypassing the GetFXBlend protection logic because we want this to
// be able to be called from AddToLeafSystem.
int nTempComputeFrame = m_nFXComputeFrame;
@@ -6302,14 +6284,10 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
return true;
// Some wearables parent to the view model
C_TFPlayer *pPlayer = ToTFPlayer( pParent );
if ( pPlayer )
C_BasePlayer *pPlayer = ToBasePlayer( pParent );
if ( pPlayer && pPlayer->GetViewModel() == this )
{
if ( pPlayer->GetViewModel() == this )
return true;
if ( pPlayer->HasItem() && ( pPlayer->GetItem()->GetItemID() == TF_ITEM_CAPTURE_FLAG ) && ( pPlayer->GetItem() == this ) )
return true;
return true;
}
// always allow the briefcase model
@@ -6318,12 +6296,12 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
{
if ( FStrEq( pszModel, "models/flag/briefcase.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/props_doomsday/australium_container.mdl" ) )
return true;
// Temp for MVM testing
if ( FStrEq( pszModel, "models/buildables/sapper_placement.mdl" ) )
if ( FStrEq( pszModel, "models/buildables/sapper_placement_sentry1.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/props_td/atom_bomb.mdl" ) )
@@ -6331,16 +6309,6 @@ 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;
// The Halloween 2014 doomsday flag replacement
if ( FStrEq( pszModel, "models/flag/ticket_case.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/weapons/c_models/c_grapple_proj/c_grapple_proj.mdl" ) )
return true;
}
// Any entity that's not an item parented to a player is invalid.