//----------------------------------------------------------------------------- // Add a smoke trail since we've taken more damage //----------------------------------------------------------------------------- void CPropAPC::AddSmokeTrail( const Vector &vecPos ) { // Start this trail out with a bang! ExplosionCreate( vecPos, vec3_angle, this, 1000, 500, SF_ENVEXPLOSION_NODAMAGE | SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE | SF_ENVEXPLOSION_NOFIREBALLSMOKE, 0 ); UTIL_ScreenShake( vecPos, 25.0, 150.0, 1.0, 750.0f, SHAKE_START ); if ( m_nSmokeTrailCount == MAX_SMOKE_TRAILS ) return; SmokeTrail *pSmokeTrail = SmokeTrail::CreateSmokeTrail(); if( !pSmokeTrail ) return; // See if there's an attachment for this smoke trail char buf[32]; Q_snprintf( buf, 32, "damage%d", m_nSmokeTrailCount ); int nAttachment = LookupAttachment( buf ); ++m_nSmokeTrailCount; pSmokeTrail->m_SpawnRate = 4; pSmokeTrail->m_ParticleLifetime = 5.0f; pSmokeTrail->m_StartColor.Init( 0.7f, 0.7f, 0.7f ); pSmokeTrail->m_EndColor.Init( 0.6, 0.6, 0.6 ); pSmokeTrail->m_StartSize = 32; pSmokeTrail->m_EndSize = 64; pSmokeTrail->m_SpawnRadius = 4; pSmokeTrail->m_Opacity = 0.5f; pSmokeTrail->m_MinSpeed = 16; pSmokeTrail->m_MaxSpeed = 16; pSmokeTrail->m_MinDirectedSpeed = 16.0f; pSmokeTrail->m_MaxDirectedSpeed = 16.0f; pSmokeTrail->SetLifetime( 5 ); pSmokeTrail->SetParent( this, nAttachment ); Vector vecForward( 0, 0, 1 ); QAngle angles; VectorAngles( vecForward, angles ); if ( nAttachment == 0 ) { pSmokeTrail->SetAbsOrigin( vecPos ); pSmokeTrail->SetAbsAngles( angles ); } else { pSmokeTrail->SetLocalOrigin( vec3_origin ); pSmokeTrail->SetLocalAngles( angles ); } pSmokeTrail->SetMoveType( MOVETYPE_NONE ); }
//------------------------------------------------------------------------------ // Purpose : //------------------------------------------------------------------------------ void CPlayer_Missile::Launch(void) { m_lifeState = LIFE_ALIVE; m_takedamage = DAMAGE_YES; m_iHealth = m_iMaxHealth; // Shoot forward Vector vVelocity; AngleVectors( GetLocalAngles(), &vVelocity); SetAbsVelocity( vVelocity*PMISSILE_SPEED ); EmitSound( "Player_Manhack.Fly" ); EmitSound( "Player_Manhack.Fire" ); SetThink(FlyThink); SetTouch(FlyTouch); SetNextThink( gpGlobals->curtime ); // Start smoke trail SmokeTrail *pSmokeTrail = SmokeTrail::CreateSmokeTrail(); if(pSmokeTrail) { pSmokeTrail->m_SpawnRate = 90; pSmokeTrail->m_ParticleLifetime = PMISSILE_TRAIL_LIFE; pSmokeTrail->m_StartColor.Init(0.1, 0.1, 0.1); pSmokeTrail->m_EndColor.Init(0.5,0.5,0.5); pSmokeTrail->m_StartSize = 10; pSmokeTrail->m_EndSize = 50; pSmokeTrail->m_SpawnRadius = 1; pSmokeTrail->m_MinSpeed = 15; pSmokeTrail->m_MaxSpeed = 25; pSmokeTrail->SetLifetime(120); pSmokeTrail->FollowEntity(ENTINDEX(pev)); m_hSmokeTrail = pSmokeTrail; } }