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
+59 -75
View File
@@ -86,7 +86,6 @@ bool CBaseEntity::sm_bDisableTouchFuncs = false; // Disables PhysicsTouch and Ph
bool CBaseEntity::sm_bAccurateTriggerBboxChecks = true; // set to false for legacy behavior in ep1
int CBaseEntity::m_nPredictionRandomSeed = -1;
int CBaseEntity::m_nPredictionRandomSeedServer = -1;
CBasePlayer *CBaseEntity::m_pPredictionPlayer = NULL;
// Used to make sure nobody calls UpdateTransmitState directly.
@@ -95,6 +94,7 @@ int g_nInsideDispatchUpdateTransmitState = 0;
// When this is false, throw an assert in debug when GetAbsAnything is called. Used when hierachy is incomplete/invalid.
bool CBaseEntity::s_bAbsQueriesValid = true;
ConVar sv_netvisdist( "sv_netvisdist", "10000", FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY, "Test networking visibility distance" );
// This table encodes edict data.
@@ -344,8 +344,6 @@ void CBaseEntityModelLoadProxy::Handler::OnModelLoadComplete( const model_t *pMo
CBaseEntity::CBaseEntity( bool bServerOnly )
{
m_pAttributes = NULL;
COMPILE_TIME_ASSERT( MOVETYPE_LAST < (1 << MOVETYPE_MAX_BITS) );
COMPILE_TIME_ASSERT( MOVECOLLIDE_COUNT < (1 << MOVECOLLIDE_MAX_BITS) );
@@ -414,8 +412,6 @@ CBaseEntity::CBaseEntity( bool bServerOnly )
#ifndef _XBOX
AddEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID );
#endif
m_bTruceValidForEnt = false;
}
//-----------------------------------------------------------------------------
@@ -1442,10 +1438,10 @@ int CBaseEntity::OnTakeDamage( const CTakeDamageInfo &info )
//-----------------------------------------------------------------------------
// Purpose: Scale damage done and call OnTakeDamage
//-----------------------------------------------------------------------------
int CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
void CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
{
if ( !g_pGameRules )
return 0;
return;
bool bHasPhysicsForceDamage = !g_pGameRules->Damage_NoPhysicsForce( inputInfo.GetDamageType() );
if ( bHasPhysicsForceDamage && inputInfo.GetDamageType() != DMG_GENERIC )
@@ -1477,12 +1473,12 @@ int CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
// Make sure our damage filter allows the damage.
if ( !PassesDamageFilter( inputInfo ))
{
return 0;
return;
}
if( !g_pGameRules->AllowDamage(this, inputInfo) )
{
return 0;
return;
}
if ( PhysIsInCallback() )
@@ -1504,9 +1500,8 @@ int CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
//Msg("%s took %.2f Damage, at %.2f\n", GetClassname(), info.GetDamage(), gpGlobals->curtime );
return OnTakeDamage( info );
OnTakeDamage( info );
}
return 0;
}
//-----------------------------------------------------------------------------
@@ -4339,7 +4334,7 @@ CTeam *CBaseEntity::GetTeam( void ) const
//-----------------------------------------------------------------------------
// Purpose: Returns true if these players are both in at least one team together
//-----------------------------------------------------------------------------
bool CBaseEntity::InSameTeam( const CBaseEntity *pEntity ) const
bool CBaseEntity::InSameTeam( CBaseEntity *pEntity ) const
{
if ( !pEntity )
return false;
@@ -4827,7 +4822,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex )
char token[256];
const char *pOptions = pEvent->pszOptions();
nexttoken( token, pOptions, ' ' );
if ( token[0] )
if ( token )
{
PrecacheParticleSystem( token );
}
@@ -4913,9 +4908,7 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload )
{
if ( !name || !*name )
{
#ifdef STAGING_ONLY
Msg( "Attempting to precache model, but model name is NULL\n");
#endif
return -1;
}
@@ -4924,7 +4917,8 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload )
{
if ( !engine->IsModelPrecached( name ) )
{
DevMsg( "Late precache of %s -- not necessarily a bug now that we allow ~everything to be dynamically loaded.\n", name );
Assert( !"CBaseEntity::PrecacheModel: too late" );
Warning( "Late precache of %s\n", name );
}
}
#if defined( WATCHACCESS )
@@ -5734,53 +5728,42 @@ void CBaseEntity::CalcAbsolutePosition( void )
if (!IsEFlagSet( EFL_DIRTY_ABSTRANSFORM ))
return;
RemoveEFlags( EFL_DIRTY_ABSTRANSFORM );
// Plop the entity->parent matrix into m_rgflCoordinateFrame
AngleMatrix( m_angRotation, m_vecOrigin, m_rgflCoordinateFrame );
CBaseEntity *pMoveParent = GetMoveParent();
if ( !pMoveParent )
{
AUTO_LOCK( m_CalcAbsolutePositionMutex );
// Test again under the lock, in case another thread did the work in the interim
if ( !IsEFlagSet( EFL_DIRTY_ABSTRANSFORM ) )
// no move parent, so just copy existing values
m_vecAbsOrigin = m_vecOrigin;
m_angAbsRotation = m_angRotation;
if ( HasDataObjectType( POSITIONWATCHER ) )
{
return;
ReportPositionChanged( this );
}
// Plop the entity->parent matrix into m_rgflCoordinateFrame
AngleMatrix( m_angRotation, m_vecOrigin, m_rgflCoordinateFrame );
CBaseEntity *pMoveParent = GetMoveParent();
if ( !pMoveParent )
{
// no move parent, so just copy existing values
m_vecAbsOrigin = m_vecOrigin;
m_angAbsRotation = m_angRotation;
}
else
{
// concatenate with our parent's transform
matrix3x4_t tmpMatrix, scratchSpace;
ConcatTransforms( GetParentToWorldTransform( scratchSpace ), m_rgflCoordinateFrame, tmpMatrix );
MatrixCopy( tmpMatrix, m_rgflCoordinateFrame );
// pull our absolute position out of the matrix
MatrixGetColumn( m_rgflCoordinateFrame, 3, m_vecAbsOrigin );
// if we have any angles, we have to extract our absolute angles from our matrix
if ( ( m_angRotation == vec3_angle ) && ( m_iParentAttachment == 0 ) )
{
// just copy our parent's absolute angles
VectorCopy( pMoveParent->GetAbsAngles(), m_angAbsRotation );
}
else
{
MatrixAngles( m_rgflCoordinateFrame, m_angAbsRotation );
}
}
ThreadMemoryBarrier();
RemoveEFlags( EFL_DIRTY_ABSTRANSFORM );
return;
}
// Do this callback *after* we have updated the position, and (importantly) after we clear the dirty flag, because this callback can potentially
// end up recursively calling back in here, so the dirty flag must be cleared to break the recursion in that case.
// concatenate with our parent's transform
matrix3x4_t tmpMatrix, scratchSpace;
ConcatTransforms( GetParentToWorldTransform( scratchSpace ), m_rgflCoordinateFrame, tmpMatrix );
MatrixCopy( tmpMatrix, m_rgflCoordinateFrame );
// pull our absolute position out of the matrix
MatrixGetColumn( m_rgflCoordinateFrame, 3, m_vecAbsOrigin );
// if we have any angles, we have to extract our absolute angles from our matrix
if (( m_angRotation == vec3_angle ) && ( m_iParentAttachment == 0 ))
{
// just copy our parent's absolute angles
VectorCopy( pMoveParent->GetAbsAngles(), m_angAbsRotation );
}
else
{
MatrixAngles( m_rgflCoordinateFrame, m_angAbsRotation );
}
if ( HasDataObjectType( POSITIONWATCHER ) )
{
ReportPositionChanged( this );
@@ -6103,7 +6086,7 @@ void CBaseEntity::SetLocalAngles( const QAngle& angles )
{
Warning( "Bad SetLocalAngles(%f,%f,%f) on %s\n", angles.x, angles.y, angles.z, GetDebugName() );
}
AssertMsg( false, "Bad SetLocalAngles(%f,%f,%f) on %s\n", angles.x, angles.y, angles.z, GetDebugName() );
Assert( false );
return;
}
@@ -6668,19 +6651,23 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
AI_Response result;
bool found = rs->FindBestResponse( set, result );
if ( !found )
{
return;
}
// Handle the response here...
const char *szResponse = result.GetResponsePtr();
char response[ 256 ];
result.GetResponse( response, sizeof( response ) );
switch ( result.GetType() )
{
case RESPONSE_SPEAK:
EmitSound( szResponse );
{
EmitSound( response );
}
break;
case RESPONSE_SENTENCE:
{
int sentenceIndex = SENTENCEG_Lookup( szResponse );
int sentenceIndex = SENTENCEG_Lookup( response );
if( sentenceIndex == -1 )
{
// sentence not found
@@ -6692,13 +6679,16 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
CBaseEntity::EmitSentenceByIndex( filter, entindex(), CHAN_VOICE, sentenceIndex, 1, result.GetSoundLevel(), 0, PITCH_NORM );
}
break;
case RESPONSE_SCENE:
// Try to fire scene w/o an actor
InstancedScriptedScene( NULL, szResponse );
{
// Try to fire scene w/o an actor
InstancedScriptedScene( NULL, response );
}
break;
case RESPONSE_PRINT:
{
}
break;
default:
// Don't know how to handle .vcds!!!
@@ -7056,7 +7046,7 @@ void CBaseEntity::SetRefEHandle( const CBaseHandle &handle )
if ( edict() )
{
COMPILE_TIME_ASSERT( NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS <= 8*sizeof( edict()->m_NetworkSerialNumber ) );
edict()->m_NetworkSerialNumber = m_RefEHandle.GetSerialNumber() & ( (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1 );
edict()->m_NetworkSerialNumber = (m_RefEHandle.GetSerialNumber() & (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1);
}
}
@@ -7414,19 +7404,13 @@ bool CC_GetCommandEnt( const CCommand& args, CBaseEntity **ent, Vector *vecTarge
}
CBasePlayer *pPlayer = UTIL_GetCommandClient();
if ( !pPlayer )
{
Msg( "Command must originate from a player\n" );
return false;
}
if ( vecTargetPoint )
{
trace_t tr;
Vector forward;
pPlayer->EyeVectors( &forward );
UTIL_TraceLine(pPlayer->EyePosition(),
pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_NPCSOLID,
pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_NPCSOLID,
pPlayer, COLLISION_GROUP_NONE, &tr );
if ( tr.fraction != 1.0 )