Remove airTarget member from PROJECTILE

This was used to make AA cannons which originaly aimed at a VTOL not hit anything else
As a speed optimisation we could skip searching the structure list for victims,
 if the projectile exploded above the maximum structure height, and do the same for droids

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6518 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2008-12-30 04:04:17 +00:00
parent fed9ced1a4
commit d04ceed183
2 changed files with 5 additions and 17 deletions

View File

@ -370,7 +370,6 @@ BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, Ve
psProj->player = player;
psProj->bVisible = false;
psProj->airTarget = false;
psProj->born = gameTime;
psProj->died = 0;
@ -379,13 +378,6 @@ BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, Ve
setProjectileDestination(psProj, psTarget);
setProjectileDamaged(psProj, NULL);
/* If target is a VTOL or higher than ground, it is an air target. */
if ((psTarget != NULL && psTarget->type == OBJ_DROID && isVtolDroid((DROID*)psTarget))
|| (psTarget == NULL && target.z > map_Height(target.x, target.y)))
{
psProj->airTarget = true;
}
if (psTarget)
{
scoreUpdateVar(WD_SHOTS_ON_TARGET);
@ -1193,8 +1185,7 @@ static void proj_ImpactFunc( PROJECTILE *psObj )
addMultiEffect(&position, &scatter, EFFECT_EXPLOSION, facing, true, imd, psStats->numExplosions, psStats->lightWorld, psStats->effectSize);
// If the target was a VTOL hit in the air add smoke
if (psObj->airTarget
&& (psStats->surfaceToAir & SHOOT_IN_AIR)
if ((psStats->surfaceToAir & SHOOT_IN_AIR)
&& !(psStats->surfaceToAir & SHOOT_ON_GROUND))
{
addMultiEffect(&position, &scatter, EFFECT_SMOKE, SMOKE_TYPE_DRIFTING, false, NULL, 3, 0, 0);
@ -1220,8 +1211,7 @@ static void proj_ImpactFunc( PROJECTILE *psObj )
EFFECT_TYPE facing = (psStats->facePlayer ? EXPLOSION_TYPE_SPECIFIED : EXPLOSION_TYPE_NOT_FACING);
// If we hit a VTOL with an AA gun use the miss graphic and add some smoke
if (psObj->airTarget
&& (psStats->surfaceToAir & SHOOT_IN_AIR)
if ((psStats->surfaceToAir & SHOOT_IN_AIR)
&& !(psStats->surfaceToAir & SHOOT_ON_GROUND)
&& psStats->weaponSubClass == WSC_AAGUN)
{
@ -1364,7 +1354,8 @@ static void proj_ImpactFunc( PROJECTILE *psObj )
}
}
}
if (!psObj->airTarget)
// FIXME Check whether we hit above maximum structure height, to skip unnecessary calculations!
{
STRUCTURE *psCurrS, *psNextS;
@ -1383,9 +1374,7 @@ static void proj_ImpactFunc( PROJECTILE *psObj )
HIT_ROLL(dice);
if (dice < weaponRadiusHit(psStats, psObj->player))
{
unsigned int damage = calcDamage(weaponRadDamage(psStats, psObj->player),
psStats->weaponEffect,
(BASE_OBJECT *)psCurrS);
unsigned int damage = calcDamage(weaponRadDamage(psStats, psObj->player), psStats->weaponEffect, (BASE_OBJECT *)psCurrS);
if (bMultiPlayer)
{

View File

@ -39,7 +39,6 @@ typedef struct PROJECTILE
SIMPLE_ELEMENTS( struct PROJECTILE );
UBYTE state; ///< current projectile state
UBYTE airTarget; ///< whether the projectile was fierd at an airborn target
UBYTE player; ///< needed because damange and radDamage vary from base stat per player because of upgrades