예제 #1
0
//-----------------------------------------------------------------------------
// Purpose: Smoke puffs
//-----------------------------------------------------------------------------
void FX_Smoke( const Vector &origin, const QAngle &angles, float scale, int numParticles, unsigned char *pColor, int iAlpha )
{
	VPROF_BUDGET( "FX_Smoke", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
	Vector vecVelocity;
	Vector vecForward;

	// Smoke
	for ( int i = 0; i < numParticles; i++ )
	{
		// Velocity
		AngleVectors( angles, &vecForward );
		vecVelocity.Random( -0.5f, 0.5f );
		vecVelocity += vecForward;
		VectorNormalize( vecVelocity );
		vecVelocity	*= random->RandomFloat( 16.0f, 32.0f );
		vecVelocity[2] += random->RandomFloat( 4.0f, 16.0f );

		// Color
		unsigned char particlecolor[3];
		if ( !pColor )
		{
			int color = random->RandomInt( 64, 164 );
			particlecolor[0] = color;
			particlecolor[1] = color;
			particlecolor[2] = color;
		}
		else
		{
			particlecolor[0] = pColor[0];
			particlecolor[1] = pColor[1];
			particlecolor[2] = pColor[2];
		}

		// Alpha
		int alpha = iAlpha;
		if ( alpha == -1 )
		{
			alpha = random->RandomInt( 10, 25 );
		}

		// Scale
		int iSize = random->RandomInt( 4, 8 ) * scale;

		// Roll
		float flRoll = random->RandomInt( 0, 360 );
		float flRollDelta = random->RandomFloat( -4.0f, 4.0f );

		//pParticle->m_uchEndSize		= pParticle->m_uchStartSize*2;

		FX_Smoke( origin, vecVelocity, iSize, 1, random->RandomFloat( 0.5f, 1.0f ), particlecolor, alpha, "particle/particle_smokegrenade", flRoll, flRollDelta );
	}
}
예제 #2
0
//-----------------------------------------------------------------------------
// Generates various tempent effects
//-----------------------------------------------------------------------------
void CEffectsClient::Smoke( const Vector &vecOrigin, int modelIndex, float scale, float framerate )
{
	CPVSFilter filter( vecOrigin );
	if ( !SuppressTE( filter ) )
	{
		int iColor = random->RandomInt(20,35);
		color32 color;
		color.r = iColor;
		color.g = iColor;
		color.b = iColor;
		color.a = iColor;
		QAngle angles;
		VectorAngles( Vector(0,0,1), angles );
		FX_Smoke( vecOrigin, angles, scale * 0.1f, 4, (unsigned char *)&color, 255 );
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponCombatBurstRifle::ViewModelDrawn( C_BaseViewModel *pViewModel )
{
	C_BaseTFPlayer *pPlayer = ( C_BaseTFPlayer* )GetOwner();
	if ( pPlayer && pPlayer->IsDamageBoosted() )
	{			
		Vector vecBarrelPos;
		QAngle angMuzzle;
		int iAttachment = pViewModel->LookupAttachment( "muzzle" );
		pViewModel->GetAttachment( iAttachment, vecBarrelPos, angMuzzle );

		unsigned char color[3];
		color[0] = 50;
		color[1] = 128;
		color[2] = 50;
		FX_Smoke( vecBarrelPos, angMuzzle, 0.5, 1, &color[0], 192 );
	}
}