codemp/cgame/fx_demp2.c File Reference

#include "cg_local.h"

Go to the source code of this file.

Functions

void FX_DEMP2_ProjectileThink (centity_t *cent, const struct weaponInfo_s *weapon)
void FX_DEMP2_HitWall (vec3_t origin, vec3_t normal)
void FX_DEMP2_HitPlayer (vec3_t origin, vec3_t normal, qboolean humanoid)
void FX_DEMP2_AltBeam (vec3_t start, vec3_t end, vec3_t normal, vec3_t targ1, vec3_t targ2)
void FX_DEMP2_AltDetonate (vec3_t org, float size)


Function Documentation

void FX_DEMP2_AltBeam vec3_t  start,
vec3_t  end,
vec3_t  normal,
vec3_t  targ1,
vec3_t  targ2
 

Definition at line 50 of file fx_demp2.c.

References vec3_t.

00052 {
00053 //NOTENOTE Fix this after trap calls for all primitives are created.
00054 /*
00055         vec3_t  dir, chaos,
00056                         c1, c2,
00057                         v1, v2;
00058         float   len,
00059                         s1, s2, s3;
00060 
00061         VectorSubtract( end, start, dir );
00062         len = VectorNormalize( dir );
00063 
00064         // Get the base control points, we'll work from there
00065         VectorMA( start, 0.3333f * len, dir, c1 );
00066         VectorMA( start, 0.6666f * len, dir, c2 );
00067 
00068         // get some chaos values that really aren't very chaotic :)
00069         s1 = sin( cg.time * 0.005f ) * 2 + crandom() * 0.2f;
00070         s2 = sin( cg.time * 0.001f );
00071         s3 = sin( cg.time * 0.011f );
00072 
00073         VectorSet( chaos, len * 0.01f * s1,
00074                                                 len * 0.02f * s2,
00075                                                 len * 0.04f * (s1 + s2 + s3));
00076 
00077         VectorAdd( c1, chaos, c1 );
00078         VectorScale( chaos, 4.0f, v1 );
00079 
00080         VectorSet( chaos, -len * 0.02f * s3,
00081                                                 len * 0.01f * (s1 * s2),
00082                                                 -len * 0.02f * (s1 + s2 * s3));
00083 
00084         VectorAdd( c2, chaos, c2 );
00085         VectorScale( chaos, 2.0f, v2 );
00086 
00087         VectorSet( chaos, 1.0f, 1.0f, 1.0f );
00088 
00089         FX_AddBezier( start, targ1,
00090                                                 c1, v1, c2, v2, 
00091                                                 5.0f + s1 * 2, 8.0f, 0.0f, 
00092                                                 1.0f, 0.0f, 0.0f,
00093                                                 chaos, chaos, 0.0f,
00094                                                 1.0f, trap_R_RegisterShader( "gfx/misc/electric2" ), FX_ALPHA_LINEAR );
00095 
00096         FX_AddBezier( start, targ1,
00097                                                 c2, v2, c1, v1, 
00098                                                 3.0f + s3, 3.0f, 0.0f, 
00099                                                 1.0f, 0.0f, 0.0f,
00100                                                 chaos, chaos, 0.0f,
00101                                                 1.0f, trap_R_RegisterShader( "gfx/misc/electric2" ), FX_ALPHA_LINEAR );
00102 
00103         s1 = sin( cg.time * 0.0005f ) + crandom() * 0.1f;
00104         s2 = sin( cg.time * 0.0025f );
00105         float cc2 = cos( cg.time * 0.0025f );
00106         s3 = sin( cg.time * 0.01f ) + crandom() * 0.1f;
00107 
00108         VectorSet( chaos, len * 0.08f * s2,
00109                                                 len * 0.04f * cc2,//s1 * -s3,
00110                                                 len * 0.06f * s3 );
00111 
00112         VectorAdd( c1, chaos, c1 );
00113         VectorScale( chaos, 4.0f, v1 );
00114 
00115         VectorSet( chaos, len * 0.02f * s1 * s3,
00116                                                 len * 0.04f * s2,
00117                                                 len * 0.03f * s1 * s2 );
00118 
00119         VectorAdd( c2, chaos, c2 );
00120         VectorScale( chaos, 3.0f, v2 );
00121 
00122         VectorSet( chaos, 1.0f, 1.0f, 1.0f );
00123 
00124         FX_AddBezier( start, targ1,
00125                                                 c1, v1, c2, v2, 
00126                                                 4.0f + s3, 8.0f, 0.0f, 
00127                                                 1.0f, 0.0f, 0.0f,
00128                                                 chaos, chaos, 0.0f,
00129                                                 1.0f, trap_R_RegisterShader( "gfx/misc/electric2" ), FX_ALPHA_LINEAR );
00130 
00131         FX_AddBezier( start, targ1,
00132                                                 c2, v1, c1, v2, 
00133                                                 5.0f + s1 * 2, 8.0f, 0.0f, 
00134                                                 1.0f, 0.0f, 0.0f,
00135                                                 chaos, chaos, 0.0f,
00136                                                 1.0f, trap_R_RegisterShader( "gfx/misc/electric2" ), FX_ALPHA_LINEAR );
00137 
00138 
00139         VectorMA( start, 14.0f, dir, c1 );
00140 
00141         FX_AddSprite( c1, NULL, NULL, 12.0f + crandom() * 4, 0.0f, 1.0f, 1.0f, random() * 360, 0.0f, 1.0f, 
00142                                                 trap_R_RegisterShader( "gfx/misc/lightningFlash" ));
00143         FX_AddSprite( c1, NULL, NULL, 6.0f + crandom() * 2, 0.0f, 1.0f, 1.0f, random() * 360, 0.0f, 1.0f, 
00144                                                 trap_R_RegisterShader( "gfx/misc/lightningFlash" ));
00145 
00146         FX_AddSprite( targ1, NULL, NULL, 4.0f + crandom(), 0.0f, 1.0f, 0.0f, chaos, chaos, random() * 360, 0.0f, 10, 
00147                                                 trap_R_RegisterShader( "gfx/misc/lightningFlash" ));
00148         FX_AddSprite( targ1, NULL, NULL, 8.0f + crandom() * 2, 0.0f, 1.0f, 0.0f, chaos, chaos, random() * 360, 0.0f, 10, 
00149                                                 trap_R_RegisterShader( "gfx/misc/lightningFlash" ));
00150 
00151 
00152         //--------------------------------------------
00153 
00154         VectorSubtract( targ2, targ1, dir );
00155         len = VectorNormalize( dir );
00156 
00157         // Get the base control points, we'll work from there
00158         VectorMA( targ1, 0.3333f * len, dir, c1 );
00159         VectorMA( targ1, 0.6666f * len, dir, c2 );
00160 
00161         // get some chaos values that really aren't very chaotic :)
00162         s1 = sin( cg.time * 0.005f ) * 2 + crandom() * 0.2f;
00163         s2 = sin( cg.time * 0.001f );
00164         s3 = sin( cg.time * 0.011f );
00165 
00166         VectorSet( chaos, len * 0.01f * s1,
00167                                                 len * 0.02f * s2,
00168                                                 len * 0.04f * (s1 + s2 + s3));
00169 
00170         VectorAdd( c1, chaos, c1 );
00171         VectorScale( chaos, 4.0f, v1 );
00172 
00173         VectorSet( chaos, -len * 0.02f * s3,
00174                                                 len * 0.01f * (s1 * s2),
00175                                                 -len * 0.02f * (s1 + s2 * s3));
00176 
00177         VectorAdd( c2, chaos, c2 );
00178         VectorScale( chaos, 2.0f, v2 );
00179 
00180         VectorSet( chaos, 1.0f, 1.0f, 1.0f );
00181 
00182         FX_AddBezier( targ1, targ2,
00183                                                 c1, v1, c2, v2, 
00184                                                 5.0f + s1 * 2, 8.0f, 0.0f, 
00185                                                 1.0f, 0.0f, 0.0f,
00186                                                 chaos, chaos, 0.0f,
00187                                                 1.0f, trap_R_RegisterShader( "gfx/misc/electric2" ), FX_ALPHA_LINEAR );
00188 
00189         FX_AddBezier( targ1, targ2,
00190                                                 c2, v2, c1, v1, 
00191                                                 3.0f + s3, 3.0f, 0.0f, 
00192                                                 1.0f, 0.0f, 0.0f,
00193                                                 chaos, chaos, 0.0f,
00194                                                 1.0f, trap_R_RegisterShader( "gfx/misc/electric2" ), FX_ALPHA_LINEAR );
00195 
00196         s1 = sin( cg.time * 0.0005f ) + crandom() * 0.1f;
00197         s2 = sin( cg.time * 0.0025f );
00198         cc2 = cos( cg.time * 0.0025f );
00199         s3 = sin( cg.time * 0.01f ) + crandom() * 0.1f;
00200 
00201         VectorSet( chaos, len * 0.08f * s2,
00202                                                 len * 0.04f * cc2,//s1 * -s3,
00203                                                 len * 0.06f * s3 );
00204 
00205         VectorAdd( c1, chaos, c1 );
00206         VectorScale( chaos, 4.0f, v1 );
00207 
00208         VectorSet( chaos, len * 0.02f * s1 * s3,
00209                                                 len * 0.04f * s2,
00210                                                 len * 0.03f * s1 * s2 );
00211 
00212         VectorAdd( c2, chaos, c2 );
00213         VectorScale( chaos, 3.0f, v2 );
00214 
00215         VectorSet( chaos, 1.0f, 1.0f, 1.0f );
00216 
00217         FX_AddBezier( targ1, targ2,
00218                                                 c1, v1, c2, v2, 
00219                                                 4.0f + s3, 8.0f, 0.0f, 
00220                                                 1.0f, 0.0f, 0.0f,
00221                                                 chaos, chaos, 0.0f,
00222                                                 1.0f, trap_R_RegisterShader( "gfx/misc/electric2" ), FX_ALPHA_LINEAR );
00223 
00224         FX_AddBezier( targ1, targ2,
00225                                                 c2, v1, c1, v2, 
00226                                                 5.0f + s1 * 2, 8.0f, 0.0f, 
00227                                                 1.0f, 0.0f, 0.0f,
00228                                                 chaos, chaos, 0.0f,
00229                                                 1.0f, trap_R_RegisterShader( "gfx/misc/electric2" ), FX_ALPHA_LINEAR );
00230 
00231 
00232         FX_AddSprite( targ2, NULL, NULL, 4.0f + crandom(), 0.0f, 1.0f, 0.0f, chaos, chaos, random() * 360, 0.0f, 10, 
00233                                                 trap_R_RegisterShader( "gfx/misc/lightningFlash" ));
00234         FX_AddSprite( targ2, NULL, NULL, 8.0f + crandom() * 2, 0.0f, 1.0f, 0.0f, chaos, chaos, random() * 360, 0.0f, 10, 
00235                                                 trap_R_RegisterShader( "gfx/misc/lightningFlash" ));
00236 */
00237 }

