Merge branch 'master' into windows

This commit is contained in:
HappyDOGE
2022-07-27 12:58:56 +03:00
3089 changed files with 38639 additions and 844820 deletions
+107 -138
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.
@@ -912,6 +903,7 @@ C_BaseEntity::C_BaseEntity() :
m_DataChangeEventRef = -1;
m_EntClientFlags = 0;
m_bEnableRenderingClipPlane = false;
m_iParentAttachment = 0;
m_nRenderFXBlend = 255;
@@ -949,10 +941,12 @@ C_BaseEntity::C_BaseEntity() :
#if !defined( NO_ENTITY_PREDICTION )
m_pPredictionContext = NULL;
#endif
//NOTE: not virtual! we are in the constructor!
C_BaseEntity::Clear();
SetModelName( NULL_STRING );
m_iClassname = NULL_STRING;
m_InterpolationListEntry = 0xFFFF;
m_TeleportListEntry = 0xFFFF;
@@ -993,7 +987,6 @@ C_BaseEntity::~C_BaseEntity()
void C_BaseEntity::Clear( void )
{
m_bDormant = true;
m_nCreationTick = -1;
m_RefEHandle.Term();
m_ModelInstance = MODEL_INSTANCE_INVALID;
@@ -1007,6 +1000,7 @@ void C_BaseEntity::Clear( void )
SetLocalOrigin( vec3_origin );
SetLocalAngles( vec3_angle );
model = NULL;
m_pOriginalData = NULL;
m_vecAbsOrigin.Init();
m_angAbsRotation.Init();
m_vecVelocity.Init();
@@ -1154,13 +1148,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 +1302,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 +1749,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 +2043,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 +2099,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 +2173,6 @@ void C_BaseEntity::PreDataUpdate( DataUpdateType_t updateType )
}
m_ubOldInterpolationFrame = m_ubInterpolationFrame;
m_bOldShouldDraw = ShouldDraw();
}
const Vector& C_BaseEntity::GetOldOrigin()
@@ -2471,36 +2470,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 +2625,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 +3306,7 @@ void C_BaseEntity::ComputeFxBlend( void )
if ( m_nFXComputeFrame == gpGlobals->framecount )
return;
MDLCACHE_CRITICAL_SECTION();
int blend=0;
float offset;
@@ -3760,7 +3744,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 = { (uint8)cColor.r(), (uint8)cColor.g(), (uint8)cColor.b(), (uint8)cColor.a() };
effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
}
break;
@@ -3859,7 +3843,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 +3868,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;
@@ -5318,43 +5302,41 @@ int C_BaseEntity::GetIntermediateDataSize( void )
static int g_FieldSizes[FIELD_TYPECOUNT] =
{
0, // FIELD_VOID
sizeof(float), // FIELD_FLOAT
sizeof(int), // FIELD_STRING
sizeof(Vector), // FIELD_VECTOR
sizeof(Quaternion), // FIELD_QUATERNION
sizeof(int), // FIELD_INTEGER
sizeof(char), // FIELD_BOOLEAN
sizeof(short), // FIELD_SHORT
sizeof(char), // FIELD_CHARACTER
sizeof(color32), // FIELD_COLOR32
sizeof(int), // FIELD_EMBEDDED (handled specially)
sizeof(int), // FIELD_CUSTOM (handled specially)
FIELD_SIZE( FIELD_VOID ),
FIELD_SIZE( FIELD_FLOAT ),
FIELD_SIZE( FIELD_STRING ),
FIELD_SIZE( FIELD_VECTOR ),
FIELD_SIZE( FIELD_QUATERNION ),
FIELD_SIZE( FIELD_INTEGER ),
FIELD_SIZE( FIELD_BOOLEAN ),
FIELD_SIZE( FIELD_SHORT ),
FIELD_SIZE( FIELD_CHARACTER ),
FIELD_SIZE( FIELD_COLOR32 ),
FIELD_SIZE( FIELD_EMBEDDED ),
FIELD_SIZE( FIELD_CUSTOM ),
//---------------------------------
FIELD_SIZE( FIELD_CLASSPTR ),
FIELD_SIZE( FIELD_EHANDLE ),
FIELD_SIZE( FIELD_EDICT ),
sizeof(int), // FIELD_CLASSPTR
sizeof(EHANDLE), // FIELD_EHANDLE
sizeof(int), // FIELD_EDICT
FIELD_SIZE( FIELD_POSITION_VECTOR ),
FIELD_SIZE( FIELD_TIME ),
FIELD_SIZE( FIELD_TICK ),
FIELD_SIZE( FIELD_MODELNAME ),
FIELD_SIZE( FIELD_SOUNDNAME ),
sizeof(Vector), // FIELD_POSITION_VECTOR
sizeof(float), // FIELD_TIME
sizeof(int), // FIELD_TICK
sizeof(int), // FIELD_MODELNAME
sizeof(int), // FIELD_SOUNDNAME
FIELD_SIZE( FIELD_INPUT ),
FIELD_SIZE( FIELD_FUNCTION ),
FIELD_SIZE( FIELD_VMATRIX ),
FIELD_SIZE( FIELD_VMATRIX_WORLDSPACE ),
FIELD_SIZE( FIELD_MATRIX3X4_WORLDSPACE ),
FIELD_SIZE( FIELD_INTERVAL ),
FIELD_SIZE( FIELD_MODELINDEX ),
FIELD_SIZE( FIELD_MATERIALINDEX ),
sizeof(int), // FIELD_INPUT (uses custom type)
#ifdef GNUC
// pointer to members under gnuc are 8bytes if you have a virtual func
sizeof(uint64), // FIELD_FUNCTION
#else
sizeof(int *), // FIELD_FUNCTION
#endif
sizeof(VMatrix), // FIELD_VMATRIX
sizeof(VMatrix), // FIELD_VMATRIX_WORLDSPACE
sizeof(matrix3x4_t),// FIELD_MATRIX3X4_WORLDSPACE // NOTE: Use array(FIELD_FLOAT, 12) for matrix3x4_t NOT in worldspace
sizeof(interval_t), // FIELD_INTERVAL
sizeof(int), // FIELD_MODELINDEX
FIELD_SIZE( FIELD_VECTOR2D ),
FIELD_SIZE( FIELD_INTEGER64 ),
FIELD_SIZE( FIELD_POINTER ),
};
//-----------------------------------------------------------------------------
@@ -5598,22 +5580,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 +5621,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 +6285,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 +6297,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 +6310,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.