summaryrefslogtreecommitdiff
path: root/src/game/g_weapon.c
diff options
context:
space:
mode:
authorenneract <trem.redman@gmail.com>2014-12-14 14:56:38 +0100
committerenneract <trem.redman@gmail.com>2014-12-14 14:56:38 +0100
commit7c02e34b08a4e44a7f7935bf6b1bee45c3a8df6c (patch)
treee3ff69394522a6cc7dd11edf27cd69df6c0a5819 /src/game/g_weapon.c
parentbd6fc418d171378de5de2b7450e22f70b4899b5c (diff)
parent5130cdd357c5b3b442d39ee05052739419456e77 (diff)
Merge branch 'newguns'
Conflicts: src/cgame/cg_local.h src/cgame/cg_main.c
Diffstat (limited to 'src/game/g_weapon.c')
-rw-r--r--src/game/g_weapon.c64
1 files changed, 46 insertions, 18 deletions
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 5453913..1c333ab 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -698,18 +698,6 @@ void acidBombFire2x( gentity_t *ent, int wp )
/*
======================================================================
-SMOKE
-======================================================================
-*/
-
-void throwSmoke( gentity_t *ent )
-{
- gentity_t *m;
- m = launch_smoke( ent, muzzle, forward );
-}
-
-/*
-======================================================================
LAS GUN
======================================================================
*/
@@ -831,9 +819,7 @@ void LCChargeFire( gentity_t *ent, qboolean secondary )
/*
======================================================================
-
-PULSE RIFLE
-
+ROCKET LAUNCHER
======================================================================
*/
@@ -842,6 +828,48 @@ void rocketLauncherFire( gentity_t *ent )
fire_rocket( ent, muzzle, forward );
}
+
+/*
+======================================================================
+LIGHTNING GUN
+======================================================================
+*/
+
+void lightningGunFire( gentity_t *ent )
+{
+ vec3_t start, end;
+ trace_t tr;
+ gentity_t *target;
+
+ VectorMA( muzzle, LIGHTNING_RANGE, forward, end );
+
+ G_UnlaggedOn( ent, muzzle, LIGHTNING_RANGE );
+ trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
+ G_UnlaggedOff( );
+
+ if( tr.fraction == 1.0f ||
+ tr.entityNum == ENTITYNUM_NONE ||
+ ( tr.surfaceFlags & SURF_NOIMPACT ) )
+ return;
+
+ target = g_entities + tr.entityNum;
+
+ if( target->s.eType == ET_PLAYER || target->s.eType == ET_BUILDABLE )
+ BloodSpurt( ent, target, &tr );
+ else
+ {
+ gentity_t *tent;
+
+ tent = G_TempEntity( tr.endpos, EV_MISSILE_MISS );
+ tent->s.eventParm = DirToByte( tr.plane.normal );
+ tent->s.weapon = ent->s.weapon;
+ tent->s.generic1 = ent->s.generic1;
+ }
+
+ G_Damage( target, ent, ent, forward, tr.endpos, LIGHTNING_DAMAGE, 0, MOD_LIGHTNING );
+}
+
+
/*
======================================================================
TESLA GENERATOR
@@ -1988,15 +2016,15 @@ void FireWeapon( gentity_t *ent )
case WP_ROCKET_LAUNCHER:
rocketLauncherFire( ent );
break;
+ case WP_LIGHTNING_GUN:
+ lightningGunFire( ent );
+ break;
case WP_GRENADE:
throwGrenade( ent );
break;
case WP_MINE:
throwMine( ent );
break;
- case WP_SMOKE:
- throwSmoke( ent );
- break;
case WP_LOCKBLOB_LAUNCHER:
lockBlobLauncherFire( ent );
break;