void FX_DEMP2_AltDetonate vec3_t  org,
float  size
 

Definition at line 240 of file fx_demp2.c.

References cg, CG_AllocLocalEntity(), cgs, localEntity_s::color, refEntity_t::customShader, cgMedia_t::demp2Shell, cgMedia_t::demp2ShellShader, localEntity_s::endTime, refEntity_t::hModel, LE_FADE_SCALE_MODEL, localEntity_s::leType, localEntity_t, cgs_t::media, memset(), refEntity_t::origin, localEntity_s::radius, localEntity_s::refEntity, refEntity_t::renderfx, RF_VOLUMETRIC, localEntity_s::startTime, cg_t::time, vec3_t, and VectorCopy.

Referenced by CG_EntityEvent().

00241 {
00242         localEntity_t   *ex;
00243 
00244         ex = CG_AllocLocalEntity();
00245         ex->leType = LE_FADE_SCALE_MODEL;
00246         memset( &ex->refEntity, 0, sizeof( refEntity_t ));
00247 
00248         ex->refEntity.renderfx |= RF_VOLUMETRIC;
00249 
00250         ex->startTime = cg.time;
00251         ex->endTime = ex->startTime + 800;//1600;
00252         
00253         ex->radius = size;
00254         ex->refEntity.customShader = cgs.media.demp2ShellShader;
00255         ex->refEntity.hModel = cgs.media.demp2Shell;
00256         VectorCopy( org, ex->refEntity.origin );
00257                 
00258         ex->color[0] = ex->color[1] = ex->color[2] = 255.0f;
00259 }

