From 7b0ba7f90b93f1119b1523dd05f9e6a4d1dc4863 Mon Sep 17 00:00:00 2001 From: Christopher Schwarz Date: Sun, 31 Jul 2011 00:52:42 +0000 Subject: * (bug 5074) Fix inconsistency in tesla firing range computation (/dev/humancontroller) --- src/game/g_buildable.c | 12 +++++++----- src/game/g_weapon.c | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 8cf1d6cd..0ff698b2 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2469,15 +2469,18 @@ void HTeslaGen_Think( gentity_t *self ) if( self->spawned && self->timestamp < level.time ) { - vec3_t range, mins, maxs; + vec3_t origin, range, mins, maxs; int entityList[ MAX_GENTITIES ], i, num; // Communicates firing state to client self->s.eFlags &= ~EF_FIRING; + // Move the muzzle from the entity origin up a bit to fire over turrets + VectorMA( self->s.origin, self->r.maxs[ 2 ], self->s.origin2, origin ); + VectorSet( range, TESLAGEN_RANGE, TESLAGEN_RANGE, TESLAGEN_RANGE ); - VectorAdd( self->s.origin, range, maxs ); - VectorSubtract( self->s.origin, range, mins ); + VectorAdd( origin, range, maxs ); + VectorSubtract( origin, range, mins ); // Attack nearby Aliens num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); @@ -2490,8 +2493,7 @@ void HTeslaGen_Think( gentity_t *self ) if( self->enemy->client && self->enemy->health > 0 && self->enemy->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS && - Distance( self->enemy->s.pos.trBase, - self->s.pos.trBase ) <= TESLAGEN_RANGE ) + Distance( origin, self->enemy->s.pos.trBase ) <= TESLAGEN_RANGE ) FireWeapon( self ); } self->enemy = NULL; diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 3bf257bc..60c74787 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -735,7 +735,7 @@ void teslaFire( gentity_t *self ) trace_t tr; vec3_t origin, target; gentity_t *tent; - + if( !self->enemy ) return; @@ -758,7 +758,7 @@ void teslaFire( gentity_t *self ) if( self->enemy->takedamage ) { vec3_t dir; - + VectorSubtract( target, origin, dir ); G_Damage( self->enemy, self, self, dir, tr.endpos, TESLAGEN_DMG, 0, MOD_TESLAGEN ); -- cgit