Removed more unsued stuff, renamed more files

This commit is contained in:
Walter Julius Hennecke 2011-12-05 09:58:30 +01:00
parent 339b3a9e0b
commit 12ed3c567a
6 changed files with 343 additions and 700 deletions

View file

@ -27,7 +27,7 @@ endif
OBJ = \
fx_transporter.o \
fx_tetrion.o \
fx_stasis.o \
fx_disruptor.o \
fx_hypospray.o \
fx_quantum.o \
fx_phaser.o \
@ -103,7 +103,7 @@ fx_misc.o : fx_misc.c; $(DO_CC)
fx_phaser.o : fx_phaser.c; $(DO_CC)
fx_quantum.o : fx_quantum.c; $(DO_CC)
fx_hypospray.o : fx_hypospray.c; $(DO_CC)
fx_stasis.o : fx_stasis.c; $(DO_CC)
fx_disruptor.o : fx_disruptor.c; $(DO_CC)
fx_tetrion.o : fx_tetrion.c; $(DO_CC)
fx_transporter.o : fx_transporter.c; $(DO_CC)

View file

@ -2194,7 +2194,7 @@ void CG_MissileHitWall( centity_t *cent, int weapon, vec3_t origin, vec3_t dir )
return;
break;
case WP_DISRUPTOR:
FX_StasisWeaponHitWall( origin, dir, 2 ); //cent->currentState.time2
FX_DisruptorWeaponHitWall( origin, dir, 2 ); //cent->currentState.time2
return;
break;
case WP_NULL_HAND:

296
cgame/fx_disruptor.c Normal file
View file

