mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-08 19:12:51 +00:00
fix potential crashes with func_clip_vphysics
This commit is contained in:
parent
aea94b32cb
commit
ab492f7ede
1 changed files with 24 additions and 5 deletions
|
@ -1418,7 +1418,12 @@ void CFuncVPhysicsClip::Spawn( void )
|
|||
SetModel( STRING( GetModelName() ) );
|
||||
AddEffects( EF_NODRAW );
|
||||
CreateVPhysics();
|
||||
VPhysicsGetObject()->EnableCollisions( !m_bDisabled );
|
||||
|
||||
IPhysicsObject *pPhys = VPhysicsGetObject();
|
||||
if ( pPhys )
|
||||
{
|
||||
pPhys->EnableCollisions( !m_bDisabled );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1446,8 +1451,14 @@ bool CFuncVPhysicsClip::EntityPassesFilter( CBaseEntity *pOther )
|
|||
if ( pFilter )
|
||||
return pFilter->PassesFilter( this, pOther );
|
||||
|
||||
if ( pOther->GetMoveType() == MOVETYPE_VPHYSICS && pOther->VPhysicsGetObject()->IsMoveable() )
|
||||
return true;
|
||||
if ( pOther->GetMoveType() == MOVETYPE_VPHYSICS )
|
||||
{
|
||||
IPhysicsObject* pPhys = pOther->VPhysicsGetObject();
|
||||
if ( pPhys && pPhys->IsMoveable() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1460,12 +1471,20 @@ bool CFuncVPhysicsClip::ForceVPhysicsCollide( CBaseEntity *pEntity )
|
|||
|
||||
void CFuncVPhysicsClip::InputEnable( inputdata_t &inputdata )
|
||||
{
|
||||
VPhysicsGetObject()->EnableCollisions(true);
|
||||
IPhysicsObject *pPhys = VPhysicsGetObject();
|
||||
if ( pPhys )
|
||||
{
|
||||
pPhys->EnableCollisions( true );
|
||||
}
|
||||
m_bDisabled = false;
|
||||
}
|
||||
|
||||
void CFuncVPhysicsClip::InputDisable( inputdata_t &inputdata )
|
||||
{
|
||||
VPhysicsGetObject()->EnableCollisions(false);
|
||||
IPhysicsObject *pPhys = VPhysicsGetObject();
|
||||
if ( pPhys )
|
||||
{
|
||||
pPhys->EnableCollisions( false );
|
||||
}
|
||||
m_bDisabled = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue