//----------------------------------------------------------------------------- // Purpose: Handle weapon impacts //----------------------------------------------------------------------------- void ImpactCallback( const CEffectData &data ) { VPROF_BUDGET( "ImpactCallback", VPROF_BUDGETGROUP_PARTICLE_RENDERING ); trace_t tr; Vector vecOrigin, vecStart, vecShotDir; int iMaterial, iDamageType, iHitbox; short nSurfaceProp; C_BaseEntity *pEntity = ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox ); if ( !pEntity ) { // This happens for impacts that occur on an object that's then destroyed. // Clear out the fraction so it uses the server's data tr.fraction = 1.0; PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp ); return; } // If we hit, perform our custom effects and play the sound if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr ) ) { // Check for custom effects based on the Decal index PerformCustomEffects( vecOrigin, tr, vecShotDir, iMaterial, 1.0 ); } PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp ); }
//----------------------------------------------------------------------------- // Purpose: Handle weapon impacts from the helicopter shooting (cheaper versions) //----------------------------------------------------------------------------- void ImpactHelicopterCallback( const CEffectData &data ) { VPROF_BUDGET( "ImpactHelicopterCallback", VPROF_BUDGETGROUP_PARTICLE_RENDERING ); trace_t tr; Vector vecOrigin, vecStart, vecShotDir; int iMaterial, iDamageType, iHitbox; short nSurfaceProp; C_BaseEntity *pEntity = ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox ); if ( !pEntity ) { // This happens for impacts that occur on an object that's then destroyed. // Clear out the fraction so it uses the server's data tr.fraction = 1.0; PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp ); return; } // If we hit, perform our custom effects and play the sound. Don't create decals if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr, IMPACT_NODECAL | IMPACT_REPORT_RAGDOLL_IMPACTS ) ) { FX_AirboatGunImpact( vecOrigin, tr.plane.normal, IsXbox() ? 1 : 2 ); // Only do metal + computer custom effects if ( (iMaterial == CHAR_TEX_METAL) || (iMaterial == CHAR_TEX_COMPUTER) ) { PerformCustomEffects( vecOrigin, tr, vecShotDir, iMaterial, 1.0, FLAGS_CUSTIOM_EFFECTS_NOFLECKS ); } } PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp ); }
//----------------------------------------------------------------------------- // Purpose: Handle weapon impacts from the airboat gun shooting (cheaper versions) //----------------------------------------------------------------------------- void ImpactAirboatGunCallback( const CEffectData &data ) { VPROF_BUDGET( "ImpactAirboatGunCallback", VPROF_BUDGETGROUP_PARTICLE_RENDERING ); trace_t tr; Vector vecOrigin, vecStart, vecShotDir; int iMaterial, iDamageType, iHitbox; short nSurfaceProp; C_BaseEntity *pEntity = ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox ); if ( !pEntity ) { // This happens for impacts that occur on an object that's then destroyed. // Clear out the fraction so it uses the server's data tr.fraction = 1.0; PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp ); return; } #if !defined( _XBOX ) // If we hit, perform our custom effects and play the sound. Don't create decals if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr, IMPACT_NODECAL | IMPACT_REPORT_RAGDOLL_IMPACTS ) ) { FX_AirboatGunImpact( vecOrigin, tr.plane.normal, 2 ); } #else FX_AirboatGunImpact( vecOrigin, tr.plane.normal, 1 ); #endif }
//----------------------------------------------------------------------------- // Purpose: Handle weapon impacts //----------------------------------------------------------------------------- void ImpactCallback(const CEffectData &data) { trace_t tr; Vector vecOrigin, vecStart, vecShotDir; int iMaterial, iDamageType, iHitbox; short nSurfaceProp; C_BaseEntity *pEntity = ParseImpactData(data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox); if (!pEntity) return; // If we hit, perform our custom effects and play the sound if (Impact(vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr)) { // Check for custom effects based on the Decal index PerformCustomEffects(vecOrigin, tr, vecShotDir, iMaterial, 1.0); //Play a ricochet sound some of the time if (random->RandomInt(1, 10) <= 3 && (iDamageType == DMG_BULLET)) { CLocalPlayerFilter filter; C_BaseEntity::EmitSound(filter, SOUND_FROM_WORLD, "Bounce.Shrapnel", &vecOrigin); } } PlayImpactSound(pEntity, tr, vecOrigin, nSurfaceProp); }
//----------------------------------------------------------------------------- // Purpose: Handle weapon impacts //----------------------------------------------------------------------------- void ImpactCallback( const CEffectData &data ) { trace_t tr; Vector vecOrigin, vecStart, vecShotDir; int iMaterial, iDamageType, iHitbox, iEntIndex; ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, &iMaterial, &iDamageType, &iHitbox, &iEntIndex ); // If we hit, perform our custom effects and play the sound if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, iEntIndex, tr ) ) { // Check for custom effects based on the Decal index PerformCustomEffects( vecOrigin, tr, vecShotDir, iMaterial, 1.0 ); PlayImpactSound( tr ); } }
//----------------------------------------------------------------------------- // Purpose: Handle gunship impacts //----------------------------------------------------------------------------- void ImpactGunshipCallback( const CEffectData &data ) { trace_t tr; Vector vecOrigin, vecStart, vecShotDir; int iMaterial, iDamageType, iHitbox; short nSurfaceProp; C_BaseEntity *pEntity = ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox ); if ( !pEntity ) return; // If we hit, perform our custom effects and play the sound if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr ) ) { // Check for custom effects based on the Decal index PerformCustomEffects( vecOrigin, tr, vecShotDir, iMaterial, 3 ); } PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp ); }
void Spell::UpdatePos(float dt) { if (direction == UP) { dy=-speed*dt; } else if (direction == DOWN) { dy=speed*dt; } else if (direction == LEFT) { dx=-speed*dt; } else if (direction == RIGHT) { dx=speed*dt; } xPos+=dx; yPos+=dy; distance += abs(dx) + abs(dy); Entity* entity = Collides(); if (entity) { Impact(entity); } }