Reformat r7155 to follow coding style
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7157 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
2a4a462502
commit
b17b7823a8
16
src/combat.c
16
src/combat.c
|
@ -339,27 +339,37 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
||||||
|
|
||||||
/* Kerrrbaaang !!!!! a hit */
|
/* Kerrrbaaang !!!!! a hit */
|
||||||
//Watermelon:Target prediction
|
//Watermelon:Target prediction
|
||||||
if(psTarget->type == OBJ_DROID)
|
if (psTarget->type == OBJ_DROID)
|
||||||
{
|
{
|
||||||
double flightTime;
|
double flightTime;
|
||||||
SDWORD empTime = 0;
|
SDWORD empTime = 0;
|
||||||
|
|
||||||
if (proj_Direct(psStats) || dist <= psStats->minRange)
|
if (proj_Direct(psStats) || dist <= psStats->minRange)
|
||||||
|
{
|
||||||
flightTime = dist / psStats->flightSpeed;
|
flightTime = dist / psStats->flightSpeed;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
flightTime = sqrt(dist) / 30; /* Purely a guess, but surprisingly effective */
|
flightTime = sqrt(dist) / 30; /* Purely a guess, but surprisingly effective */
|
||||||
|
}
|
||||||
|
|
||||||
if (psTarget->lastHitWeapon == WSC_EMP) {
|
if (psTarget->lastHitWeapon == WSC_EMP)
|
||||||
|
{
|
||||||
empTime = EMP_DISABLE_TIME - (gameTime - psTarget->timeLastHit);
|
empTime = EMP_DISABLE_TIME - (gameTime - psTarget->timeLastHit);
|
||||||
CLIP(empTime, 0, EMP_DISABLE_TIME);
|
CLIP(empTime, 0, EMP_DISABLE_TIME);
|
||||||
if (empTime >= EMP_DISABLE_TIME * 0.9)
|
if (empTime >= EMP_DISABLE_TIME * 0.9)
|
||||||
|
{
|
||||||
flightTime = 0; /* Just hit. Assume they'll get hit again */
|
flightTime = 0; /* Just hit. Assume they'll get hit again */
|
||||||
else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
flightTime -= empTime / 1000;
|
flightTime -= empTime / 1000;
|
||||||
if (flightTime < 0.0)
|
if (flightTime < 0.0)
|
||||||
|
{
|
||||||
flightTime = 0.0;
|
flightTime = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
predict.x = trigSin( ((DROID *)psTarget)->sMove.moveDir ) * ((DROID *)psTarget)->sMove.speed * flightTime;
|
predict.x = trigSin( ((DROID *)psTarget)->sMove.moveDir ) * ((DROID *)psTarget)->sMove.speed * flightTime;
|
||||||
predict.x += psTarget->pos.x;
|
predict.x += psTarget->pos.x;
|
||||||
|
|
Loading…
Reference in New Issue