From 5a43e39113ce8d4ed07059ddc8807a0ade172fc7 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sun, 25 Feb 2018 19:33:02 +0100 Subject: Do a ray trace before a box sweep when testing for melee hits. --- src/game/g_weapon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 8ab005e..5270339 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -239,7 +239,9 @@ void meleeAttack( gentity_t *ent, float range, float width, int damage, meansOfD VectorMA( muzzle, range, forward, end ); G_UnlaggedOn( ent, muzzle, range ); - trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT ); + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if( tr.entityNum == ENTITYNUM_NONE || tr.entityNum == ENTITYNUM_WORLD ) + trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT ); G_UnlaggedOff( ); if( tr.surfaceFlags & SURF_NOIMPACT ) @@ -889,7 +891,9 @@ qboolean CheckVenomAttack( gentity_t *ent ) VectorMA( muzzle, LEVEL0_BITE_RANGE, forward, end ); G_UnlaggedOn( ent, muzzle, LEVEL0_BITE_RANGE ); - trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT ); + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if( tr.entityNum == ENTITYNUM_NONE || tr.entityNum == ENTITYNUM_WORLD ) + trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT ); G_UnlaggedOff( ); if( tr.surfaceFlags & SURF_NOIMPACT ) -- cgit