---
src/projectile.c | 107 +++++++++++++++++++++++++++---------------------------
1 files changed, 53 insertions(+), 54 deletions(-)
diff --git a/src/projectile.c b/src/projectile.c
index 2a9aefa..15363bf 100644
--- a/src/projectile.c
+++ b/src/projectile.c
@@ -652,12 +652,12 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
CHECK_PROJECTILE(psProj);
+ timeSoFar = gameTime - psProj->born;
+
psStats = psProj->psWStats;
ASSERT( psStats != NULL,
"proj_InFlightDirectFunc: Invalid weapon stats pointer" );
- timeSoFar = gameTime - psProj->born;
-
/* we want a delay between Las-Sats firing and actually hitting in multiPlayer
magic number but that's how long the audio countdown message lasts! */
if ( bMultiPlayer && psStats->weaponSubClass == WSC_LAS_SAT &&
@@ -666,6 +666,41 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
return;
}
+ /* Calculate extended lifespan where appropriate */
+ switch (psStats->weaponSubClass)
+ {
+ case WSC_MGUN:
+ case WSC_COMMAND:
+ distanceExtensionFactor = 1.2f;
+ break;
+ case WSC_CANNON:
+ case WSC_BOMB:
+ case WSC_ELECTRONIC:
+ case WSC_EMP:
+ case WSC_FLAME:
+ case WSC_ENERGY:
+ case WSC_GAUSS:
+ distanceExtensionFactor = 1.5f;
+ break;
+ case WSC_AAGUN: // No extended distance
+ distanceExtensionFactor = 1.0f;
+ break;
+ case WSC_ROCKET:
+ case WSC_MISSILE:
+ case WSC_SLOWROCKET:
+ case WSC_SLOWMISSILE:
+ bMissile = true; // Take the same extended targetDistance as artillery
+ case WSC_COUNTER:
+ case WSC_MORTARS:
+ case WSC_HOWITZERS:
+ case WSC_LAS_SAT:
+ distanceExtensionFactor = 1.5f;
+ break;
+ default:
+ // NUM_WEAPON_SUBCLASS and INVALID_SUBCLASS
+ break;
+ }
+
/* Do movement */
{
unsigned int targetDistance, currentDistance;
@@ -689,7 +724,7 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
currentDistance = timeSoFar * psStats->flightSpeed / GAME_TICKS_PER_SEC;
// Prevent div by zero:
- if (targetDistance == 0)
+ if ( targetDistance == 0 )
targetDistance = 1;
distanceRatio = (float)currentDistance / targetDistance;
@@ -717,41 +752,6 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
}
}
- // Calculate extended lifespan where appropriate
- switch (psStats->weaponSubClass)
- {
- case WSC_MGUN:
- case WSC_COMMAND:
- distanceExtensionFactor = 1.2f;
- break;
- case WSC_CANNON:
- case WSC_BOMB:
- case WSC_ELECTRONIC:
- case WSC_EMP:
- case WSC_FLAME:
- case WSC_ENERGY:
- case WSC_GAUSS:
- distanceExtensionFactor = 1.5f;
- break;
- case WSC_AAGUN: // No extended distance
- distanceExtensionFactor = 1.0f;
- break;
- case WSC_ROCKET:
- case WSC_MISSILE:
- case WSC_SLOWROCKET:
- case WSC_SLOWMISSILE:
- bMissile = true; // Take the same extended targetDistance as artillery
- case WSC_COUNTER:
- case WSC_MORTARS:
- case WSC_HOWITZERS:
- case WSC_LAS_SAT:
- distanceExtensionFactor = 1.5f;
- break;
- default:
- // NUM_WEAPON_SUBCLASS and INVALID_SUBCLASS
- break;
- }
-
for (i = 0; i < numProjNaybors; i++)
{
BASE_OBJECT *psTempObj = asProjNaybors[i].psObj;
@@ -764,7 +764,7 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
continue;
}
- if (psTempObj->died)
+ if ( psTempObj->died )
{
// Do not damage dead objects further
continue;
@@ -791,11 +791,11 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
continue;
}
- if (psStats->surfaceToAir == SHOOT_IN_AIR &&
+ if ( psStats->surfaceToAir == SHOOT_IN_AIR &&
( psTempObj->type == OBJ_STRUCTURE ||
psTempObj->type == OBJ_FEATURE ||
- (psTempObj->type == OBJ_DROID && !vtolDroid((DROID *)psTempObj))
- ))
+ ( psTempObj->type == OBJ_DROID && !vtolDroid((DROID *)psTempObj) )
+ ) )
{
// AA weapons should not hit buildings and non-vtol droids
continue;
@@ -804,8 +804,8 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
{
// FIXME HACK Needed since we got those ugly Vector3uw floating around in BASE_OBJECT...
Vector3i
- posProj = {psProj->pos.x, psProj->pos.y, psProj->pos.z},
- posTemp = {psTempObj->pos.x, psTempObj->pos.y, psTempObj->pos.z};
+ posProj = { psProj->pos.x, psProj->pos.y, psProj->pos.z },
+ posTemp = { psTempObj->pos.x, psTempObj->pos.y, psTempObj->pos.z };
Vector3i diff = Vector3i_Sub(posProj, posTemp);
@@ -824,7 +824,7 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
/* Buildings cannot be penetrated and we need a penetrating weapon */
if ( psTempObj->type == OBJ_DROID && psStats->penetrate )
{
- WEAPON asWeap = {psStats - asWeaponStats, 0, 0, 0, 0};
+ WEAPON asWeap = { psStats - asWeaponStats, 0, 0, 0, 0 };
// Determine position to fire a missile at
// (must be at least 0 because we don't use signed integers
// this shouldn't be larger than the height and width of the map either)
@@ -850,7 +850,7 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
}
}
- if (distanceRatio > distanceExtensionFactor || /* We've traveled our maximum range */
+ if ( distanceRatio > distanceExtensionFactor || /* We've traveled our maximum range */
!mapObjIsAboveGround( (BASE_OBJECT *) psProj ) ) /* trying to travel through terrain */
{
/* Miss due to range or height */
@@ -862,13 +862,6 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
/* Paint effects if visible */
if ( gfxVisible(psProj) )
{
- /* add smoke trail to indirect weapons firing directly */
- if( !proj_Direct(psStats) && gfxVisible(psProj))
- {
- Vector3i pos = { psProj->pos.x, psProj->pos.z+8, psProj->pos.y };
- addEffect(&pos,EFFECT_SMOKE,SMOKE_TYPE_TRAIL,false,NULL,0);
- }
-
switch (psStats->weaponSubClass)
{
case WSC_FLAME:
@@ -894,7 +887,13 @@ static void proj_InFlightDirectFunc( PROJECTILE *psProj )
addEffect(&pos,EFFECT_SMOKE,SMOKE_TYPE_TRAIL,false,NULL,0);
} break;
default:
- /* No effect */
+ /* add smoke trail to indirect weapons firing directly */
+ if ( !proj_Direct(psStats) )
+ {
+ Vector3i pos = { psProj->pos.x, psProj->pos.z+4, psProj->pos.y };
+ addEffect(&pos,EFFECT_SMOKE,SMOKE_TYPE_TRAIL,false,NULL,0);
+ }
+ /* Otherwise no effect */
break;
}
}
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev