void TE_ShatterSurface( IRecipientFilter& filter, float delay, KeyValues *pKeyValues ) { Vector vecOrigin, vecForce, vecForcePos; QAngle angles; vecOrigin.x = pKeyValues->GetFloat( "originx" ); vecOrigin.y = pKeyValues->GetFloat( "originy" ); vecOrigin.z = pKeyValues->GetFloat( "originz" ); angles.x = pKeyValues->GetFloat( "anglesx" ); angles.y = pKeyValues->GetFloat( "anglesy" ); angles.z = pKeyValues->GetFloat( "anglesz" ); vecForce.x = pKeyValues->GetFloat( "forcex" ); vecForce.y = pKeyValues->GetFloat( "forcey" ); vecForce.z = pKeyValues->GetFloat( "forcez" ); vecForcePos.x = pKeyValues->GetFloat( "forceposx" ); vecForcePos.y = pKeyValues->GetFloat( "forceposy" ); vecForcePos.z = pKeyValues->GetFloat( "forceposz" ); Color front = pKeyValues->GetColor( "frontcolor" ); Color back = pKeyValues->GetColor( "backcolor" ); float flWidth = pKeyValues->GetFloat( "width" ); float flHeight = pKeyValues->GetFloat( "height" ); float flSize = pKeyValues->GetFloat( "size" ); ShatterSurface_t nSurfaceType = (ShatterSurface_t)pKeyValues->GetInt( "surfacetype" ); TE_ShatterSurface( filter, 0.0f, &vecOrigin, &angles, &vecForce, &vecForcePos, flWidth, flHeight, flSize, nSurfaceType, front.r(), front.g(), front.b(), back.r(), back.g(), back.b() ); }
virtual void ShatterSurface( IRecipientFilter& filter, float delay, const Vector* pos, const QAngle* angle, const Vector* vForce, const Vector* vForcePos, float width, float height, float shardsize, ShatterSurface_t surfacetype, int front_r, int front_g, int front_b, int back_r, int back_g, int back_b) { if ( !SuppressTE( filter ) ) { TE_ShatterSurface( filter, delay, pos, angle, vForce, vForcePos, width, height, shardsize, surfacetype, front_r, front_g, front_b, back_r, back_g, back_b ); } }
// For playback from external tools virtual void TriggerTempEntity( KeyValues *pKeyValues ) { g_pEffects->SuppressEffectsSounds( true ); SuppressParticleEffects( true ); // While playing back, suppress recording bool bIsRecording = clienttools->IsInRecordingMode(); clienttools->EnableRecordingMode( false ); CBroadcastRecipientFilter filter; TERecordingType_t type = (TERecordingType_t)pKeyValues->GetInt( "te" ); switch( type ) { case TE_DYNAMIC_LIGHT: TE_DynamicLight( filter, 0.0f, pKeyValues ); break; case TE_WORLD_DECAL: TE_WorldDecal( filter, 0.0f, pKeyValues ); break; case TE_DISPATCH_EFFECT: DispatchEffect( filter, 0.0f, pKeyValues ); break; case TE_MUZZLE_FLASH: { Vector vecOrigin; QAngle angles; vecOrigin.x = pKeyValues->GetFloat( "originx" ); vecOrigin.y = pKeyValues->GetFloat( "originy" ); vecOrigin.z = pKeyValues->GetFloat( "originz" ); angles.x = pKeyValues->GetFloat( "anglesx" ); angles.y = pKeyValues->GetFloat( "anglesy" ); angles.z = pKeyValues->GetFloat( "anglesz" ); float flScale = pKeyValues->GetFloat( "scale" ); int nType = pKeyValues->GetInt( "type" ); TE_MuzzleFlash( filter, 0.0f, vecOrigin, angles, flScale, nType ); } break; case TE_ARMOR_RICOCHET: { Vector vecOrigin, vecDirection; vecOrigin.x = pKeyValues->GetFloat( "originx" ); vecOrigin.y = pKeyValues->GetFloat( "originy" ); vecOrigin.z = pKeyValues->GetFloat( "originz" ); vecDirection.x = pKeyValues->GetFloat( "directionx" ); vecDirection.y = pKeyValues->GetFloat( "directiony" ); vecDirection.z = pKeyValues->GetFloat( "directionz" ); TE_ArmorRicochet( filter, 0.0f, &vecOrigin, &vecDirection ); } break; case TE_METAL_SPARKS: { Vector vecOrigin, vecDirection; vecOrigin.x = pKeyValues->GetFloat( "originx" ); vecOrigin.y = pKeyValues->GetFloat( "originy" ); vecOrigin.z = pKeyValues->GetFloat( "originz" ); vecDirection.x = pKeyValues->GetFloat( "directionx" ); vecDirection.y = pKeyValues->GetFloat( "directiony" ); vecDirection.z = pKeyValues->GetFloat( "directionz" ); TE_MetalSparks( filter, 0.0f, &vecOrigin, &vecDirection ); } break; case TE_SMOKE: { Vector vecOrigin, vecDirection; vecOrigin.x = pKeyValues->GetFloat( "originx" ); vecOrigin.y = pKeyValues->GetFloat( "originy" ); vecOrigin.z = pKeyValues->GetFloat( "originz" ); float flScale = pKeyValues->GetFloat( "scale" ); int nFrameRate = pKeyValues->GetInt( "framerate" ); TE_Smoke( filter, 0.0f, &vecOrigin, 0, flScale, nFrameRate ); } break; case TE_SPARKS: { Vector vecOrigin, vecDirection; vecOrigin.x = pKeyValues->GetFloat( "originx" ); vecOrigin.y = pKeyValues->GetFloat( "originy" ); vecOrigin.z = pKeyValues->GetFloat( "originz" ); vecDirection.x = pKeyValues->GetFloat( "directionx" ); vecDirection.y = pKeyValues->GetFloat( "directiony" ); vecDirection.z = pKeyValues->GetFloat( "directionz" ); int nMagnitude = pKeyValues->GetInt( "magnitude" ); int nTrailLength = pKeyValues->GetInt( "traillength" ); TE_Sparks( filter, 0.0f, &vecOrigin, nMagnitude, nTrailLength, &vecDirection ); } break; case TE_BLOOD_STREAM: TE_BloodStream( filter, 0.0f, pKeyValues ); break; case TE_BLOOD_SPRITE: TE_BloodSprite( filter, 0.0f, pKeyValues ); break; case TE_BREAK_MODEL: TE_BreakModel( filter, 0.0f, pKeyValues ); break; case TE_GLOW_SPRITE: TE_GlowSprite( filter, 0.0f, pKeyValues ); break; case TE_PHYSICS_PROP: TE_PhysicsProp( filter, 0.0f, pKeyValues ); break; case TE_SPRITE_SINGLE: TE_Sprite( filter, 0.0f, pKeyValues ); break; case TE_SPRITE_SPRAY: TE_SpriteSpray( filter, 0.0f, pKeyValues ); break; case TE_SHATTER_SURFACE: TE_ShatterSurface( filter, 0.0f, pKeyValues ); break; case TE_DECAL: TE_Decal( filter, 0.0f, pKeyValues ); break; case TE_PROJECT_DECAL: TE_ProjectDecal( filter, 0.0f, pKeyValues ); break; case TE_EXPLOSION: TE_Explosion( filter, 0.0f, pKeyValues ); break; #ifdef HL2_DLL case TE_CONCUSSIVE_EXPLOSION: TE_ConcussiveExplosion( filter, 0.0f, pKeyValues ); break; #endif } SuppressParticleEffects( false ); g_pEffects->SuppressEffectsSounds( false ); clienttools->EnableRecordingMode( bIsRecording ); }