Skip to content

Commit

Permalink
* (bug 5074) Fix inconsistency in tesla firing range computation (/de…
Browse files Browse the repository at this point in the history
…v/humancontroller)
  • Loading branch information
cschwarz committed Jul 31, 2011
1 parent 777611c commit d089190
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/game/g_buildable.c
Expand Up @@ -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 );
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/game/g_weapon.c
Expand Up @@ -735,7 +735,7 @@ void teslaFire( gentity_t *self )
trace_t tr;
vec3_t origin, target;
gentity_t *tent;

if( !self->enemy )
return;

Expand All @@ -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 );
Expand Down

0 comments on commit d089190

Please sign in to comment.