summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-13 11:30:00 +0000
committer/dev/humancontroller <devhc@example.com>2017-04-15 17:24:19 +0200
commit6310e03613071ce9313b1559b89be81a253caa03 (patch)
treec9c6d87ad6ee458ce9aa74a104cf618a938cc4b0 /src/game
parent7a457137d2f859c91c2b3d52a6c677427b6a95de (diff)
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
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_weapon.c18
1 files 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( );
}