//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void C_TEConcussiveExplosion::PostDataUpdate( DataUpdateType_t updateType ) { AffectRagdolls(); FX_ConcussiveExplosion( m_vecOrigin, m_vecNormal ); RecordConcussiveExplosion( m_vecOrigin, m_vecNormal ); }
//----------------------------------------------------------------------------- // Purpose: // Input : bool - //----------------------------------------------------------------------------- void C_TEExplosion::PostDataUpdate( DataUpdateType_t updateType ) { RecordExplosion(); AffectRagdolls(); // Filter out a water explosion if ( UTIL_PointContents( m_vecOrigin, MASK_WATER ) & CONTENTS_WATER ) { WaterExplosionEffect().Create( m_vecOrigin, m_nMagnitude, m_fScale, m_nFlags ); return; } if ( !( m_nFlags & TE_EXPLFLAG_NOFIREBALL ) ) { if ( CExplosionOverlay *pOverlay = new CExplosionOverlay ) { pOverlay->m_flLifetime = 0; pOverlay->m_vPos = m_vecOrigin; pOverlay->m_nSprites = 1; pOverlay->m_vBaseColors[0].Init( 1.0f, 0.9f, 0.7f ); pOverlay->m_Sprites[0].m_flHorzSize = 0.05f; pOverlay->m_Sprites[0].m_flVertSize = pOverlay->m_Sprites[0].m_flHorzSize*0.5f; pOverlay->Activate(); } } BaseExplosionEffect().Create( m_vecOrigin, m_nMagnitude, m_fScale, m_nFlags ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool Impact( Vector &vecOrigin, Vector &vecStart, int iMaterial, int iDamageType, int iHitbox, int iEntIndex, trace_t &tr, bool bDecal, int maxLODToDecal ) { // Clear out the trace memset( &tr, 0, sizeof(trace_t)); tr.fraction = 1.f; // Setup our shot information Vector shotDir = vecOrigin - vecStart; float flLength = VectorNormalize( shotDir ); Vector traceExt; VectorMA( vecStart, flLength + 8.0f, shotDir, traceExt ); // Attempt to hit ragdolls bool bHitRagdoll = AffectRagdolls( vecOrigin, vecStart, iDamageType ); // Get the entity we hit, according to the server C_BaseEntity *pEntity = ClientEntityList().GetEnt( iEntIndex ); if ( bDecal ) { int decalNumber = decalsystem->GetDecalIndexForName( GetImpactDecal( pEntity, iMaterial, iDamageType ) ); if ( decalNumber == -1 ) return false; if ( (iEntIndex == 0) && (iHitbox != 0) ) { // Special case for world entity with hitbox (that's a static prop): // In this case, we've hit a static prop. Decal it! staticpropmgr->AddDecalToStaticProp( vecStart, traceExt, iHitbox - 1, decalNumber, true, tr ); } else if ( pEntity ) { // Here we deal with decals on entities. pEntity->AddDecal( vecStart, traceExt, vecOrigin, iHitbox, decalNumber, true, tr, maxLODToDecal ); } } else { // Perform the trace ourselves Ray_t ray; ray.Init( vecStart, traceExt ); enginetrace->ClipRayToEntity( ray, MASK_SHOT, pEntity, &tr ); } // If we found the surface, emit debris flecks if ( ( tr.fraction == 1.0f ) || ( bHitRagdoll ) ) return false; return true; }