@ -0,0 +1,296 @@
#include "cg_local.h"
#include "fx_local.h"
/*
-------------------------
FX_OrientedBolt
Creates new bolts for a while
-------------------------
*/
void FX_OrientedBolt( vec3_t start, vec3_t end, vec3_t dir )
{
vec3_t mid;
VectorSubtract( end, start, mid );
VectorScale( mid, 0.1f + (random() * 0.8), mid );
VectorAdd( start, mid, mid );
VectorMA(mid, 3.0f + (random() * 10.0f), dir, mid );
//FX_AddElectricity( mid, start, 0.5, 0.75 + random() * 0.75, 0.0, 1.0, 0.5, 300.0f + random() * 300, cgs.media.bolt2Shader, DEFAULT_DEVIATION);
//FX_AddElectricity( mid, end, 0.5, 0.75 + random() * 0.75, 1.0, 1.0, 0.5, 300.0f + random() * 300, cgs.media.bolt2Shader, DEFAULT_DEVIATION);
FX_AddElectricity( mid, start, 0.5, 0.75 + random() * 0.75, 0.0, 1.0, 0.5, 300.0f + random() * 300, cgs.media.borgLightningShaders[2], DEFAULT_DEVIATION);
FX_AddElectricity( mid, end, 0.5, 0.75 + random() * 0.75, 1.0, 1.0, 0.5, 300.0f + random() * 300, cgs.media.borgLightningShaders[3], DEFAULT_DEVIATION);
}
/*
-------------------------
FX_DisruptorDischarge
Fun "crawling" electricity ( credit goes to Josh for this one )
-------------------------
*/
void FX_DisruptorDischarge( vec3_t origin, vec3_t normal, int count, float dist_out, float dist_side )
{
trace_t trace;
vec3_t org, dir, dest;
vec3_t vr;
int i;
int discharge = dist_side;
vectoangles( normal, dir );
dir[ROLL] += random() * 360;
for (i = 0; i < count; i++)
{
//Move out a set distance
VectorMA( origin, dist_out, normal, org );
//Even out the hits
dir[ROLL] += (360 / count) + (rand() & 31);
AngleVectors( dir, NULL, vr, NULL );
//Move to the side in a random direction
discharge += (int)( crandom() * 8.0f );
VectorMA( org, discharge, vr, org );
//Trace back to find a surface
VectorMA( org, -dist_out * 3, normal, dest );
CG_Trace( &trace, org, NULL, NULL, dest, 0, MASK_SHOT );
//No surface found, start over
if (trace.fraction == 1)
continue;
//Connect the two points with bolts
FX_OrientedBolt( origin, trace.endpos, normal );
//TiM : Aww screw it. Add a lens flare. ^_^
CG_InitLensFlare( trace.endpos,
10, 10,
colorTable[CT_GREEN], 1.2, 2.0, 1600, 500,
colorTable[CT_GREEN], 1600, 500, 100, 5, qtrue,
0, 0, qfalse, qtrue,
qfalse, 1.0, cg.time, 0, 0, 300.0f + random() * 300);
}
}
/*
-------------------------
FX_DisruptorWeaponHitWall
Main fire impact
-------------------------
*/
#define NUM_DISCHARGES 6
#define DISCHARGE_DIST 8
#define DISCHARGE_SIDE_DIST 24
void FX_DisruptorWeaponHitWall( vec3_t origin, vec3_t dir, int size )
{
vec3_t vel, /*accel,*/ hitpos, direction, org;
//int i, t;
weaponInfo_t *weaponInfo = &cg_weapons[WP_DISRUPTOR];
CG_InitLensFlare( origin,
375, 375,
colorTable[CT_GREEN], 1.2, 2.0, 1600, 200,
colorTable[CT_GREEN], 1600, 200, 800, 20, qtrue,
0, 0, qfalse, qtrue,
qfalse, 1.0, cg.time, 0, 0, 200);
// Generate "crawling" electricity // eh, don't it doesn't look that great.
FX_DisruptorDischarge( origin, dir, NUM_DISCHARGES, DISCHARGE_DIST, DISCHARGE_SIDE_DIST );
VectorMA(origin, size, dir, hitpos);
// Set an oriented residual glow effect
FX_AddQuad( hitpos, dir, size * size * 15.0f, -150.0f,
1.0f, 0.0f, 0, 300, cgs.media.greenParticleShader );
CG_ImpactMark( cgs.media.scavMarkShader, origin, dir, random()*360, 1,1,1,0.6, qfalse,
size * 12 + 1, qfalse );
FX_AddSprite( hitpos, NULL, qfalse, size * size * 15.0f, -150.0f,
1.0f, 0.0f, 360*random(), 0, 400, cgs.media.greenParticleShader );
/* FX_AddSprite( hitpos, NULL, qfalse, size * size * 15.0f, -150.0f,
1.0f, 0.0f, 360*random(), 0, 400, cgs.media.greenParticleStreakShader ); */
FX_AddSprite( hitpos, NULL, qfalse, size * size * 25.0f, -150.0f,
1.0f, 0.0f, 0.0f, 0, 400, cgs.media.greenParticleStreakShader );
VectorSubtract( cg.refdef.vieworg, origin, direction );
VectorNormalize( direction );
VectorMA( origin, 12, direction, org );
VectorMA( org, 8, dir, direction );
VectorSet(vel, 0, 0, 32 ); //8
FX_AddSprite( origin,
vel, qfalse,
random() * 4 + 2, 12,
0.6 + random() * 0.4, 0.0,
random() * 180,
0.0,
random() * 200 + 1200, //300
cgs.media.steamShader );
//FX_AddSprite(
// Only play the impact sound and throw off the purple particles when it's the main projectile
/* if ( size < 3 )
return;
for ( i = 0; i < 4; i++ )
{
for ( t = 0; t < 3; t++ )
vel[t] = ( dir[t] + crandom() * 0.9 ) * ( random() * 100 + 250 );
VectorScale( vel, -2.2, accel );
FX_AddSprite( hitpos, vel, qfalse, random() * 8 + 8, 0, 1.0, 0.0, 0.0, 0.0, 200, cgs.media.purpleParticleShader );
}*/
trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, weaponInfo->mainHitSound );
}
void FX_DisruptorBeamFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean spark, qboolean impact, qboolean empty )
{
refEntity_t beam;
sfxHandle_t sfx;
float size;
vec3_t velocity;
int sparks;
vec3_t rgb = { 1,0.9,0.6}, rgb2={1,0.3,0};
//vec3_t rgb3 = { 1.0, 1.0, 1.0 };
sfx = 0;
// Draw beam first.
memset( &beam, 0, sizeof( beam ) );
VectorCopy( startpos, beam.origin);
VectorCopy( endpos, beam.oldorigin );
beam.reType = RT_LINE;
if (empty)
{
beam.customShader = cgs.media.phaserEmptyShader;
}
else
{
beam.customShader = cgs.media.disruptorBeam;
}
AxisClear( beam.axis );
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
beam.shaderRGBA[3] = 0xff;
if (empty)
{
beam.data.line.width = 1.0f + ( crandom() * 0.6f );
}
else
{
beam.data.line.width = 1.5f + ( crandom() * 0.6f );
}
beam.data.line.stscale = 5.0;
trap_R_AddRefEntityToScene( &beam );
// Now draw the hit graphic
// no explosion at LG impact, it is added with the beam
if ( sfx )
{
Com_Printf("playing %s\n", "phaser sound");
trap_S_StartSound( endpos, ENTITYNUM_WORLD, CHAN_AUTO, sfx );
}
//
// impact mark
//
if (impact)
{
if (!empty)
{ // normal.
CG_ImpactMark( cgs.media.scavMarkShader, endpos, normal, random()*360, 1,1,1,0.2, qfalse,
random() + 1, qfalse );
//VectorCopy( endpos, phaserFlare.worldCoord );
/*CG_InitLensFlare( endpos,
80,
80,
rgb,
1.2,
1.5,
1600,
200,
colorTable[CT_BLACK],
1600,
200,
80,
5,
qfalse,
5,
40,
qfalse,
qfalse,
qfalse,
1.0,
1.0,
200.0,
200.0,
200.0 );*/
//CG_InitLensFlare( endpos,
// 30, 30,
// rgb, 1.2, 2.0, 1600, 200,
// colorTable[CT_BLACK], 1600, 200, 410, 15, qfalse,
// 0, 0, qfalse, qtrue,
// qfalse, 1.0, cg.time, 0, 0, 50);
//TiM : Add your basic cheesy 'seen-way-too-much-in-movies-these-days' anamorphic lens streak :)
//CG_DrawLensFlare( &phaserFlare );
//FX_AddSprite( endpos, NULL, qfalse, random() * 1.25 + 5.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 50.0, cgs.media.blueParticleStreakShader ); //1.5f
//FX_AddQuad2( endpos, normal, random() * 1.25 + 8.0f, 0.0f, 1.0f, 1.0f, rgb3, rgb3, 270, 50.0, cgs.media.blueParticleStreakShader );
//eh... looked bad :P
FX_AddQuad2( endpos, normal, random() * 1.25 + 1.5f, 0.0f, 1.0f, 0.0f, rgb, rgb2, rand() % 360, 500 + random() * 200,
cgs.media.sunnyFlareShader );
}
else
{ // Wuss hit when empty.
FX_AddQuad2( endpos, normal, random() * .75 + 1.0f, 0.0f, 0.5f, 0.0f, rgb, rgb2, rand() % 360, 300 + random() * 200,
cgs.media.sunnyFlareShader );
}
}
// "Fun" sparks... Not when empty.
if ( spark && !empty)
{
sparks = (rand() & 1) + 1;
for(;sparks>0;sparks--)
{
size = 0.2f + (random() * 0.4);
FXE_Spray( normal, 200, 75, 0.8f, velocity);
if (rand() & LEF_USE_COLLISION)
{ // This spark bounces.
FX_AddTrail( endpos, velocity, qtrue, 5.0f, -15.0f,
size, -size, 1.0f, 0.5f, 0.4f, 500.0f, cgs.media.sparkShader);
}
else
{
FX_AddTrail( endpos, velocity, qtrue, 5.0f, -15.0f,
size, -size, 1.0f, 0.5f, 0.0, 500.0f, cgs.media.sparkShader);
}
}
}
}

