diff options
author | Michael Levin <risujin@fastmail.fm> | 2009-10-03 11:15:52 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:14:48 +0000 |
commit | 5399133ec251b57770a9adf2010af5547b9af16a (patch) | |
tree | d27c04f6b71e3bca6747019812c68c5210411479 /src/game/g_weapon.c | |
parent | c133a4946ccaa0ab54ec48bdf1fed93ef761cf94 (diff) |
* Lowered dretch zoffset a bit to better fit inside bounding box, increased shadow a bit to better fit the larger modelscale we are using
* Fulfilled benmachine's lolrequest: mass driver will not fire through players and buildables (but not teammates and team buildables if FF is off)
Diffstat (limited to 'src/game/g_weapon.c')
-rw-r--r-- | src/game/g_weapon.c | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 5bfb1fce..f5dd0a4d 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -439,43 +439,57 @@ MASS DRIVER void massDriverFire( gentity_t *ent ) { - trace_t tr; - vec3_t end; - gentity_t *tent; - gentity_t *traceEnt; + trace_t tr; + vec3_t end; + gentity_t *tent, *traceEnt; + int i, skipent; VectorMA( muzzle, 8192 * 16, forward, end ); - G_UnlaggedOn( muzzle, 8192 * 16 ); - trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); - G_UnlaggedOff( ); - - 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 impact - if( traceEnt->takedamage && traceEnt->client ) + VectorCopy( muzzle, tr.endpos ); + skipent = ent->s.number; + for( i = 0; i < 64 && skipent != ENTITYNUM_NONE; i++ ) { - BloodSpurt( ent, traceEnt, &tr ); - } - else - { - 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; //weaponMode - } + trap_Trace( &tr, tr.endpos, NULL, NULL, end, skipent, MASK_SHOT ); + if( tr.surfaceFlags & SURF_NOIMPACT ) + break; + traceEnt = &g_entities[ tr.entityNum ]; + skipent = tr.entityNum; + + // don't travel through walls and movers + if( !( traceEnt->r.contents & CONTENTS_BODY ) ) + skipent = ENTITYNUM_NONE; + + // don't travel through teammates with FF off + if( OnSameTeam(ent, traceEnt) && + ( !g_friendlyFire.integer || !g_friendlyFireHumans.integer ) ) + skipent = ENTITYNUM_NONE; + + // don't travel through team buildables with FF off + if( traceEnt->s.eType == ET_BUILDABLE && + traceEnt->biteam == ent->client->pers.teamSelection && + !g_friendlyBuildableFire.integer ) + skipent = ENTITYNUM_NONE; + + // snap the endpos to integers, but nudged towards the line + SnapVectorTowards( tr.endpos, muzzle ); + + // send impact + if( traceEnt->takedamage && traceEnt->client ) + BloodSpurt( ent, traceEnt, &tr ); + else + { + 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; //weaponMode + } - if( traceEnt->takedamage ) - { - G_Damage( traceEnt, ent, ent, forward, tr.endpos, - MDRIVER_DMG, 0, MOD_MDRIVER ); + if( traceEnt->takedamage ) + G_Damage( traceEnt, ent, ent, forward, tr.endpos, + MDRIVER_DMG, 0, MOD_MDRIVER ); } + G_UnlaggedOff( ); } /* |