diff options
| author | Christopher Schwarz <lakitu7@gmail.com> | 2011-08-08 00:28:54 +0000 | 
|---|---|---|
| committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:18:13 +0000 | 
| commit | cfa3aaac676d5f6e9657f810ab919b7485616a7b (patch) | |
| tree | ee7caa78c890ba03c548d2f7e64914ffb1ee7931 /src/game/g_weapon.c | |
| parent | 7d331f075edd65eab5b0fce5d823f70abd5e95fb (diff) | |
* (bug 5087) Improve widetrace (alien swipe) hit detection (/dev/humancontroller)
Diffstat (limited to 'src/game/g_weapon.c')
| -rw-r--r-- | src/game/g_weapon.c | 39 | 
1 files changed, 12 insertions, 27 deletions
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 4465efa9..accc664e 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -149,39 +149,24 @@ static void G_WideTrace( trace_t *tr, gentity_t *ent, float range,    if( !ent->client )      return; -  // Try a linear trace first -  VectorMA( muzzle, range + width, forward, end ); -    G_UnlaggedOn( ent, muzzle, range + width ); -  trap_Trace( tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); +  VectorMA( muzzle, range, forward, end ); + +  // Trace against entities +  trap_Trace( tr, muzzle, mins, maxs, end, ent->s.number, CONTENTS_BODY );    if( tr->entityNum != ENTITYNUM_NONE ) -  { -    // We hit something with the linear trace      *target = &g_entities[ tr->entityNum ]; -  } -  else -  { -    // The linear trace didn't hit anything, so retry with a wide trace -    VectorMA( muzzle, range, forward, end ); -    // Trace against entities -    trap_Trace( tr, muzzle, mins, maxs, end, ent->s.number, CONTENTS_BODY ); -    if( tr->entityNum != ENTITYNUM_NONE ) -    { -      *target = &g_entities[ tr->entityNum ]; - -      // Set range to the trace length plus the width, so that the end of the -      // LOS trace is close to the exterior of the target's bounding box -      range = Distance( muzzle, tr->endpos ) + width; -      VectorMA( muzzle, range, forward, end ); +  // Set range to the trace length plus the width, so that the end of the +  // LOS trace is close to the exterior of the target's bounding box +  range = Distance( muzzle, tr->endpos ) + width; +  VectorMA( muzzle, range, forward, end ); -      // Trace for line of sight against the world -      trap_Trace( tr, muzzle, NULL, NULL, end, 0, CONTENTS_SOLID ); -      if( tr->fraction < 1.0f ) -        *target = NULL; -    } -  } +  // Trace for line of sight against the world +  trap_Trace( tr, muzzle, NULL, NULL, end, ent->s.number, CONTENTS_SOLID ); +  if( tr->entityNum != ENTITYNUM_NONE ) +    *target = &g_entities[ tr->entityNum ];    G_UnlaggedOff( );  }  | 
