void FX_GrenadeShrapnelExplode( vec3_t origin, vec3_t norm )
{
	localEntity_t	*le;
	FXTrail			*fx;
	vec3_t			direction, org;

	//Orient the explosions to face the camera
	VectorSubtract( cg.refdef.vieworg, origin, direction );
	VectorNormalize( direction );

	VectorMA( origin, 12, direction, org );
	// Add an explosion and tag a light to it
	le = CG_MakeExplosion( org, direction, cgs.media.explosionModel, 6, cgs.media.surfaceExplosionShader, 700, qfalse, 1.2f + (random()*0.3f) );
	le->light = 150;
	le->refEntity.renderfx |= RF_NOSHADOW;
	VectorSet( le->lightColor, 1.0f, 0.6f, 0.6f );

	for ( int i = 0; i < 6; i++)
	{
	fx = FX_AddTrail( origin, NULL, NULL, 16.0f, -15.0f,
								1.5, -1.5, 1.0f, 1.0f, 0.2f, 1000.0f,  cgs.media.orangeTrailShader, rand() & FXF_BOUNCE );

	if ( fx == NULL )
		return;

	FXE_Spray( norm, 500, 175, 0.8f, 512, (FXPrimitive *) fx );
	}

	cgi_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.grenadeAltExplodeSnd );	

	CG_ImpactMark( cgs.media.compressionMarkShader, origin, norm, random()*360, 1,1,1,1.0, qfalse, 
					random() * 16 + 48, qfalse );

	CG_ExplosionEffects( origin, 2.0, 350 );
}
void FX_ProtonAltMiss( vec3_t origin, vec3_t normal )
{
	vec3_t	new_org;
	vec3_t	velocity;
	float	scale, dscale;
	int		i;

	// Smoke puffs
	for ( i = 0; i < 8; i++ )
	{
		scale = random() * 12.0f + 4.0f;
		dscale = random() * 12.0f + 8.0f;

		VectorMA( origin, random() * 8.0f, normal, new_org );
		
		velocity[0] = normal[0] * crandom() * 24.0f;
		velocity[1] = normal[1] * crandom() * 24.0f;
		velocity[2] = normal[2] * ( random() * 24.0f + 8.0f ) + 8.0f; // move mostly up

		FX_AddSprite( new_org, 
					velocity, NULL, 
					scale, dscale,
					random() * 0.5f + 0.5f, 0.0f,
					random() * 45.0f,
					0.0f,
					800 + random() * 300.0f,
					cgs.media.steamShader );
	}

	// Scorch mark
	CG_ImpactMark( cgs.media.bulletmarksShader, origin, normal, random()*360, 1,1,1,1, qfalse, 6, qfalse );
//	FX_ProtonHit( origin );

	CG_ExplosionEffects( origin, 1.0f, 150 );
}
void FX_GrenadeExplode( vec3_t origin, vec3_t normal )
{
	localEntity_t	*le;
	FXTrail			*fx;
	vec3_t			direction, org;

	VectorSet( direction, 0,0,1 );

	// Add an explosion and tag a light to it
	le = CG_MakeExplosion( origin, direction, cgs.media.nukeModel, 5, NULL, 250, qfalse, 25.0f, LEF_FADE_RGB );
	le->light = 150;
	le->refEntity.renderfx |= RF_NOSHADOW;

	VectorSet( le->lightColor, 1.0f, 0.6f, 0.2f );

	// Ground ring
	FX_AddQuad( origin, normal, NULL, NULL, 5, 330, 1.0, 0.0, random() * 360, 0, 0, 300, cgs.media.bigShockShader );
	// Flare
	VectorMA( origin, 12, direction, org );
	FX_AddSprite( org, NULL, NULL, 160.0, -540.0, 1.0, 0.0, 0.0, 0.0, 200, cgs.media.sunnyFlareShader );

	for ( int i = 0; i < 12; i++)
	{
		fx = FX_AddTrail( origin, NULL, NULL, 24.0f + random() * 12, -40.0f,
								0.5 + random() * 2, -3.0, 1.0f, 1.0f, 0.5f, 1000.0f,  cgs.media.orangeTrailShader, rand() & FXF_BOUNCE );


		if ( fx == NULL )
			return;
		
		FXE_Spray( normal, 470, 325, 0.5f, 700, (FXPrimitive *) fx );
	}

	cgi_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.grenadeExplodeSnd );	

	// Smoke and impact
	CG_ImpactMark( cgs.media.compressionMarkShader, origin, normal, random()*360, 1,1,1,1.0, qfalse, 
					random() * 16 + 48, qfalse );

	CG_ExplosionEffects( origin, 3.0f, 400 );
}
void CG_SurfaceExplosion( vec3_t origin, vec3_t normal, float radius, float shake_speed, qboolean smoke )
{
	localEntity_t	*le;
	//FXTrail			*particle;
	vec3_t			direction, new_org;
	vec3_t			velocity		= { 0, 0, 0 };
	vec3_t			temp_org, temp_vel;
	float			scale, dscale;
	int				i, numSparks;

	//Sparks
	numSparks = 16 + (random() * 16.0f);
	
	for ( i = 0; i < numSparks; i++ )
	{	
		scale = 0.25f + (random() * 2.0f);
		dscale = -scale*0.5;

/*		particle = FX_AddTrail( origin,
								NULL,
								NULL,
								32.0f,
								-64.0f,
								scale,
								-scale,
								1.0f,
								0.0f,
								0.25f,
								4000.0f,
								cgs.media.sparkShader,
								rand() & FXF_BOUNCE);
		if ( particle == NULL )
			return;

		FXE_Spray( normal, 500, 150, 1.0f, 768 + (rand() & 255), (FXPrimitive *) particle );*/
	}

	//Smoke
	//Move this out a little from the impact surface
	VectorMA( origin, 4, normal, new_org );
	VectorSet( velocity, 0.0f, 0.0f, 16.0f );

	for ( i = 0; i < 4; i++ )
	{
		VectorSet( temp_org, new_org[0] + (crandom() * 16.0f), new_org[1] + (crandom() * 16.0f), new_org[2] + (random() * 4.0f) );
		VectorSet( temp_vel, velocity[0] + (crandom() * 8.0f), velocity[1] + (crandom() * 8.0f), velocity[2] + (crandom() * 8.0f) );

/*		FX_AddSprite(	temp_org,
						temp_vel, 
						NULL, 
						64.0f + (random() * 32.0f), 
						16.0f, 
						1.0f, 
						0.0f,
						20.0f + (crandom() * 90.0f),
						0.5f,
						1500.0f, 
						cgs.media.smokeShader, FXF_USE_ALPHA_CHAN );*/
	}

	//Core of the explosion

	//Orient the explosions to face the camera
	VectorSubtract( cg.refdef.vieworg, origin, direction );
	VectorNormalize( direction );

	//Tag the last one with a light
	le = CG_MakeExplosion( origin, direction, cgs.media.explosionModel, 6, cgs.media.surfaceExplosionShader, 500, qfalse, radius * 0.02f + (random() * 0.3f), 0);
	le->light = 150;
	VectorSet( le->lightColor, 0.9f, 0.8f, 0.5f );

	for ( i = 0; i < NUM_EXPLOSIONS-1; i ++)
	{
		VectorSet( new_org, (origin[0] + (16 + (crandom() * 8))*crandom()), (origin[1] + (16 + (crandom() * 8))*crandom()), (origin[2] + (16 + (crandom() * 8))*crandom()) );
		le = CG_MakeExplosion( new_org, direction, cgs.media.explosionModel, 6, cgs.media.surfaceExplosionShader, 300 + (rand() & 99), qfalse, radius * 0.05f + (crandom() *0.3f), 0);
	}

	//Shake the camera
	CG_ExplosionEffects( origin, shake_speed, 350, 750 );

	// The level designers wanted to be able to turn the smoke spawners off.  The rationale is that they
	//	want to blow up catwalks and such that fall down...when that happens, it shouldn't really leave a mark
	//	and a smoke spewer at the explosion point...
	if ( smoke )
	{
		VectorMA( origin, -8, normal, temp_org );
//		FX_AddSpawner( temp_org, normal, NULL, NULL, 100, random()*25.0f, 5000.0f, (void *) CG_SmokeSpawn );

		//Impact mark
		//FIXME: Replace mark
		//CG_ImpactMark( cgs.media.burnMarkShader, origin, normal, random()*360, 1,1,1,1, qfalse, 8, qfalse );
	}
}
Exemple #5
0
//------------------------------------------------------
void SFxHelper::CameraShake( vec3_t origin, float intensity, int radius, int time )
{
	CG_ExplosionEffects( origin, intensity, radius, time );
}
Exemple #6
0
/*
-------------------------
FX_fxfunc_Explosion
-------------------------
*/
void FX_fxfunc_Explosion( vec3_t start, vec3_t origin, vec3_t normal )
{
	localEntity_t	*le;
	vec3_t			dir;
	vec3_t			velocity;
//	vec3_t			end;
//	trace_t			trace;
	float			scale;
	int				i, j, numSparks;
	//weaponInfo_t	*weaponInfo = &cg_weapons[WP_6];
	//float	scale, dscale;
//	int		s;
//	vec3_t	new_org;

	//Sparks
	numSparks = 20 + (random() * 4.0f);//4

	for ( i = 0; i < numSparks; i++ )
	{	
		scale = 0.25f + (random() * 1.0f);

		//Randomize the direction
		for (j = 0; j < 3; j ++ )
		{
			dir[j] = normal[j] + (0.75 * crandom());
		}

		VectorNormalize(dir);

		//set the speed
		VectorScale( dir, 200 + (50 * crandom()), velocity);

		le = FX_AddTrail( origin,
								velocity,
								qtrue,
								4.0f,
								-4.0f,
								scale,
								-scale,
								1.0f,
								1.0f,
								0.5f,
								1000.0f,
								cgs.media.sparkShader);

	}

	VectorMA( origin, 8, normal, dir );
	VectorSet(velocity, 0, 0, 8);

	// Smoke puffs
	FX_AddSprite(	dir,
					velocity, 
					qfalse, 
					20.0f + random()*60.0f,//2.2f + ( crandom() * 0.9f),//60.0f - random()*60.0f
					16.0f,
					100.0f,//1.0f
					100.0f,//0.0f
					random()*45.0f,
					-12.0f,
					8000.0f,
					cgs.media.steamShader );

	//Orient the explosions to face the camera
	VectorSubtract( cg.refdef.vieworg, origin, dir );
	VectorNormalize( dir );

	le = CG_MakeExplosion2( origin, dir, cgs.media.explosionModel, 5, cgs.media.electricalExplosionSlowShader, 475, qfalse, 2.2f + ( crandom() * 0.9f), LEF_NONE);//RPG-X: RedTechie - Scale use to be - 1.2f + ( crandom() * 0.3f)
	le->light = 150;
	le->refEntity.renderfx |= RF_NOSHADOW;
	VectorSet( le->lightColor, 0.8f, 0.8f, 1.0f );

	CG_ImpactMark( cgs.media.compressionMarkShader, origin, normal, random()*360, 1,1,1,1.0, qfalse, 
					random() * 16 + 48, qfalse );
	//CG_ImpactMark( cgs.media.compressionMarkShader, origin, normal, random()*360, 1,1,1,1, qfalse, 12, qfalse );

	//Shake the camera
	CG_ExplosionEffects( origin, 2, 400 );

	// nice explosion sound at the point of impact
	trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.grenadeAltExplodeSnd );
	//trap_S_StartSound(origin, ENTITYNUM_WORLD, CHAN_AUTO, weaponInfo->mainHitSound);
}
Exemple #7
0
//-----------------------------------
//By: RedTechie - Imported/Modifyed from SP
//-----------------------------------
void FX_GrenadeShrapnelExplode( vec3_t origin, vec3_t norm )
{
	localEntity_t	*le;
	//FXTrail			*fx;
	vec3_t			direction, org, vel;
	int				i;

	CG_InitLensFlare( origin, 
						350, 350,
						colorTable[CT_DKRED1], 1.2, 2.0, 1600, 200,
						colorTable[CT_DKRED1], 1600, 200, 800, 20,  qtrue, 
						0, 0, qfalse, qtrue, 
						qfalse, 1.0, cg.time, 90, 0, 300);

	//Orient the explosions to face the camera
	VectorSubtract( cg.refdef.vieworg, origin, direction );
	VectorNormalize( direction );

	VectorMA( origin, 12, direction, org );
	// Add an explosion and tag a light to it
	le = CG_MakeExplosion2( org, direction, cgs.media.explosionModel, 6, cgs.media.surfaceExplosionShader, 700, qfalse, 1.2f + (random()*0.5f),LEF_FADE_RGB ); //RPG-X: RedTechie - Scale use to be 1.2f + (random()*0.3f)
	le->light = 150;
	le->refEntity.renderfx |= RF_NOSHADOW;
	VectorSet( le->lightColor, 1.0f, 0.6f, 0.6f );

	VectorMA( org, 8, norm, direction );
	VectorSet(vel, 0, 0, 8);
	//Some smoke
	FX_AddSprite(	direction, 
					vel, 
					qfalse, 
					20.0f + random()*50.0f,//1.2f + (random()*0.5f),//60.0f - random()*60.0f
					16.0f,
					100.0f,//1.0f
					100.0f,//0.0f
					random()*45.0f,
					-12.0f,
					8000.0f,
					cgs.media.steamShader );


	for ( i = 0; i < 6; i++)
	{	
		float width, length;
		FXE_Spray( norm, 500, 175, 0.8f, vel);//, (FXPrimitive *) fx 
		length = 24.0 + random() * 12;
		width = 0.5 + random() * 2;
		FX_AddTrail( origin, vel, qtrue, length, -length, width, -width, 
						1.0f, 1.0f, 0.5f, 2500.0f,  cgs.media.orangeTrailShader);//RPG-X: RedTechie - Killtime use to be 1000.0f
	
		/*FX_AddTrail( origin, NULL, NULL, 16.0f, -15.0f,
								1.5, -1.5, 1.0f, 1.0f, 0.2f, 1000.0f,  cgs.media.orangeTrailShader, rand() & FXF_BOUNCE );
*/
	/*if ( fx == NULL )
		return;*/

	
	}

	trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.grenadeAltExplodeSnd );	

	CG_ImpactMark( cgs.media.compressionMarkShader, origin, norm, random()*360, 1,1,1,1.0, qfalse, 
					random() * 16 + 48, qfalse );

	CG_ExplosionEffects( origin, 2.0, 350 );
}