View file

@ -1,9 +1,9 @@
#define DEFAULT_DEVIATION 0.5
//
// fx_*.c
//
/*
* fx_*.c
*/
void FXE_Spray (vec3_t direction, float speed, float variation, float cone, vec3_t velocity);
localEntity_t *FX_AddLine(vec3_t start, vec3_t end, float stScale, float scale, float dscale,
@ -53,57 +53,43 @@ localEntity_t *FX_AddParticle( vec3_t origin, vec3_t velocity, qboolean gravity,
localEntity_t *FX_AddSpawner( vec3_t origin, vec3_t dir, vec3_t velocity, vec3_t user, qboolean gravity, int delay,
float variance, float killTime, qboolean (*thinkFn)(localEntity_t *le), int radius );
//
// phaser
//
/*
* phaser
*/
void FX_PhaserFire( vec3_t start, vec3_t end, vec3_t normal, qboolean spark, qboolean impact, qboolean empty );
void FX_PhaserAltFire( vec3_t start, vec3_t end, vec3_t normal, qboolean spark, qboolean impact, qboolean empty );
//
// compression rifle
//
/*
* compression rifle
*/
void FX_CompressionShot( vec3_t start, vec3_t end );
void FX_CompressionAltShot( vec3_t start, vec3_t end );
void FX_CompressionExplosion( vec3_t start, vec3_t origin, vec3_t normal, qboolean altfire );
void FX_CompressionHit( vec3_t origin );
//void FX_CompressionHitWall( vec3_t origin, vec3_t dir );
void FX_PrifleBeamFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean spark, qboolean impact, qboolean empty );
void FX_ProbeBeam( vec3_t origin, vec3_t dir, int clientNum, qboolean alt_fire );
void FX_RegenBeam( vec3_t origin, vec3_t dir, int clientNum, qboolean alt_fire );
//
// imod
//
//void FX_IMODShot( vec3_t end, vec3_t start, vec3_t dir);
//void FX_IMODExplosion( vec3_t origin, vec3_t normal );
//void FX_AltIMODShot( vec3_t end, vec3_t start, vec3_t dir );
//void FX_AltIMODExplosion( vec3_t origin, vec3_t normal );
//
// tetrion disruptor
//
/*
* tetrion disruptor
*/
//void FX_TetrionProjectileThink( centity_t *cent, const struct weaponInfo_s *wi );
void FX_TetrionShot( vec3_t start, vec3_t forward );
void FX_TetrionWeaponHitWall( vec3_t origin, vec3_t normal );
//void FX_TetrionRicochet( vec3_t origin, vec3_t normal );
//void FX_TetrionAltHitWall( vec3_t origin, vec3_t normal );
void FX_TetrionAltHitPlayer( vec3_t origin, vec3_t normal );
//
// Scavenger Rifle
//
/*
* Scavenger Rifle
*/
void FX_HypoSpray( vec3_t origin, vec3_t dir, qboolean red );
//void FX_ScavengerProjectileThink( centity_t *ent, const weaponInfo_t *wi );
//void FX_ScavengerAltFireThink( centity_t *ent, const weaponInfo_t *wi );
//void FX_ScavengerWeaponHitWall( vec3_t origin, vec3_t normal, qboolean fired_by_NPC );
//void FX_ScavengerWeaponHitPlayer( vec3_t origin, vec3_t normal, qboolean fired_by_NPC );
//void FX_ScavengerAltExplode( vec3_t origin, vec3_t dir );
//
// Grenade launcher
//
/*
* Grenade launcher
*/
void FX_GrenadeThink( centity_t *cent, const struct weaponInfo_s *weapon );
void FX_GrenadeHitWall( vec3_t origin, vec3_t normal );
void FX_GrenadeHitPlayer( vec3_t origin, vec3_t normal );
@ -113,39 +99,21 @@ void FX_GrenadeShrapnelBits( vec3_t start);
void FX_fxfunc_Explosion( vec3_t start, vec3_t origin, vec3_t normal );
void FX_fxfunc_Shot( vec3_t start, vec3_t dir );
// Borg FX
//void FX_BorgProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
//void FX_BorgWeaponHitWall( vec3_t origin, vec3_t normal );
//void FX_BorgTaser( vec3_t start, vec3_t end );
//void FX_BorgEyeBeam( vec3_t start, vec3_t end, vec3_t normal, qboolean large );
//void FX_BorgTeleport( vec3_t origin );
//void FX_BorgTeleportTrails( vec3_t origin );// effect seen by other borg when you are in a mid-teleport
//
// detpack
//
/*
* detpack
*/
void FX_Detpack(vec3_t origin);
//
// Stasis Weapon
//
//Disruptor
/*
* Disruptor Weapon
*/
void FX_DisruptorBeamFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean spark, qboolean impact, qboolean empty );
void FX_DisruptorWeaponHitWall( vec3_t origin, vec3_t dir, int size );
//void FX_StasisProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
void FX_StasisWeaponHitWall( vec3_t origin, vec3_t dir, int size );
//void FX_StasisWeaponHitPlayer( vec3_t origin, vec3_t dir, int size );
//void FX_StasisShot( centity_t *cent, vec3_t end, vec3_t start );
//void FX_StasisShotImpact( vec3_t end, vec3_t dir );
//void FX_StasisShotMiss( vec3_t end, vec3_t dir );
//
// Quantum Burst
//
/*
* Quantum Burst
*/
void FX_QuantumThink( centity_t *cent, const struct weaponInfo_s *weapon );
void FX_QuantumAltThink( centity_t *cent, const struct weaponInfo_s *weapon );
void FX_QuantumHitWall( vec3_t origin, vec3_t normal );
@ -153,45 +121,41 @@ void FX_QuantumAltHitWall( vec3_t origin, vec3_t normal );
void FX_QuantumColumns( vec3_t origin );
//
// Dreadnought
//
/*
* Dreadnought
*/
//void FX_DreadnoughtHitWall( vec3_t origin, vec3_t normal, qboolean spark );
//void FX_DreadnoughtFire( vec3_t origin, vec3_t end, vec3_t normal, qboolean spark, qboolean impact );
//void FX_DreadnoughtProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
//void FX_DreadnoughtShotMiss( vec3_t end, vec3_t dir );
//
// transporter
//
/*
* transporter
*/
void FX_Transporter(vec3_t origin);
void FX_TransporterPad( vec3_t origin );
void FX_SPTransporterLensFlares( centity_t* cent, vec3_t headVector, int startTime );
// Holdable, portable shield item
/* Holdable, portable shield item */
void FX_DrawPortableShield(centity_t *cent);
// Shield
/* Shield */
void FX_PlayerShieldHit( centity_t *cent );
//
// Miscellaneous FX
//
/*
* Miscellaneous FX
*/
void FX_Disruptor( vec3_t org, float length );
void FX_ExplodeBits( vec3_t org);
void FX_qFlash( centity_t* cent, vec3_t org, int timeIndex );
//
// sin table
//
/*
* sin table
*/
void fxRandCircumferencePos(vec3_t center, vec3_t normal, float radius, vec3_t out);

