Artillery prediction fix.
patch by Rhamphoryncus (Adam Olsen) fixes ticket:374 Thanks to per for the conversion git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7384 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
1855990fa8
commit
8cc20df76f
17
src/combat.c
17
src/combat.c
|
@ -350,7 +350,22 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
}
|
||||
else
|
||||
{
|
||||
flightTime = sqrt((double)dist) / 30; /* Purely a guess, but surprisingly effective */
|
||||
/* Copied out of proj_SendProjectile. Simplified slightly. */
|
||||
SDWORD dz = psTarget->pos.z - psAttacker->pos.z;
|
||||
SDWORD iRadSq = distSquared + dz*dz;
|
||||
SDWORD iVelSq = psStats->flightSpeed * psStats->flightSpeed;
|
||||
double fA = ACC_GRAVITY * (double)iRadSq / (2.0 * iVelSq);
|
||||
double fC = 4.0 * fA * (dz + fA);
|
||||
double fS = (double)iRadSq - fC;
|
||||
|
||||
if (fS < 0.0)
|
||||
{
|
||||
flightTime = sqrt((double)dist) / 30; /* Purely a guess, but surprisingly effective */
|
||||
}
|
||||
else
|
||||
{
|
||||
flightTime = (double)dist / (double)psStats->flightSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
if (psTarget->lastHitWeapon == WSC_EMP)
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include "mapgrid.h"
|
||||
|
||||
#define PROJ_MAX_PITCH 30
|
||||
#define ACC_GRAVITY 1000
|
||||
#define DIRECT_PROJ_SPEED 500
|
||||
#define VTOL_HITBOX_MODIFICATOR 100
|
||||
|
||||
|
@ -918,6 +917,11 @@ static void proj_InFlightIndirectFunc(PROJECTILE *psProj)
|
|||
psProj->startY + (distanceRatio * move.y),
|
||||
psProj->srcHeight + move.z
|
||||
};
|
||||
if (nextPos.z > UWORD_MAX / 2) /* Assume it wrapped around */
|
||||
{
|
||||
/* XXX FIXME Unfortunately, this usually occurs because we skipped past our target. */
|
||||
nextPos.z = 0;
|
||||
}
|
||||
|
||||
/* impact if about to go off map else update coordinates */
|
||||
if (!worldOnMap(nextPos.x, nextPos.y))
|
||||
|
|
|
@ -42,6 +42,7 @@ extern BASE_OBJECT *g_pProjLastAttacker; ///< The last unit that did damage - us
|
|||
#define BURNING 0x02 ///< Whether an object has just left the fire, but is still burning.
|
||||
#define BURN_TIME 10000 ///< How long an object burns for after leaving a fire.
|
||||
#define BURN_DAMAGE 15 ///< How much damaga a second an object takes when it is burning.
|
||||
#define ACC_GRAVITY 1000 ///< Downward force against projectiles.
|
||||
|
||||
/** How long to display a single electronic warfare shimmmer. */
|
||||
#define ELEC_DAMAGE_DURATION (GAME_TICKS_PER_SEC/5)
|
||||
|
|
Loading…
Reference in New Issue