*Reintegrated the schimmery thing and prepped for some other fx.

--There's a warning (other that '/*') in cgame that I dont know how to resolve
*added floder maps for mapping resources
-- first in is a map for testing all the fx in all their functionality (fxtest)
This commit is contained in:
Harry Young 2011-12-12 00:36:04 +01:00
parent f8b8a8179d
commit de20d8ba89
8 changed files with 1270 additions and 65 deletions

View file

@ -1458,7 +1458,7 @@ Creates a basic cooking steam effect
VectorScale( dir, random() * 5 + 2, dir ); VectorScale( dir, random() * 5 + 2, dir );
FX_AddSprite( origin, dir, qfalse, radius, radius * 2, 0.4F, 0.0, 0, 0, 1000, cgs.media.steamShader ); FX_AddSprite( origin, dir, qfalse, radius, radius * 2, 0.4F, 0.0, 0, 0, 1000, cgs.media.steamShader );
}*/ }
/* /*
====================== ======================
CG_ElectricFire CG_ElectricFire
@ -1612,7 +1612,7 @@ bool ForgeBoltPulse( FXPrimitive *fx, centity_t *ent )
} }
//----------------------------- //-----------------------------
void CG_ForgeBolt( centity_t *cent ) /*void CG_ForgeBolt( centity_t *cent )
{ {
qboolean pulse; qboolean pulse;
int effects; int effects;
@ -1799,12 +1799,12 @@ The particles will accelerate up to the half-way point of the cylinder, then dec
{ {
vec3_t vel, accel, dir, pos, right, up; vec3_t vel, accel, dir, pos, right, up;
float len, time, acceleration, scale, dis, vf; float len, time, acceleration, scale, dis, vf;
int t;
VectorSubtract( cent->currentState.origin2, cent->lerpOrigin, dir ); VectorSubtract( cent->currentState.origin2, cent->lerpOrigin, dir );
len = VectorNormalize( dir ); len = VectorNormalize( dir );
MakeNormalVectors( dir, right, up ); MakeNormalVectors( dir, right, up );
for ( int t=0; t < 3; t++ ) for ( t=0; t < 3; t++ )
{ {
// Create start offset within a circular radius // Create start offset within a circular radius
VectorMA( cent->lerpOrigin, 8 * crandom(), right, pos ); VectorMA( cent->lerpOrigin, 8 * crandom(), right, pos );
@ -1824,7 +1824,7 @@ The particles will accelerate up to the half-way point of the cylinder, then dec
// These will spawn at the base and accelerate towards the middle // These will spawn at the base and accelerate towards the middle
if ( rand() & 1 ) if ( rand() & 1 )
{ {
FX_AddSprite( pos, vel, accel, FX_AddSprite3( pos, vel, accel,
scale, 0.0f, scale, 0.0f,
1.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f,
@ -1834,7 +1834,7 @@ The particles will accelerate up to the half-way point of the cylinder, then dec
} }
else else
{ {
FX_AddSprite( pos, vel, accel, FX_AddSprite3( pos, vel, accel,
scale, 0.0f, scale, 0.0f,
1.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f,
@ -1852,7 +1852,7 @@ The particles will accelerate up to the half-way point of the cylinder, then dec
if ( rand() & 1 ) if ( rand() & 1 )
{ {
FX_AddSprite( pos, vel, accel, FX_AddSprite3( pos, vel, accel,
scale, 0.0f, scale, 0.0f,
0.0f, 1.0f, 0.0f, 1.0f,
0.0f, 0.0f,
@ -1862,7 +1862,7 @@ The particles will accelerate up to the half-way point of the cylinder, then dec
} }
else else
{ {
FX_AddSprite( pos, vel, accel, FX_AddSprite3( pos, vel, accel,
scale, 0.0f, scale, 0.0f,
0.0f, 1.0f, 0.0f, 1.0f,
0.0f, 0.0f,
@ -1879,7 +1879,7 @@ CG_ExplosionTrail
------------------------- -------------------------
*/ */
/*bool explosionTrailThink( FXPrimitive *fx, centity_t *ent ) /*qboolean explosionTrailThink( localEntity_t *fx )
{ {
localEntity_t *le=0; localEntity_t *le=0;
vec3_t direction, origin, new_org, angles, dir; vec3_t direction, origin, new_org, angles, dir;
@ -1901,7 +1901,7 @@ CG_ExplosionTrail
// Maybe something else should be done as well... // Maybe something else should be done as well...
remove = qtrue; remove = qtrue;
//FIXME: FX_RemoveEffect( fx ); //FIXME: FX_RemoveEffect( fx );
return false; return qfalse;
} }
scale = 80 * 0.03f; scale = 80 * 0.03f;
@ -1931,7 +1931,7 @@ CG_ExplosionTrail
CG_ExplosionEffects( origin, 3.0f, 600 ); CG_ExplosionEffects( origin, 3.0f, 600 );
G_RadiusDamage( origin, ent->gent, 150, 80, NULL, MOD_UNKNOWN ); G_RadiusDamage( origin, ent->gent, 150, 80, NULL, MOD_UNKNOWN );
return true; return qtrue;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -1940,12 +1940,12 @@ void CG_ExplosionTrail( centity_t *cent )
vec3_t dir; vec3_t dir;
float len; float len;
VectorSubtract( cent->currentState.origin2, cent->lerpOrigin, dir ); VectorSubtract( cent->currentState.origin2, cent->currentState.origin, dir );
len = VectorNormalize( dir ); len = VectorNormalize( dir );
VectorScale( dir, 325, dir ); VectorScale( dir, 325, dir );
FX_AddParticle( cent, cent->lerpOrigin, dir, NULL, 16, 0.0, 1.0, 1.0, FX_AddParticle( cent->currentState.origin, dir, qfalse, 16, 0.0, 1.0, 1.0,
0.0, 0.0, 6000, cgs.media.ltblueParticleShader, FXF_NODRAW, explosionTrailThink ); 0.0, 0.0, 6000, cgs.media.ltblueParticleShader, explosionTrailThink );
} }
/* /*
@ -1966,7 +1966,7 @@ A scanning type beam
vectoangles( normal, angles ); vectoangles( normal, angles );
alpha = Vector4to3( cent->gent->startRGBA, rgb ); alpha = Vector4to3( cent->gent->startRGBA, rgb );
/* // Code to make the thing "snap" when it's doing the beam slices // Code to make the thing "snap" when it's doing the beam slices
if ( abs( cent->gent->pos2[0] ) >= cent->gent->radius ) if ( abs( cent->gent->pos2[0] ) >= cent->gent->radius )
{ {
// Snap back to start and move to the next slice // Snap back to start and move to the next slice
@ -1982,9 +1982,9 @@ A scanning type beam
// Always move across the slice // Always move across the slice
cent->gent->pos2[0] -= ( cg.frametime * 0.001 * cent->gent->speed ); cent->gent->pos2[0] -= ( cg.frametime * 0.001 * cent->gent->speed );
*/
/*if ( cent->gent->spawnflags & 2 )
if ( cent->gent->spawnflags & 2 )
{ {
// Trace a cone // Trace a cone
angles[2] = cent->gent->angle; angles[2] = cent->gent->angle;
@ -2029,32 +2029,34 @@ Kind of looks like a teleporter effect
---------------------- ----------------------
*/ */
/*void CG_ShimmeryThing( vec3_t start, vec3_t end, float radius, qboolean taper ) void CG_ShimmeryThing( vec3_t start, vec3_t end, vec3_t content )
{ {
vec3_t normal, angles, base, top, dir; vec3_t normal, angles, base, top, dir;
float len; float len;
int i;
int taper = content[2];
VectorSubtract( end, start, normal ); VectorSubtract( end, start, normal );
len = VectorNormalize( normal ); len = VectorNormalize( normal );
vectoangles( normal, angles ); vectoangles( normal, angles );
for ( int i=0; i < 2; i++) for ( i=0; i < 2; i++)
{ {
// Spawn the shards of light around a cylinder // Spawn the shards of light around a cylinder
angles[2] = crandom() * 360; angles[2] = crandom() * 360;
AngleVectors( angles, NULL, dir, NULL ); AngleVectors( angles, NULL, dir, NULL );
// See if the effect should be tapered at the top // See if the effect should be tapered at the top
if ( taper ) if ( taper = 2 )
{ {
VectorMA( start, radius * 0.25f, dir, top ); VectorMA( start, content[1] * 0.25f, dir, top );
} }
else else
{ {
VectorMA( start, radius, dir, top ); VectorMA( start, content[1], dir, top );
} }
VectorMA( end, radius, dir, base ); VectorMA( end, content[1], dir, base );
// Use a couple of different kinds to break up the monotony.. // Use a couple of different kinds to break up the monotony..
if ( rand() & 1 ) if ( rand() & 1 )
@ -2068,24 +2070,6 @@ Kind of looks like a teleporter effect
} }
} }
/*
-------------------------
CG_ShimmeryThing_Spawner
-------------------------
*/
/*void CG_Shimmer( vec3_t position, vec3_t dest, vec3_t dir, vec3_t other )
{
CG_ShimmeryThing( position, dest, other[0], (qboolean) other[1] );
}
void CG_ShimmeryThing_Spawner( vec3_t start, vec3_t end, float radius, qboolean taper, int duration )
{
vec3_t packed = { radius, (float) taper, 0 };
FX_AddSpawner( start, end, NULL, packed, 100, 0, duration, (void *) CG_Shimmer, NULL, 512 );
}
/* /*
---------------------- ----------------------
CG_Borg_Bolt CG_Borg_Bolt
@ -2093,12 +2077,13 @@ CG_Borg_Bolt
Yellow bolts that spark when the endpoints get close together Yellow bolts that spark when the endpoints get close together
---------------------- ----------------------
*/ */
/*void CG_Borg_Bolt( centity_t *cent ) /*void CG_Borg_Bolt( centity_t *cent )
{ {
vec3_t diff, neworg, start, end; vec3_t diff, neworg, start, end;
float len; float len;
if (!cent->gent->enemy){ if (!cent->gent->enemy){ // need sth to trace target
return;//we lost him return;//we lost him
} }
VectorCopy( cent->gent->enemy->currentOrigin, end ); VectorCopy( cent->gent->enemy->currentOrigin, end );

View file

@ -1791,60 +1791,60 @@ case EV_SHAKE_SOUND:
// Additional ports from SP by Harry Young // Additional ports from SP by Harry Young
/*case EV_FX_COOKING_STEAM: case EV_FX_COOKING_STEAM:
DEBUGNAME("EV_FX_COOKING_STEAM"); DEBUGNAME("EV_FX_COOKING_STEAM");
CG_CookingSteam( cent->lerpOrigin, cent->currentState.angles[0] ); //CG_CookingSteam( cent->lerpOrigin, cent->currentState.angles[0] );
break; break;
/*case EV_FX_ELECFIRE: case EV_FX_ELECFIRE:
DEBUGNAME("EV_FX_ELECFIRE"); DEBUGNAME("EV_FX_ELECFIRE");
// Don't play this sound quite so much... // Don't play this sound quite so much...
if ( rand() & 1 ) if ( rand() & 1 )
{ {
cgi_S_StartSound (NULL, es->number, CHAN_BODY, cgi_S_RegisterSound ( va("sound/ambience/spark%d.wav", Q_irand(1,6)) )); //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->lerpOrigin, cent->currentState.angles );
break; break;
case EV_FX_FORGE_BOLT: case EV_FX_FORGE_BOLT:
DEBUGNAME("EV_FX_FORGE_BOLT"); DEBUGNAME("EV_FX_FORGE_BOLT");
CG_ForgeBolt( cent ); //CG_ForgeBolt( cent );
break; break;
case EV_FX_PLASMA: case EV_FX_PLASMA:
DEBUGNAME("EV_FX_PLASMA"); DEBUGNAME("EV_FX_PLASMA");
CG_Plasma( cent->lerpOrigin, cent->currentState.origin2, cent->gent->startRGBA, cent->gent->finalRGBA ); //CG_Plasma( cent->currentState.origin, cent->currentState.origin2, cent->currentState.angles, cent->currentState.angles2 ); // RGBA's
break; break;
case EV_FX_STREAM: case EV_FX_STREAM:
DEBUGNAME("EV_FX_STREAM"); DEBUGNAME("EV_FX_STREAM");
CG_ParticleStream( cent ); //CG_ParticleStream( cent );
break; break;
case EV_FX_TRANSPORTER_STREAM: case EV_FX_TRANSPORTER_STREAM:
DEBUGNAME("EV_FX_TRANSPORTER_STREAM"); DEBUGNAME("EV_FX_TRANSPORTER_STREAM");
CG_TransporterStream( cent ); //CG_TransporterStream( cent );
break; break;
case EV_FX_EXPLOSION_TRAIL: case EV_FX_EXPLOSION_TRAIL:
DEBUGNAME("EV_FX_EXPLOSION_TRAIL"); DEBUGNAME("EV_FX_EXPLOSION_TRAIL");
CG_ExplosionTrail( cent ); //CG_ExplosionTrail( cent );
break; break;
case EV_FX_BORG_ENERGY_BEAM: case EV_FX_BORG_ENERGY_BEAM:
DEBUGNAME("EV_FX_BORG_ENERGY_BEAM"); DEBUGNAME("EV_FX_BORG_ENERGY_BEAM");
CG_BorgEnergyBeam( cent ); //CG_BorgEnergyBeam( cent );
break; break;
case EV_FX_SHIMMERY_THING: case EV_FX_SHIMMERY_THING:
DEBUGNAME("EV_FX_SHIMMERY_THING"); DEBUGNAME("EV_FX_SHIMMERY_THING");
CG_ShimmeryThing( cent->lerpOrigin, cent->currentState.origin2, cent->gent->radius, cent->gent->spawnflags & 2 ); CG_ShimmeryThing( cent->currentState.origin, cent->currentState.origin2, cent->currentState.angles ); // Radius and spawnflags
break; break;
case EV_FX_BORG_BOLT: case EV_FX_BORG_BOLT:
DEBUGNAME("EV_FX_BORG_BOLT"); DEBUGNAME("EV_FX_BORG_BOLT");
CG_Borg_Bolt( cent ); //CG_Borg_Bolt( cent );
break;*/ break;
// Default // Default

