//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFMinigun::StopMuzzleEffect() { C_BaseEntity *pEffectOwner = GetWeaponForEffect(); if ( !pEffectOwner ) return; // Stop the muzzle flash. if ( m_pMuzzleEffect ) { pEffectOwner->ParticleProp()->StopEmission( m_pMuzzleEffect ); m_pMuzzleEffect = NULL; } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFMinigun::StopBrassEffect() { C_BaseEntity *pEffectOwner = GetWeaponForEffect(); if ( !pEffectOwner ) return; // Stop the brass ejection. if ( m_pEjectBrassEffect ) { pEffectOwner->ParticleProp()->StopEmission( m_pEjectBrassEffect ); m_pEjectBrassEffect = NULL; } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFFlameThrower::RestartParticleEffect( void ) { CTFPlayer *pOwner = ToTFPlayer( GetPlayerOwner() ); if ( !pOwner ) return; if ( m_pFlameEffect && m_hFlameEffectHost.Get() ) { m_hFlameEffectHost->ParticleProp()->StopEmission( m_pFlameEffect ); } m_iParticleWaterLevel = pOwner->GetWaterLevel(); int iTeam = pOwner->GetTeamNumber(); // Start the appropriate particle effect const char *pszParticleEffect; if ( pOwner->GetWaterLevel() == WL_Eyes ) { pszParticleEffect = "flamethrower_underwater"; } else { if ( m_bCritFire ) { pszParticleEffect = ConstructTeamParticle( "flamethrower_crit_%s", iTeam, true ); } else { pszParticleEffect = iTeam == TF_TEAM_RED ? "flamethrower" : ConstructTeamParticle( "flamethrower_%s", pOwner->GetTeamNumber(), true ); } } // Start the effect on the viewmodel if our owner is the local player C_BaseEntity *pModel = GetWeaponForEffect(); if ( pModel ) { m_pFlameEffect = pModel->ParticleProp()->Create( pszParticleEffect, PATTACH_POINT_FOLLOW, "muzzle" ); m_hFlameEffectHost = pModel; } pOwner->m_Shared.SetParticleToMercColor( m_pFlameEffect ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFMinigun::StartMuzzleEffect() { C_BaseEntity *pEffectOwner = GetWeaponForEffect(); if ( !pEffectOwner ) return; // Try and setup the attachment point if it doesn't already exist. // This caching will mess up if we go third person from first - we only do this in taunts and don't fire so we should // be okay for now. if ( m_iMuzzleAttachment == -1 ) { m_iMuzzleAttachment = pEffectOwner->LookupAttachment( "muzzle" ); } // Start the muzzle flash, if a system hasn't already been started. if ( m_iMuzzleAttachment != -1 && m_pMuzzleEffect == NULL ) { m_pMuzzleEffect = pEffectOwner->ParticleProp()->Create( "muzzle_minigun_constant", PATTACH_POINT_FOLLOW, m_iMuzzleAttachment ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFFlameThrower::StartFlame() { if ( m_iWeaponState == FT_STATE_AIRBLASTING ) { C_BaseEntity *pModel = GetWeaponForEffect(); if ( pModel ) { pModel->ParticleProp()->Create( "pyro_blast", PATTACH_POINT_FOLLOW, "muzzle" ); } //CLocalPlayerFilter filter; //EmitSound( filter, entindex(), "Weapon_FlameThrower.AirBurstAttack" ); } else { CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); // normally, crossfade between start sound & firing loop in 3.5 sec float flCrossfadeTime = 3.5; if ( m_pFiringLoop && ( m_bCritFire != m_bFiringLoopCritical ) ) { // If we're firing and changing between critical & noncritical, just need to change the firing loop. // Set crossfade time to zero so we skip the start sound and go to the loop immediately. flCrossfadeTime = 0; StopFlame( true ); } StopPilotLight(); if ( !m_pFiringStartSound && !m_pFiringLoop ) { RestartParticleEffect(); CLocalPlayerFilter filter; // Play the fire start sound const char *shootsound = GetShootSound( SINGLE ); if ( flCrossfadeTime > 0.0 ) { // play the firing start sound and fade it out m_pFiringStartSound = controller.SoundCreate( filter, entindex(), shootsound ); controller.Play( m_pFiringStartSound, 1.0, 100 ); controller.SoundChangeVolume( m_pFiringStartSound, 0.0, flCrossfadeTime ); } // Start the fire sound loop and fade it in if ( m_bCritFire ) { shootsound = GetShootSound( BURST ); } else { shootsound = GetShootSound( SPECIAL1 ); } m_pFiringLoop = controller.SoundCreate( filter, entindex(), shootsound ); m_bFiringLoopCritical = m_bCritFire; // play the firing loop sound and fade it in if ( flCrossfadeTime > 0.0 ) { controller.Play( m_pFiringLoop, 0.0, 100 ); controller.SoundChangeVolume( m_pFiringLoop, 1.0, flCrossfadeTime ); } else { controller.Play( m_pFiringLoop, 1.0, 100 ); } } if( m_bHitTarget != m_bOldHitTarget ) { if ( m_bHitTarget ) { CLocalPlayerFilter filter; m_pHitTargetSound = controller.SoundCreate( filter, entindex(), "Weapon_FlameThrower.FireHit" ); controller.Play( m_pHitTargetSound, 1.0f, 100.0f ); } else if ( m_pHitTargetSound ) { controller.SoundDestroy( m_pHitTargetSound ); m_pHitTargetSound = NULL; } m_bOldHitTarget = m_bHitTarget; } } }