Readded cooking_steam and added toggle-functionality to fire, particlefire and electricfire

Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
Harry Young 2011-12-12 13:27:05 +01:00
parent de20d8ba89
commit 5721a7820a
4 changed files with 152 additions and 31 deletions

View file

@ -1086,9 +1086,9 @@ qboolean ParticleFire_Think(localEntity_t *le) {
return qtrue;
}
void CG_ParticleFire(vec3_t origin, int size) {
void CG_ParticleFire(vec3_t origin, int killtime, int size) {
localEntity_t *le;
le = FX_AddSpawner(origin, NULL, NULL, NULL, qfalse, 0, 0, 10000, ParticleFire_Think, 10);
le = FX_AddSpawner(origin, NULL, NULL, NULL, qfalse, 0, 0, killtime, ParticleFire_Think, 10);
//le->data.spawner.data1 = size;
}
@ -1328,7 +1328,7 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec3_t laserRGB, flo
alpha, 0.0f,
laserRGB, laserRGB,
125,
cgs.media.whiteLaserShader ); /* FIXME: FX_AddLine3 not defined */
cgs.media.whiteLaserShader );
FX_AddLine( start, end,
1.0f,
@ -1407,7 +1407,7 @@ void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal )
random() * 0.2 + 0.2, 0.1f,
lRGB, lRGB,
150,
cgs.media.whiteLaserShader ); /* FIXME: FX_AddLine3 not defined */
cgs.media.whiteLaserShader );
FX_AddLine( start, end,
1.0f,
@ -1450,7 +1450,7 @@ CG_CookingSteam
Creates a basic cooking steam effect
======================
*/
/*void CG_CookingSteam( vec3_t origin, float radius )
void CG_CookingSteam( vec3_t origin, float radius )
{
vec3_t dir;
@ -1459,6 +1459,7 @@ Creates a basic cooking steam effect
FX_AddSprite( origin, dir, qfalse, radius, radius * 2, 0.4F, 0.0, 0, 0, 1000, cgs.media.steamShader );
}
/*
======================
CG_ElectricFire
@ -1467,23 +1468,23 @@ Creates an electric fire effect
======================
*/
/*void CG_ElectricFire( vec3_t origin, vec3_t normal )
void CG_ElectricFire( vec3_t origin, vec3_t normal )
{
FXTrail *particle;
void *particle;
vec3_t dir, direction, start, end;
vec3_t velocity, accel;
vec3_t velocity;
float scale, alpha;
int numSparks;
int numSparks, i, j;
AngleVectors( normal, normal, NULL, NULL);
numSparks = 4 + (random() * 8.0f);
for ( int i = 0; i < numSparks; i++ )
for ( i = 0; i < numSparks; i++ )
{
scale = 0.3f + (random() *0.4);
for ( int j = 0; j < 3; j ++ )
for ( j = 0; j < 3; j ++ )
dir[j] = normal[j] + (0.4f * crandom());
VectorNormalize(dir);
@ -1505,11 +1506,10 @@ Creates an electric fire effect
scale = 0.5f + (random() * 0.5f);
VectorScale( normal, 300, velocity );
VectorSet( accel, 0, 0, -600 );
particle = FX_AddTrail( start,
velocity,
accel,
qtrue,
6.0f,
-24.0f,
scale,
@ -1518,13 +1518,15 @@ Creates an electric fire effect
0.5f,
0.0f,
200.0f,
cgs.media.sparkShader,
FXF_BOUNCE );
cgs.media.sparkShader);
if ( particle == NULL )
return;
FXE_Spray( dir, 200, 200, 0.2f, 300, (FXPrimitive *) particle );
VectorMA( origin, 1, normal, direction );
VectorSet( velocity, 0, 0, 8 );
FXE_Spray( dir, 200, 200, 0.2f, velocity);
VectorMA( origin, 1, normal, direction );
VectorSet( velocity, 0, 0, 8 );
@ -1536,7 +1538,7 @@ Creates an electric fire effect
FX_AddSprite( direction,
velocity,
NULL,
qfalse,
scale,
scale,
alpha,

View file

@ -1729,7 +1729,7 @@ case EV_SHAKE_SOUND:
case EV_FX_PARTICLEFIRE:
DEBUGNAME("EV_FX_PARTICLEFIRE");
CG_ParticleFire(cent->currentState.origin, cent->currentState.eventParm);
CG_ParticleFire(cent->currentState.origin, cent->currentState.time2, cent->currentState.eventParm);
break;
case EV_SHOOTER_SOUND:
@ -1793,7 +1793,7 @@ case EV_SHAKE_SOUND:
case EV_FX_COOKING_STEAM:
DEBUGNAME("EV_FX_COOKING_STEAM");
//CG_CookingSteam( cent->lerpOrigin, cent->currentState.angles[0] );
CG_CookingSteam( cent->currentState.origin, cent->currentState.angles[0] );
break;
case EV_FX_ELECFIRE:
@ -1803,7 +1803,7 @@ case EV_SHAKE_SOUND:
{
//cgi_S_StartSound (NULL, es->number, CHAN_BODY, cgi_S_RegisterSound ( va("sound/ambience/spark%d.wav", Q_irand(1,6)) ));
}
//CG_ElectricFire( cent->lerpOrigin, cent->currentState.angles );
CG_ElectricFire( cent->currentState.origin, cent->currentState.angles );
break;
case EV_FX_FORGE_BOLT:

View file

@ -2056,7 +2056,7 @@ void CG_ElectricalExplosion( vec3_t start, vec3_t dir, float radius );
void CG_PhaserFX(centity_t *cent);
void CG_DisruptorFX(centity_t *cent); //RPG-X | Harry Young | 03.12.2011
void CG_TorpedoFX(centity_t *cent);
void CG_ParticleFire(vec3_t origin, int size);
void CG_ParticleFire(vec3_t origin, int killtime, int size);
void CG_ShowTrigger(centity_t *cent);
// Additional ports from SP by Harry Young

View file

@ -1018,15 +1018,35 @@ void SP_fx_torpedo(gentity_t *ent) {
ent->nextthink = level.time + 1000;
}
/*QUAKED fx_particle_fire (0 0 1) (-8 -8 -8) (8 8 8)
/*QUAKED fx_particle_fire (0 0 1) (-8 -8 -8) (8 8 8) STARTOFF
A particle based fire effect. Use this sparingly as it is an fps killer.
If you want to use a bunch of fires use fx_fire.
"targetname" - toggles effect on/off whenver used, requires 10x mor thinks
"size" how big the fire shoud be (default: 10)
*/
void particleFire_think(gentity_t *ent) {
G_AddEvent(ent, EV_FX_PARTICLEFIRE, ent->count);
ent->nextthink = level.time + 10000; //refresh every 10 seconds
if (ent->targetname)
ent->nextthink = level.time + 1000;
else
ent->nextthink = level.time + 10000;
}
void particleFire_use( gentity_t *self, gentity_t *other, gentity_t *activator)
{
if ( self->count )
{
self->think = NULL;
self->nextthink = -1;
}
else
{
self->think = particleFire_think;
self->nextthink = level.time + 200;
}
self->count = !self->count;
}
void SP_fx_particleFire(gentity_t *ent) {
@ -1036,23 +1056,65 @@ void SP_fx_particleFire(gentity_t *ent) {
ent->count = 10;
else
ent->count = size;
if (ent->targetname)
ent->s.time2 = 1000;
else
ent->s.time2 = 10000;
trap_LinkEntity(ent);
ent->nextthink = level.time + 1000;
ent->think = particleFire_think;
if (ent->targetname)
{
ent->use = particleFire_use;
}
ent->count = !(ent->spawnflags & 1);
if (!ent->targetname || !(ent->spawnflags & 1) )
{
ent->think = particleFire_think;
ent->nextthink = level.time + 2000;
}
else
{
ent->think = NULL;
ent->nextthink = -1;
}
}
/*QUAKED fx_fire (0 0 1) (-8 -8 -8) (8 8 8)
/*QUAKED fx_fire (0 0 1) (-8 -8 -8) (8 8 8) STARTOFF
A fire affect based on the adminguns fire effect.
"targetname" - toggles effect on/off whenver used, requires 10x mor thinks
"size" how big the fire shoud be (default: 64)
"angles" fires angles (default: 0 0 0 = UP)
*/
void fire_think(gentity_t *ent) {
G_AddEvent(ent, EV_FX_FIRE, 1);
if (ent->targetname)
ent->nextthink = level.time + 1000;
else
ent->nextthink = level.time + 10000;
}
void fire_use( gentity_t *self, gentity_t *other, gentity_t *activator)
{
if ( self->count )
{
self->think = NULL;
self->nextthink = -1;
}
else
{
self->think = fire_think;
self->nextthink = level.time + 200;
}
self->count = !self->count;
}
void SP_fx_fire(gentity_t *ent) {
int size;
G_SpawnInt("size", "64", &size);
@ -1061,10 +1123,31 @@ void SP_fx_fire(gentity_t *ent) {
else
ent->s.time = size;
ent->s.angles2[2] = 1;
ent->s.time2 = 10000;
if (ent->targetname)
ent->s.time2 = 1000;
else
ent->s.time2 = 10000;
trap_LinkEntity(ent);
ent->think = fire_think;
ent->nextthink = level.time + 1000;
if (ent->targetname)
{
ent->use = fire_use;
}
ent->count = !(ent->spawnflags & 1);
if (!ent->targetname || !(ent->spawnflags & 1) )
{
ent->think = fire_think;
ent->nextthink = level.time + 2000;
}
else
{
ent->think = NULL;
ent->nextthink = -1;
}
}
// Additional ports from SP by Harry Young
@ -1130,9 +1213,11 @@ void SP_fx_cooking_steam( gentity_t *ent )
VectorCopy( ent->s.origin, ent->s.pos.trBase );
}
/*QUAKED fx_elecfire (0 0 1) (-8 -8 -8) (8 8 8)
/*QUAKED fx_elecfire (0 0 1) (-8 -8 -8) (8 8 8) STARTOFF
Emits sparks at the specified point in the specified direction
Spawns smoke puffs.
"targetname" - toggles effect on/off whenver used
*/
//------------------------------------------
@ -1142,11 +1227,43 @@ void electric_fire_think( gentity_t *ent )
ent->nextthink = level.time + (750 + (random() * 300));
}
//------------------------------------------
void electric_fire_use( gentity_t *self, gentity_t *other, gentity_t *activator)
{
if ( self->count )
{
self->think = NULL;
self->nextthink = -1;
}
else
{
self->think = electric_fire_think;
self->nextthink = level.time + 200;
}
self->count = !self->count;
}
//------------------------------------------
void SP_fx_electricfire( gentity_t *ent )
{
ent->think = electric_fire_think;
if (ent->targetname)
{
ent->use = electric_fire_use;
}
ent->count = !(ent->spawnflags & 1);
if (!ent->targetname || !(ent->spawnflags & 1) )
{ent->think = electric_fire_think;
ent->nextthink = level.time + 500;
}
else
{
ent->think = NULL;
ent->nextthink = -1;
}
VectorCopy( ent->s.origin, ent->s.pos.trBase );
@ -1886,6 +2003,8 @@ void SP_fx_shimmery_thing( gentity_t *ent )
G_SpawnFloat( "radius", "10", &ent->s.angles[1] );
if ( !ent->wait )
ent->wait = 2000;
if ( ent->spawnflags & 4 ) // backwards capability for sp, keep -1 in definitions for unity
ent->wait = -1;
// ent->svFlags |= SVF_BROADCAST;