View file

@ -2042,6 +2042,11 @@ void CG_Drip(centity_t *cent, int killTime );
void CG_Chunks( vec3_t origin, vec3_t dir, float size, material_type_t type ); void CG_Chunks( vec3_t origin, vec3_t dir, float size, material_type_t type );
void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec3_t laserRGB, float alpha ); void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec3_t laserRGB, float alpha );
void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal ); void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal );
// Stasis_door-stuff
// Stasis_door-stuff
// Stasis_door-stuff
// Stasis_door-stuff
// Stasis_door-stuff
//TiM //TiM
void CG_FountainSpurt( vec3_t org, vec3_t end ); void CG_FountainSpurt( vec3_t org, vec3_t end );
@ -2055,7 +2060,19 @@ void CG_ParticleFire(vec3_t origin, int size);
void CG_ShowTrigger(centity_t *cent); void CG_ShowTrigger(centity_t *cent);
// Additional ports from SP by Harry Young // Additional ports from SP by Harry Young
//void CG_CookingSteam( vec3_t origin, float radius ); void CG_CookingSteam( vec3_t origin, float radius );
void CG_ElectricFire( vec3_t origin, vec3_t normal );
void ForgeBoltFireback( vec3_t start, vec3_t end, vec3_t velocity, vec3_t user );
void CG_ForgeBolt( centity_t *cent );
void CG_Plasma( vec3_t start, vec3_t end, vec4_t startRGBA, vec4_t endRGBA );
void CG_ParticleStream( centity_t *cent );
void CG_TransporterStream( centity_t *cent );
void CG_ExplosionTrail( centity_t *cent );
void CG_BorgEnergyBeam( centity_t *cent );
void CG_ShimmeryThing( vec3_t start, vec3_t end, vec3_t content );
void CG_Shimmer( vec3_t position, vec3_t dest, vec3_t dir, vec3_t other );
void CG_ShimmeryThing_Spawner( vec3_t start, vec3_t end, float radius, qboolean taper, int duration );
void CG_Borg_Bolt( centity_t *cent );
// //
// cg_weapons.c // cg_weapons.c