void FX_DEMP2_HitPlayer vec3_t  origin,
vec3_t  normal,
qboolean  humanoid
 

Definition at line 40 of file fx_demp2.c.

References cgs, cgEffects_t::demp2FleshImpactEffect, cgs_t::effects, trap_FX_PlayEffectID(), and vec3_t.

Referenced by CG_MissileHitPlayer().

00041 {
00042         trap_FX_PlayEffectID( cgs.effects.demp2FleshImpactEffect, origin, normal, -1, -1 );
00043 }

void FX_DEMP2_HitWall vec3_t  origin,
vec3_t  normal
 

Definition at line 29 of file fx_demp2.c.

References cgs, cgEffects_t::demp2WallImpactEffect, cgs_t::effects, trap_FX_PlayEffectID(), and vec3_t.

Referenced by CG_MissileHitWall().

00030 {
00031         trap_FX_PlayEffectID( cgs.effects.demp2WallImpactEffect, origin, normal, -1, -1 );
00032 }

void FX_DEMP2_ProjectileThink centity_t cent,
const struct weaponInfo_s weapon
 

Definition at line 11 of file fx_demp2.c.

References centity_t, cgs, centity_s::currentState, cgEffects_t::demp2ProjectileEffect, cgs_t::effects, centity_s::lerpOrigin, entityState_s::pos, trap_FX_PlayEffectID(), trajectory_t::trDelta, vec3_t, and VectorNormalize2().

Referenced by CG_RegisterWeapon().

00012 {
00013         vec3_t forward;
00014 
00015         if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
00016         {
00017                 forward[2] = 1.0f;
00018         }
00019 
00020         trap_FX_PlayEffectID( cgs.effects.demp2ProjectileEffect, cent->lerpOrigin, forward, -1, -1 );
00021 }