View file

@ -1,617 +0,0 @@
#include "cg_local.h"
#include "fx_local.h"
void FX_StasisDischarge( vec3_t origin, vec3_t normal, int count, float dist_out, float dist_side );
#define FX_STASIS_ALT_RIGHT_OFS 0.10
#define FX_STASIS_ALT_UP_OFS 0.02
#define FX_STASIS_ALT_MUZZLE_OFS 1
#define FX_MAXRANGE_STASIS 4096
/*
-------------------------
FX_StasisShot
Alt-fire, beam that shrinks to its impact point
-------------------------
*/
/*void FX_SmallStasisBeam(centity_t *cent, vec3_t start, vec3_t dir)
{
vec3_t end, org, vel = { 0,0,-4};
trace_t tr;
float r;
int i, ct, t;
VectorMA(start, FX_MAXRANGE_STASIS, dir, end);
CG_Trace(&tr, start, NULL, NULL, end, cent->currentState.number, MASK_SHOT);
// Beam
// FX_AddLine( start, tr.endpos, 1.0f, 3.0f, 4.0f, 0.8f, 0.0f, 400.0f, cgs.media.stasisAltShader);
// Do a quick LOD for number of decay particles
ct = tr.fraction * (FX_MAXRANGE_STASIS * 0.02);
if ( ct < 12 )
ct = 12;
else if ( ct > 24 )
ct = 24;
for ( i = 0; i < ct; i++ )
{
r = random() * tr.fraction * (FX_MAXRANGE_STASIS * 0.5);
VectorMA( start, r, dir, org );
for ( t = 0; t < 3; t++ )
org[t] += crandom();
if ( rand() & 1 )
FX_AddSprite( org, vel, qfalse, random() + 1.5, -3, 1.0, 1.0, 0.0, 0.0, 500, cgs.media.blueParticleShader);
else
FX_AddSprite( org, vel, qfalse, random() + 1.5, -3, 1.0, 1.0, 0.0, 0.0, 500, cgs.media.purpleParticleShader);
}
// Impact graphic if needed.
if (cg_entities[tr.entityNum].currentState.eType == ET_PLAYER)
{ // Hit an entity.
// Expanding rings
// FX_AddSprite( tr.endpos, NULL, qfalse, 1, 60, 0.8, 0.2, random() * 360, 0, 400, cgs.media.stasisRingShader );
// Impact effect
// FX_AddSprite( tr.endpos, NULL, qfalse, 7, 25, 1.0, 0.0, random() * 360, 0, 500, cgs.media.blueParticleShader );
FX_AddSprite( tr.endpos, NULL, qfalse, 5, 18, 1.0, 0.0, random() * 360, 0, 420, cgs.media.ltblueParticleShader );
}
else if (!(tr.surfaceFlags & SURF_NOIMPACT) )
{
// Move me away from the wall a bit so that I don't z-buffer into it
VectorMA( tr.endpos, 1.5, tr.plane.normal, end);
// Expanding rings
// FX_AddQuad( end, tr.plane.normal, 1, 12, 0.8, 0.2, random() * 360, 400, cgs.media.stasisRingShader );
// FX_AddQuad( end, tr.plane.normal, 1, 30, 0.8, 0.2, random() * 360, 300, cgs.media.stasisRingShader );
// Impact effect
FX_AddQuad( end, tr.plane.normal, 4, 16, 1.0, 0.0, random() * 360, 500, cgs.media.blueParticleShader );
FX_AddQuad( end, tr.plane.normal, 3, 12, 1.0, 0.0, random() * 360, 420, cgs.media.ltblueParticleShader );
CG_ImpactMark( cgs.media.scavMarkShader, end, tr.plane.normal, random()*360, 1,1,1,0.6, qfalse,
5 + random() * 2, qfalse );
}
FX_AddSprite( tr.endpos, NULL, qfalse, flrandom(40,60), -50, 1.0, 0.0, random() * 360, 0, 500, cgs.media.blueParticleShader );
// Pass the end position back to the calling function (yes, I know).
VectorCopy(tr.endpos, dir);
}*/
// kef -- fixme. the altfire stuff really wants to use some endcap stuff and some other flags
/*void FX_StasisShot( centity_t *cent, vec3_t end, vec3_t start )
{
trace_t tr;
vec3_t fwd, newdir, org, vel = { 0,0,-4}, newstart, end2;
int i, t, ct;
float len, r;
vec3_t fwd2, right, up;
int bolt1, bolt2;
vec3_t bolt1vec, bolt2vec;
centity_t *traceEnt = NULL;
int clientNum = -1;
// Choose which bolt will have the electricity accent.
bolt1 = irandom(0,2);
bolt2 = irandom(0,4);
VectorSubtract( end, start, fwd );
len = VectorNormalize( fwd );
// Beam
// FX_AddLine( end, start, 1.0f, 4.0f, 6.0f, 0.8f, 0.0f, 500.0f, cgs.media.stasisAltShader);
// Do a quick LOD for number of decay particles
ct = len * 0.03;
if ( ct < 16 )
ct = 16;
else if ( ct > 32 )
ct = 32;
for ( i = 0; i < ct; i++ )
{
r = random() * len * 0.5;
VectorMA( start, r, fwd, org );
for ( t = 0; t < 3; t++ )
org[t] += crandom();
if ( rand() & 1 )
FX_AddSprite( org, vel, qfalse, random() + 2, -4, 1.0, 1.0, 0.0, 0.0, 600, cgs.media.blueParticleShader);
else
FX_AddSprite( org, vel, qfalse, random() + 2, -4, 1.0, 1.0, 0.0, 0.0, 600, cgs.media.purpleParticleShader);
}
VectorMA(start, FX_MAXRANGE_STASIS, fwd, end2);
CG_Trace(&tr, start, NULL, NULL, end2, cent->currentState.number, MASK_SHOT);
if (!( tr.surfaceFlags & SURF_NOIMPACT ))
{
traceEnt = &cg_entities[tr.entityNum];
clientNum = traceEnt->currentState.clientNum;
if ( (tr.entityNum != ENTITYNUM_WORLD) && (clientNum >= 0 || clientNum < MAX_CLIENTS) )
{
// hit a player
FX_StasisShotImpact(tr.endpos, tr.plane.normal);
}
else
{
// hit the world
FX_StasisShotMiss(tr.endpos, tr.plane.normal);
}
}
// cap the impact end of the main beam to hide the nasty end of the line
FX_AddSprite( tr.endpos, NULL, qfalse, flrandom(40,60), -50, 1.0, 0.0, random() * 360, 0, 500, cgs.media.blueParticleShader );
if (bolt1==0)
{
VectorCopy(end, bolt1vec);
}
else if (bolt2==0)
{
VectorCopy(end, bolt2vec);
}
AngleVectors(cent->currentState.angles, fwd2, right, up);
// CrossProduct(fwd, up, right);
// VectorNormalize(right); // "right" is scaled by the sin of the angle between fwd & up... Ditch that.
// CrossProduct(right, fwd, up); // Change the "fake up" (0,0,1) to a "real up" (perpendicular to the forward vector).
// VectorNormalize(up); // If I cared about how the vertical variance looked when pointing up or down, I'd normalize this.
// Fire a shot up and to the right.
VectorMA(fwd, FX_STASIS_ALT_RIGHT_OFS, right, newdir);
VectorMA(newdir, FX_STASIS_ALT_UP_OFS, up, newdir);
VectorMA(start, FX_STASIS_ALT_MUZZLE_OFS, right, newstart);
FX_SmallStasisBeam(cent, newstart, newdir);
if (bolt1==1)
{
VectorCopy(newdir, bolt1vec);
}
else if (bolt2==1)
{
VectorCopy(newdir, bolt2vec);
}
// Fire a shot up and to the left.
VectorMA(fwd, -FX_STASIS_ALT_RIGHT_OFS, right, newdir);
VectorMA(newdir, FX_STASIS_ALT_UP_OFS, up, newdir);
VectorMA(start, -FX_STASIS_ALT_MUZZLE_OFS, right, newstart);
FX_SmallStasisBeam(cent, newstart, newdir);
if (bolt1==2)
{
VectorCopy(newdir, bolt1vec);
}
else if (bolt2==2)
{
VectorCopy(newdir, bolt2vec);
}
// Fire a shot a bit down and to the right.
VectorMA(fwd, 2.0*FX_STASIS_ALT_RIGHT_OFS, right, newdir);
VectorMA(newdir, -0.5*FX_STASIS_ALT_UP_OFS, up, newdir);
VectorMA(start, 2.0*FX_STASIS_ALT_MUZZLE_OFS, right, newstart);
FX_SmallStasisBeam(cent, newstart, newdir);
if (bolt1==3)
{
VectorCopy(newdir, bolt1vec);
}
else if (bolt2==3)
{
VectorCopy(newdir, bolt2vec);
}
// Fire a shot up and to the left.
VectorMA(fwd, -2.0*FX_STASIS_ALT_RIGHT_OFS, right, newdir);
VectorMA(newdir, -0.5*FX_STASIS_ALT_UP_OFS, up, newdir);
VectorMA(start, -2.0*FX_STASIS_ALT_MUZZLE_OFS, right, newstart);
FX_SmallStasisBeam(cent, newstart, newdir);
if (bolt1==4)
{
VectorCopy(newdir, bolt1vec);
}
else if (bolt2==4)
{
VectorCopy(newdir, bolt2vec);
}
// Put a big gigant-mo sprite at the muzzle end so people can't see the crappy edges of the line
FX_AddSprite( start, NULL, qfalse, random()*3 + 15, -20, 1.0, 0.5, 0.0, 0.0, 600, cgs.media.blueParticleShader);
// Do an electrical arc to one of the impact points.
FX_AddElectricity( start, bolt1vec, 0.2f, 15.0, -15.0, 1.0, 0.5, 100, cgs.media.dnBoltShader, 0.1 );
if (bolt1!=bolt2)
{
// ALSO do an electrical arc to another point.
FX_AddElectricity( bolt1vec, bolt2vec, 0.2f, 15.0, -15.0, 1.0, 0.5, flrandom(100,200), cgs.media.dnBoltShader, 0.5 );
}
}*/
/*
-------------------------
FX_StasisShotImpact
Alt-fire, impact effect
-------------------------
*/
/*void FX_StasisShotImpact( vec3_t end, vec3_t dir )
{
vec3_t org;
// Move me away from the wall a bit so that I don't z-buffer into it
VectorMA( end, 1.5, dir, org );
// Expanding rings
// FX_AddQuad( org, dir, 1, 80, 0.8, 0.2, random() * 360, 400, cgs.media.stasisRingShader );
// Impact effect
FX_AddQuad( org, dir, 7, 35, 1.0, 0.0, random() * 360, 500, cgs.media.blueParticleShader );
FX_AddQuad( org, dir, 5, 25, 1.0, 0.0, random() * 360, 420, cgs.media.ltblueParticleShader );
// CG_ImpactMark( cgs.media.scavMarkShader, org, dir, random()*360, 1,1,1,0.6, qfalse,
// 8 + random() * 2, qfalse );
// FX_StasisDischarge( org, dir, irandom( 2,4 ), 24 + random() * 12, 64 + random() * 48 );
}*/
/*
-------------------------
FX_StasisShotMiss
Alt-fire, miss effect
-------------------------
*/
/*void FX_StasisShotMiss( vec3_t end, vec3_t dir )
{
vec3_t org;
// Move me away from the wall a bit so that I don't z-buffer into it
VectorMA( end, 0.5, dir, org );
// Expanding rings
// FX_AddQuad( org, dir, 1, 16, 0.8, 0.2, random() * 360, 400, cgs.media.stasisRingShader );
// FX_AddQuad( org, dir, 1, 40, 0.8, 0.2, random() * 360, 300, cgs.media.stasisRingShader );
// Impact effect
FX_AddQuad( org, dir, 5, 25, 1.0, 0.0, random() * 360, 500, cgs.media.blueParticleShader );
FX_AddQuad( org, dir, 4, 17, 1.0, 0.0, random() * 360, 420, cgs.media.ltblueParticleShader );
CG_ImpactMark( cgs.media.scavMarkShader, org, dir, random()*360, 1,1,1,0.6, qfalse,
6 + random() * 2, qfalse );
FX_AddSprite( end, NULL, qfalse, flrandom(40,60), -50, 1.0, 0.0, random() * 360, 0, 500, cgs.media.blueParticleShader );
// FX_StasisDischarge( org, dir, irandom( 2,4 ), 24 + random() * 12, 64 + random() * 48 );
}*/
/*
-------------------------
FX_StasisProjectileThink
Main fire, with crazy bits swirling around main projectile
Hehe used to :D -TiM
-------------------------
*/
//unused
/*void FX_StasisProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon )
{
int size = 0;
vec3_t forward;
//vec3_t right, up;
//float radius, temp;
vec3_t org;
if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0 )
forward[2] = 1;
VectorCopy( cent->lerpOrigin, org );
// org[0] -=32;
//FX_AddTrail(
FX_AddTrail( org, forward, qfalse, 64, 0, 30.4f, 0.0f, 0.6f, 0.0f, 0, 1, cgs.media.disruptorBolt );
FX_AddSprite( cent->lerpOrigin, NULL, qfalse, 25.0f, 0.0f, 0.7f, 0.0f, 1.0f, 0.0f, 1.0f, cgs.media.disruptorStreak );
}*/
/*
-------------------------
FX_OrientedBolt
Creates new bolts for a while
-------------------------
*/
void FX_OrientedBolt( vec3_t start, vec3_t end, vec3_t dir )
{
vec3_t mid;
VectorSubtract( end, start, mid );
VectorScale( mid, 0.1f + (random() * 0.8), mid );
VectorAdd( start, mid, mid );
VectorMA(mid, 3.0f + (random() * 10.0f), dir, mid );
//FX_AddElectricity( mid, start, 0.5, 0.75 + random() * 0.75, 0.0, 1.0, 0.5, 300.0f + random() * 300, cgs.media.bolt2Shader, DEFAULT_DEVIATION);
//FX_AddElectricity( mid, end, 0.5, 0.75 + random() * 0.75, 1.0, 1.0, 0.5, 300.0f + random() * 300, cgs.media.bolt2Shader, DEFAULT_DEVIATION);
FX_AddElectricity( mid, start, 0.5, 0.75 + random() * 0.75, 0.0, 1.0, 0.5, 300.0f + random() * 300, cgs.media.borgLightningShaders[2], DEFAULT_DEVIATION);
FX_AddElectricity( mid, end, 0.5, 0.75 + random() * 0.75, 1.0, 1.0, 0.5, 300.0f + random() * 300, cgs.media.borgLightningShaders[3], DEFAULT_DEVIATION);
}
/*
-------------------------
FX_StasisDischarge
Fun "crawling" electricity ( credit goes to Josh for this one )
-------------------------
*/
void FX_StasisDischarge( vec3_t origin, vec3_t normal, int count, float dist_out, float dist_side )
{
trace_t trace;
vec3_t org, dir, dest;
vec3_t vr;
int i;
int discharge = dist_side;
vectoangles( normal, dir );
dir[ROLL] += random() * 360;
for (i = 0; i < count; i++)
{
//Move out a set distance
VectorMA( origin, dist_out, normal, org );
//Even out the hits
dir[ROLL] += (360 / count) + (rand() & 31);
AngleVectors( dir, NULL, vr, NULL );
//Move to the side in a random direction
discharge += (int)( crandom() * 8.0f );
VectorMA( org, discharge, vr, org );
//Trace back to find a surface
VectorMA( org, -dist_out * 3, normal, dest );
CG_Trace( &trace, org, NULL, NULL, dest, 0, MASK_SHOT );
//No surface found, start over
if (trace.fraction == 1)
continue;
//Connect the two points with bolts
FX_OrientedBolt( origin, trace.endpos, normal );
//TiM : Aww screw it. Add a lens flare. ^_^
CG_InitLensFlare( trace.endpos,
10, 10,
colorTable[CT_GREEN], 1.2, 2.0, 1600, 500,
colorTable[CT_GREEN], 1600, 500, 100, 5, qtrue,
0, 0, qfalse, qtrue,
qfalse, 1.0, cg.time, 0, 0, 300.0f + random() * 300);
}
}
/*
-------------------------
FX_StasisWeaponHitWall
Main fire impact
-------------------------
*/
#define NUM_DISCHARGES 6
#define DISCHARGE_DIST 8
#define DISCHARGE_SIDE_DIST 24
void FX_StasisWeaponHitWall( vec3_t origin, vec3_t dir, int size )
{
vec3_t vel, /*accel,*/ hitpos, direction, org;
//int i, t;
weaponInfo_t *weaponInfo = &cg_weapons[WP_DISRUPTOR];
CG_InitLensFlare( origin,
375, 375,
colorTable[CT_GREEN], 1.2, 2.0, 1600, 200,
colorTable[CT_GREEN], 1600, 200, 800, 20, qtrue,
0, 0, qfalse, qtrue,
qfalse, 1.0, cg.time, 0, 0, 200);
// Generate "crawling" electricity // eh, don't it doesn't look that great.
FX_StasisDischarge( origin, dir, NUM_DISCHARGES, DISCHARGE_DIST, DISCHARGE_SIDE_DIST );
VectorMA(origin, size, dir, hitpos);
// Set an oriented residual glow effect
FX_AddQuad( hitpos, dir, size * size * 15.0f, -150.0f,
1.0f, 0.0f, 0, 300, cgs.media.greenParticleShader );
CG_ImpactMark( cgs.media.scavMarkShader, origin, dir, random()*360, 1,1,1,0.6, qfalse,
size * 12 + 1, qfalse );
FX_AddSprite( hitpos, NULL, qfalse, size * size * 15.0f, -150.0f,
1.0f, 0.0f, 360*random(), 0, 400, cgs.media.greenParticleShader );
/* FX_AddSprite( hitpos, NULL, qfalse, size * size * 15.0f, -150.0f,
1.0f, 0.0f, 360*random(), 0, 400, cgs.media.greenParticleStreakShader ); */
FX_AddSprite( hitpos, NULL, qfalse, size * size * 25.0f, -150.0f,
1.0f, 0.0f, 0.0f, 0, 400, cgs.media.greenParticleStreakShader );
VectorSubtract( cg.refdef.vieworg, origin, direction );
VectorNormalize( direction );
VectorMA( origin, 12, direction, org );
VectorMA( org, 8, dir, direction );
VectorSet(vel, 0, 0, 32 ); //8
FX_AddSprite( origin,
vel, qfalse,
random() * 4 + 2, 12,
0.6 + random() * 0.4, 0.0,
random() * 180,
0.0,
random() * 200 + 1200, //300
cgs.media.steamShader );
//FX_AddSprite(
// Only play the impact sound and throw off the purple particles when it's the main projectile
/* if ( size < 3 )
return;
for ( i = 0; i < 4; i++ )
{
for ( t = 0; t < 3; t++ )
vel[t] = ( dir[t] + crandom() * 0.9 ) * ( random() * 100 + 250 );
VectorScale( vel, -2.2, accel );
FX_AddSprite( hitpos, vel, qfalse, random() * 8 + 8, 0, 1.0, 0.0, 0.0, 0.0, 200, cgs.media.purpleParticleShader );
}*/
trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, weaponInfo->mainHitSound );
}
void FX_DisruptorBeamFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean spark, qboolean impact, qboolean empty )
{
refEntity_t beam;
sfxHandle_t sfx;
float size;
vec3_t velocity;
int sparks;
vec3_t rgb = { 1,0.9,0.6}, rgb2={1,0.3,0};
//vec3_t rgb3 = { 1.0, 1.0, 1.0 };
sfx = 0;
// Draw beam first.
memset( &beam, 0, sizeof( beam ) );
VectorCopy( startpos, beam.origin);
VectorCopy( endpos, beam.oldorigin );
beam.reType = RT_LINE;
if (empty)
{
beam.customShader = cgs.media.phaserEmptyShader;
}
else
{
beam.customShader = cgs.media.disruptorBeam;
}
AxisClear( beam.axis );
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
beam.shaderRGBA[3] = 0xff;
if (empty)
{
beam.data.line.width = 1.0f + ( crandom() * 0.6f );
}
else
{
beam.data.line.width = 1.5f + ( crandom() * 0.6f );
}
beam.data.line.stscale = 5.0;
trap_R_AddRefEntityToScene( &beam );
// Now draw the hit graphic
// no explosion at LG impact, it is added with the beam
if ( sfx )
{
Com_Printf("playing %s\n", "phaser sound");
trap_S_StartSound( endpos, ENTITYNUM_WORLD, CHAN_AUTO, sfx );
}
//
// impact mark
//
if (impact)
{
if (!empty)
{ // normal.
CG_ImpactMark( cgs.media.scavMarkShader, endpos, normal, random()*360, 1,1,1,0.2, qfalse,
random() + 1, qfalse );
//VectorCopy( endpos, phaserFlare.worldCoord );
/*CG_InitLensFlare( endpos,
80,
80,
rgb,
1.2,
1.5,
1600,
200,
colorTable[CT_BLACK],
1600,
200,
80,
5,
qfalse,
5,
40,
qfalse,
qfalse,
qfalse,
1.0,
1.0,
200.0,
200.0,
200.0 );*/
//CG_InitLensFlare( endpos,
// 30, 30,
// rgb, 1.2, 2.0, 1600, 200,
// colorTable[CT_BLACK], 1600, 200, 410, 15, qfalse,
// 0, 0, qfalse, qtrue,
// qfalse, 1.0, cg.time, 0, 0, 50);
//TiM : Add your basic cheesy 'seen-way-too-much-in-movies-these-days' anamorphic lens streak :)
//CG_DrawLensFlare( &phaserFlare );
//FX_AddSprite( endpos, NULL, qfalse, random() * 1.25 + 5.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 50.0, cgs.media.blueParticleStreakShader ); //1.5f
//FX_AddQuad2( endpos, normal, random() * 1.25 + 8.0f, 0.0f, 1.0f, 1.0f, rgb3, rgb3, 270, 50.0, cgs.media.blueParticleStreakShader );
//eh... looked bad :P
FX_AddQuad2( endpos, normal, random() * 1.25 + 1.5f, 0.0f, 1.0f, 0.0f, rgb, rgb2, rand() % 360, 500 + random() * 200,
cgs.media.sunnyFlareShader );
}
else
{ // Wuss hit when empty.
FX_AddQuad2( endpos, normal, random() * .75 + 1.0f, 0.0f, 0.5f, 0.0f, rgb, rgb2, rand() % 360, 300 + random() * 200,
cgs.media.sunnyFlareShader );
}
}
// "Fun" sparks... Not when empty.
if ( spark && !empty)
{
sparks = (rand() & 1) + 1;
for(;sparks>0;sparks--)
{
size = 0.2f + (random() * 0.4);
FXE_Spray( normal, 200, 75, 0.8f, velocity);
if (rand() & LEF_USE_COLLISION)
{ // This spark bounces.
FX_AddTrail( endpos, velocity, qtrue, 5.0f, -15.0f,
size, -size, 1.0f, 0.5f, 0.4f, 500.0f, cgs.media.sparkShader);
}
else
{
FX_AddTrail( endpos, velocity, qtrue, 5.0f, -15.0f,
size, -size, 1.0f, 0.5f, 0.0, 500.0f, cgs.media.sparkShader);
}
}
}
}

Binary file not shown.