Skip to content

Commit

Permalink
Fix instagib shot stopping on the first victim
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Mar 26, 2016
1 parent 6d09902 commit b9ea97f
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions source/game/g_weapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,8 @@ void W_Fire_Instagun( edict_t *self, vec3_t start, vec3_t angles, float damage,
{
vec3_t from, end, dir;
trace_t tr;
edict_t *ignore, *event;
edict_t *ignore, *event, *hit;
int hit_movetype;
int mask;
bool missed = true;
int dmgflags = 0;
Expand All @@ -1314,24 +1315,27 @@ void W_Fire_Instagun( edict_t *self, vec3_t start, vec3_t angles, float damage,
break;

// allow trail to go through SOLID_BBOX entities (players, gibs, etc)
if( !ISBRUSHMODEL( game.edicts[tr.ent].s.modelindex ) )
ignore = &game.edicts[tr.ent];
hit = &game.edicts[tr.ent];
hit_movetype = hit->movetype; // backup the original movetype as the entity may "die"

if( ( &game.edicts[tr.ent] != self ) && ( game.edicts[tr.ent].takedamage ) )
if( !ISBRUSHMODEL( hit->s.modelindex ) )
ignore = hit;

if( ( hit != self ) && ( hit->takedamage ) )
{
G_Damage( &game.edicts[tr.ent], self, self, dir, dir, tr.endpos, damage, knockback, stun, dmgflags, mod );
G_Damage( hit, self, self, dir, dir, tr.endpos, damage, knockback, stun, dmgflags, mod );
// spawn a impact event on each damaged ent
event = G_SpawnEvent( EV_INSTA_EXPLOSION, DirToByte( tr.plane.normal ), tr.endpos );
event->s.ownerNum = ENTNUM( self );
event->s.firemode = FIRE_MODE_STRONG;
if( game.edicts[tr.ent].r.client )
if( hit->r.client )
missed = false;
}

// some entity was touched
if( tr.ent == world->s.number
|| game.edicts[tr.ent].movetype == MOVETYPE_NONE
|| game.edicts[tr.ent].movetype == MOVETYPE_PUSH )
if( hit == world
|| hit_movetype == MOVETYPE_NONE
|| hit_movetype == MOVETYPE_PUSH )
{
if( g_instajump->integer && self && self->r.client )
{
Expand Down

0 comments on commit b9ea97f

Please sign in to comment.