summaryrefslogtreecommitdiff
path: root/src/cgame/cg_weapons.c
diff options
context:
space:
mode:
authorenneract <trem.redman@gmail.com>2014-11-25 01:45:57 +0100
committerenneract <trem.redman@gmail.com>2014-12-13 01:25:01 +0100
commit0aa94f6b6b7b49972a839aadaee4dbb42a3a53de (patch)
tree6bd75d724a11ef68e3985668c923ced45232e17f /src/cgame/cg_weapons.c
parentb0a9981e09bbc7c30769f680a4e0ff17c9ea8239 (diff)
Lightning Gun assets.
Diffstat (limited to 'src/cgame/cg_weapons.c')
-rw-r--r--src/cgame/cg_weapons.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index 86306e1..21d0352 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -868,7 +868,7 @@ static float CG_MachinegunSpinAngle( centity_t *cent, qboolean firing )
/*
=============
-CG_RenderBeam
+CG_RenderGenericBeam
=============
*/
@@ -1169,6 +1169,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
cent->muzzlePsTrigger = qfalse;
}
+ // Lightning Gun's beam
if( weaponNum == WP_LIGHTNING_GUN )
{
attachment_t attachment;
@@ -1213,6 +1214,19 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
if( CG_AttachmentPoint( &attachment, beam_start ) )
CG_RenderGenericBeam( beam_start, tr.endpos, cgs.media.lightningBeam, 3 );
+
+ if( tr.entityNum != ENTITYNUM_NONE &&
+ !( tr.surfaceFlags & SURF_NOIMPACT ) )
+ {
+ particleSystem_t *ps = CG_SpawnNewParticleSystem( cgs.media.lightningImpactPS );
+
+ if( CG_IsParticleSystemValid( &ps ) )
+ {
+ CG_SetAttachmentPoint( &ps->attachment, tr.endpos );
+ CG_SetParticleSystemNormal( ps, tr.plane.normal );
+ CG_AttachToPoint( &ps->attachment );
+ }
+ }
}
// make a dlight for the flash
@@ -1353,6 +1367,15 @@ void CG_AddViewWeapon( playerState_t *ps )
}
+ // Lightning Gun vibration effect
+ if( ( weapon == WP_LIGHTNING_GUN ) && ps->eFlags & EF_FIRING )
+ {
+ VectorMA( hand.origin, random( ) * 0.1, cg.refdef.viewaxis[ 0 ],
+ hand.origin );
+ VectorMA( hand.origin, random( ) * 0.1, cg.refdef.viewaxis[ 1 ],
+ hand.origin );
+ }
+
AnglesToAxis( angles, hand.axis );
// map torso animations to weapon animations
@@ -1753,6 +1776,7 @@ void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode )
int c;
weaponInfo_t *wi;
weapon_t weaponNum;
+ qboolean skipSound = qfalse;
es = &cent->currentState;
@@ -1772,6 +1796,10 @@ void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode )
wi = &cg_weapons[ weaponNum ];
+ if( wi->wim[ weaponMode ].continuousFlash &&
+ cent->muzzleFlashTime >= cg.time - 100 )
+ skipSound = qtrue;
+
// mark the entity as muzzle flashing, so when it is added it will
// append the flash to the weapon model
cent->muzzleFlashTime = cg.time;
@@ -1783,6 +1811,9 @@ void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode )
cent->muzzlePsTrigger = qtrue;
}
+ if( skipSound )
+ return;
+
// play a sound
for( c = 0; c < 4; c++ )
{