summaryrefslogtreecommitdiff
path: root/src
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
parentb0a9981e09bbc7c30769f680a4e0ff17c9ea8239 (diff)
Lightning Gun assets.
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_event.c3
-rw-r--r--src/cgame/cg_local.h1
-rw-r--r--src/cgame/cg_main.c2
-rw-r--r--src/cgame/cg_weapons.c33
-rw-r--r--src/game/tremulous.h6
5 files changed, 41 insertions, 4 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index d9e2f77..4c756ad 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -335,6 +335,9 @@ static void CG_Obituary( entityState_t *ent )
message = "^5almost dodged^7";
message2 = "^5's ^5rocket";
break;
+ case MOD_LIGHTNING:
+ message = "^5was electrocuted by^7";
+ break;
case MOD_GRENADE:
message = "^5couldn't escape^7";
message2 = "^5's ^5grenade";
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 72b5a96..d979046 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1338,6 +1338,7 @@ typedef struct
qhandle_t alienWoundsBleedPS;
qhandle_t lightningBeam;
+ qhandle_t lightningImpactPS;
} cgMedia_t;
typedef struct
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 9abdc7e..6be1d50 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -867,6 +867,8 @@ static void CG_RegisterGraphics( void )
cgs.media.humanWoundsBleedPS = CG_RegisterParticleSystem( "humanWoundBleedPS" );
cgs.media.headShotPS = CG_RegisterParticleSystem( "headShotPS" );
+ cgs.media.lightningImpactPS = CG_RegisterParticleSystem( "models/weapons/lightning/impactPS" );
+
CG_BuildableStatusParse( "ui/assets/human/buildstat.cfg", &cgs.humanBuildStat );
CG_BuildableStatusParse( "ui/assets/alien/buildstat.cfg", &cgs.alienBuildStat );
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++ )
{
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index b42a7b4..ad4a688 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -515,9 +515,9 @@ TREMULOUS EDGE MOD SRC FILE
#define PRIFLE_SECONDARY_REPEAT 400
#define LIGHTNING_PRICE 500
-#define LIGHTNING_AMMO 500
-#define LIGHTNING_K_SCALE 500
-#define LIGHTNING_DPS 100 // damage per second
+#define LIGHTNING_AMMO 300
+#define LIGHTNING_K_SCALE 1
+#define LIGHTNING_DPS 60 // damage per second
#define LIGHTNING_REPEAT 50 // keep it as low as possible
#define LIGHTNING_DAMAGE ( LIGHTNING_DPS * LIGHTNING_REPEAT / 1000 )
#define LIGHTNING_RANGE 450