diff options
author | Tim Angus <tim@ngus.net> | 2002-06-22 03:09:29 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-06-22 03:09:29 +0000 |
commit | c69b2102f75dd57a6fd4ac949af4e63fda6dc3aa (patch) | |
tree | 532b3845da6a7a660e3cc06bb030cc22bfef7348 /src/game | |
parent | a1146cb253721ed39012e8ba933f85cbe458d398 (diff) |
Las Gun and Pain Saw
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 5 | ||||
-rw-r--r-- | src/game/bg_public.h | 2 | ||||
-rw-r--r-- | src/game/g_weapon.c | 93 |
3 files changed, 97 insertions, 3 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 9d4e359d..d7422b09 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2181,7 +2181,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; - 100, //int repeatRate; + 75, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; @@ -3322,6 +3322,9 @@ char *eventnames[] = { "EV_BULLET_HIT_FLESH", "EV_BULLET_HIT_WALL", + "EV_LAS_HIT_FLESH", + "EV_LAS_HIT_WALL", + "EV_MASS_DRIVER_HIT", "EV_MISSILE_HIT", "EV_MISSILE_MISS", diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 77ad6f2b..6f383de1 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -535,6 +535,8 @@ typedef enum { EV_BULLET_HIT_FLESH, EV_BULLET_HIT_WALL, + EV_LAS_HIT_FLESH, + EV_LAS_HIT_WALL, EV_MASS_DRIVER_HIT, EV_MISSILE_HIT, diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 4965fdb0..32db11fc 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -230,6 +230,95 @@ void flamerFire( gentity_t *ent ) /* ====================================================================== +LAS GUN + +====================================================================== +*/ + +/* +=============== +lasGunFire +=============== +*/ +void lasGunFire( gentity_t *ent ) +{ + trace_t tr; + vec3_t end; + gentity_t *tent; + gentity_t *traceEnt; + + VectorMA( muzzle, 8192 * 16, forward, end ); + + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if( tr.surfaceFlags & SURF_NOIMPACT ) + return; + + traceEnt = &g_entities[ tr.entityNum ]; + + // snap the endpos to integers, but nudged towards the line + SnapVectorTowards( tr.endpos, muzzle ); + + // send bullet impact + if( traceEnt->takedamage && traceEnt->client ) + { + tent = G_TempEntity( tr.endpos, EV_LAS_HIT_FLESH ); + tent->s.eventParm = traceEnt->s.number; + } + else + { + tent = G_TempEntity( tr.endpos, EV_LAS_HIT_WALL ); + tent->s.eventParm = DirToByte( tr.plane.normal ); + } + tent->s.otherEntityNum = ent->s.number; + + if( traceEnt->takedamage ) + G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10, 0, MOD_MACHINEGUN ); +} + +/* +====================================================================== + +PAIN SAW + +====================================================================== +*/ + +void painSawFire( gentity_t *ent ) +{ + trace_t tr; + vec3_t end; + gentity_t *tent; + gentity_t *traceEnt; + + // set aiming directions + AngleVectors( ent->client->ps.viewangles, forward, right, up ); + + CalcMuzzlePoint( ent, forward, right, up, muzzle ); + + VectorMA( muzzle, 32, forward, end ); + + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if ( tr.surfaceFlags & SURF_NOIMPACT ) + return; + + traceEnt = &g_entities[ tr.entityNum ]; + + // send blood impact + if ( traceEnt->takedamage && traceEnt->client ) + { + tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); + tent->s.otherEntityNum = traceEnt->s.number; + tent->s.eventParm = DirToByte( tr.plane.normal ); + tent->s.weapon = ent->s.weapon; + } + + if ( traceEnt->takedamage ) + G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, DAMAGE_NO_KNOCKBACK, MOD_VENOM ); +} + +/* +====================================================================== + LUCIFER CANON ====================================================================== @@ -883,10 +972,10 @@ void FireWeapon( gentity_t *ent ) LCChargeFire( ent, qfalse ); break; case WP_LAS_GUN: - massDriverFire( ent ); + lasGunFire( ent ); break; case WP_PAIN_SAW: - gClawFire( ent ); + painSawFire( ent ); break; case WP_ABUILD: buildFire( ent, MN_A_BUILD ); |