View file

@ -536,6 +536,80 @@ localEntity_t *FX_AddSprite2(vec3_t origin, vec3_t velocity, qboolean gravity, f
return(le); return(le);
} }
/*
===============
FX_AddSprite3
Adds a view oriented sprite to the FX wrapper render list
===============
*/
localEntity_t *FX_AddSprite3(vec3_t origin, vec3_t velocity, vec3_t acceleration, float scale, float dscale,
float startalpha, float endalpha, float roll, float elasticity,
float killTime, qhandle_t shader)
{
localEntity_t *le;
#ifdef _DEBUG
if (!shader)
{
Com_Printf("FX_AddSprite: NULL shader\n");
}
#endif
// Glow mark
le = CG_AllocLocalEntity();
le->leType = LE_VIEWSPRITE;
le->refEntity.data.sprite.rotation = roll;
le->startTime = cg.time;
le->endTime = le->startTime + killTime;
le->data.sprite.radius = scale;
le->data.sprite.dradius = dscale;
le->alpha = startalpha;
le->dalpha = endalpha - startalpha;
VectorSet(le->data.sprite.startRGB, 1, 1, 1);
VectorSet(le->data.sprite.dRGB, 0, 0, 0);
// le->refEntity.hModel = 0;
le->refEntity.customShader = shader;
// set origin
VectorCopy ( origin, le->refEntity.origin);
VectorCopy ( origin, le->refEntity.oldorigin );
le->color[0] = 1.0;
le->color[1] = 1.0;
le->color[2] = 1.0;
le->color[3] = startalpha;
le->lifeRate = 1.0 / ( le->endTime - le->startTime );
if (velocity)
{
le->leFlags |= LEF_MOVE;
VectorCopy (origin, le->pos.trBase);
VectorCopy (velocity, le->pos.trDelta);
if (acceleration) //how do i make this accellerate in the given direction?... lol, bee-fountain on forge3 now ^^
le->pos.trType = TR_GRAVITY;
else
le->pos.trType = TR_LINEAR;
le->pos.trTime = cg.time;
le->pos.trDuration = killTime;
if (elasticity > 0)
{
le->leFlags |= LEF_USE_COLLISION;
le->bounceFactor = elasticity;
}
}
return(le);
}
/* /*
=============== ===============
FX_AddBezier FX_AddBezier

View file

@ -26,6 +26,9 @@ localEntity_t *FX_AddSprite(vec3_t origin, vec3_t velocity, qboolean gravity, fl
localEntity_t *FX_AddSprite2(vec3_t origin, vec3_t velocity, qboolean gravity, float scale, float dscale, localEntity_t *FX_AddSprite2(vec3_t origin, vec3_t velocity, qboolean gravity, float scale, float dscale,
float startalpha, float endalpha, vec3_t startRGB, vec3_t endRGB, float roll, float elasticity, float startalpha, float endalpha, vec3_t startRGB, vec3_t endRGB, float roll, float elasticity,
float killTime, qhandle_t shader); float killTime, qhandle_t shader);
localEntity_t *FX_AddSprite3(vec3_t origin, vec3_t velocity, vec3_t acceleration, float scale, float dscale,
float startalpha, float endalpha, float roll, float elasticity,
float killTime, qhandle_t shader);
localEntity_t *FX_AddBezier(vec3_t start, vec3_t end, vec3_t cpoint1, vec3_t cpoint2, vec3_t cpointvel1, localEntity_t *FX_AddBezier(vec3_t start, vec3_t end, vec3_t cpoint1, vec3_t cpoint2, vec3_t cpointvel1,
vec3_t cpointvel2,vec3_t cpointacc1, vec3_t cpointacc2, float width, vec3_t cpointvel2,vec3_t cpointacc1, vec3_t cpointacc2, float width,
float killTime, qhandle_t shader); float killTime, qhandle_t shader);

View file

@ -1803,12 +1803,11 @@ Creates a shimmering cone or cylinder of colored light that stretches between tw
STARTOFF - Effect turns on when used. STARTOFF - Effect turns on when used.
TAPER - Cylinder tapers toward the top, creating a conical effect TAPER - Cylinder tapers toward the top, creating a conical effect
NO_AUTO_SHUTOFF - Tells the effect that it should never try to shut itself off.
"radius" - radius of the cylinder or of the base of the cone. (default 10) "radius" - radius of the cylinder or of the base of the cone. (default 10)
"target" (required) End point for stream. "target" (required) End point for stream.
"targetname" - fires only when used "targetname" - fires only when used
"wait" - how long to stay on before turning itself off ( default 2 seconds, -1 to disable auto shut off ) "wait" - how long in ms to stay on before turning itself off ( default 2 seconds (200 ms), -1 to disable auto shut off )
*/ */
@ -1817,7 +1816,7 @@ void shimmery_thing_think( gentity_t *ent )
{ {
G_AddEvent( ent, EV_FX_SHIMMERY_THING, 0 ); G_AddEvent( ent, EV_FX_SHIMMERY_THING, 0 );
if ( ent->wait >= 0 ) if ( ent->wait >= 0 )
ent->nextthink = level.time + ent->wait * 1000; ent->nextthink = level.time + ent->wait;
else else
ent->nextthink = -1; ent->nextthink = -1;
} }
@ -1827,7 +1826,7 @@ void shimmery_thing_use( gentity_t *self, gentity_t *other, gentity_t *activator
{ {
if ( self->count ) if ( self->count )
{ {
self->think = borg_energy_beam_think; self->think = shimmery_thing_think;
self->nextthink = level.time + 200; self->nextthink = level.time + 200;
} }
else else
@ -1862,6 +1861,7 @@ void shimmery_thing_link( gentity_t *ent )
} }
ent->count = !(ent->spawnflags & 1); ent->count = !(ent->spawnflags & 1);
if (ent->spawnflags & 2) ent->s.angles[2] = 2;
if (!ent->targetname || !(ent->spawnflags & 1) ) if (!ent->targetname || !(ent->spawnflags & 1) )
{ {
@ -1883,14 +1883,12 @@ void shimmery_thing_link( gentity_t *ent )
//------------------------------------------ //------------------------------------------
void SP_fx_shimmery_thing( gentity_t *ent ) void SP_fx_shimmery_thing( gentity_t *ent )
{ {
G_SpawnFloat( "radius", "10", &ent->distance ); G_SpawnFloat( "radius", "10", &ent->s.angles[1] );
if ( !ent->wait ) if ( !ent->wait )
ent->wait = 2; ent->wait = 2000;
// ent->svFlags |= SVF_BROADCAST; // ent->svFlags |= SVF_BROADCAST;
VectorCopy( ent->s.origin, ent->s.pos.trBase );
ent->think = shimmery_thing_link; ent->think = shimmery_thing_link;
ent->nextthink = level.time + 1000; ent->nextthink = level.time + 1000;

BIN
maps/fxtest.bsp Normal file

Binary file not shown.

1128
maps/fxtest.map Normal file

File diff suppressed because it is too large Load diff