From 6310e03613071ce9313b1559b89be81a253caa03 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Thu, 13 Apr 2017 11:30:00 +0000 Subject: allow aliens to attack any solid surface after a box trance against BODY contents, a nearby SOLID line trace will override the target that is hit; this is important for aliens to be able to push attack-to-activate buttons --- src/game/g_weapon.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 82bad26..2cb91d5 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -176,19 +176,17 @@ static void G_WideTrace( trace_t *tr, gentity_t *ent, float range, float width, // 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( ); } -- cgit