Merge pull request #10636 from reaperrr/missile-speed

Refactor naming of Missile's speed-related properties
This commit is contained in:
abcdefg30
2016-02-24 17:39:25 +01:00
9 changed files with 78 additions and 39 deletions

View File

@@ -42,14 +42,14 @@ namespace OpenRA.Mods.Common.Effects
[Desc("Maximum vertical launch angle (pitch).")] [Desc("Maximum vertical launch angle (pitch).")]
public readonly WAngle MaximumLaunchAngle = new WAngle(128); public readonly WAngle MaximumLaunchAngle = new WAngle(128);
[Desc("Minimum launch speed in WDist / tick")] [Desc("Minimum launch speed in WDist / tick. Defaults to Speed if -1.")]
public readonly WDist MinimumLaunchSpeed = new WDist(75); public readonly WDist MinimumLaunchSpeed = new WDist(-1);
[Desc("Maximum launch speed in WDist / tick")] [Desc("Maximum launch speed in WDist / tick. Defaults to Speed if -1.")]
public readonly WDist MaximumLaunchSpeed = new WDist(200); public readonly WDist MaximumLaunchSpeed = new WDist(-1);
[Desc("Maximum projectile speed in WDist / tick")] [Desc("Maximum projectile speed in WDist / tick")]
public readonly WDist MaximumSpeed = new WDist(384); public readonly WDist Speed = new WDist(384);
[Desc("Projectile acceleration when propulsion activated.")] [Desc("Projectile acceleration when propulsion activated.")]
public readonly WDist Acceleration = new WDist(5); public readonly WDist Acceleration = new WDist(5);
@@ -244,7 +244,9 @@ namespace OpenRA.Mods.Common.Effects
void DetermineLaunchSpeedAndAngleForIncline(int predClfDist, int diffClfMslHgt, int relTarHorDist, void DetermineLaunchSpeedAndAngleForIncline(int predClfDist, int diffClfMslHgt, int relTarHorDist,
out int speed, out int vFacing) out int speed, out int vFacing)
{ {
speed = info.MaximumLaunchSpeed.Length; var minLaunchSpeed = info.MinimumLaunchSpeed.Length > -1 ? info.MinimumLaunchSpeed.Length : info.Speed.Length;
var maxLaunchSpeed = info.MaximumLaunchSpeed.Length > -1 ? info.MaximumLaunchSpeed.Length : info.Speed.Length;
speed = info.MaximumLaunchSpeed.Length > -1 ? info.MaximumLaunchSpeed.Length : info.Speed.Length;
// Find smallest vertical facing, for which the missile will be able to climb terrAltDiff w-units // Find smallest vertical facing, for which the missile will be able to climb terrAltDiff w-units
// within hHeightChange w-units all the while ending the ascent with vertical facing 0 // within hHeightChange w-units all the while ending the ascent with vertical facing 0
@@ -254,7 +256,7 @@ namespace OpenRA.Mods.Common.Effects
// to hit the target without passing it by (and thus having to do horizontal loops) // to hit the target without passing it by (and thus having to do horizontal loops)
var minSpeed = ((System.Math.Min(predClfDist * 1024 / (1024 - WAngle.FromFacing(vFacing).Sin()), var minSpeed = ((System.Math.Min(predClfDist * 1024 / (1024 - WAngle.FromFacing(vFacing).Sin()),
(relTarHorDist + predClfDist) * 1024 / (2 * (2048 - WAngle.FromFacing(vFacing).Sin()))) (relTarHorDist + predClfDist) * 1024 / (2 * (2048 - WAngle.FromFacing(vFacing).Sin())))
* info.VerticalRateOfTurn * 157) / 6400).Clamp(info.MinimumLaunchSpeed.Length, info.MaximumLaunchSpeed.Length); * info.VerticalRateOfTurn * 157) / 6400).Clamp(minLaunchSpeed, maxLaunchSpeed);
if ((sbyte)vFacing < 0) if ((sbyte)vFacing < 0)
speed = minSpeed; speed = minSpeed;
@@ -264,7 +266,7 @@ namespace OpenRA.Mods.Common.Effects
// Find highest speed greater than the above minimum that allows the missile // Find highest speed greater than the above minimum that allows the missile
// to surmount the incline // to surmount the incline
var vFac = vFacing; var vFac = vFacing;
speed = BisectionSearch(minSpeed, info.MaximumLaunchSpeed.Length, spd => speed = BisectionSearch(minSpeed, maxLaunchSpeed, spd =>
{ {
var lpRds = LoopRadius(spd, info.VerticalRateOfTurn); var lpRds = LoopRadius(spd, info.VerticalRateOfTurn);
return WillClimbWithinDistance(vFac, lpRds, predClfDist, diffClfMslHgt) return WillClimbWithinDistance(vFac, lpRds, predClfDist, diffClfMslHgt)
@@ -285,7 +287,7 @@ namespace OpenRA.Mods.Common.Effects
// TODO: Double check Launch parameter determination // TODO: Double check Launch parameter determination
void DetermineLaunchSpeedAndAngle(World world, out int speed, out int vFacing) void DetermineLaunchSpeedAndAngle(World world, out int speed, out int vFacing)
{ {
speed = info.MaximumLaunchSpeed.Length; speed = info.MaximumLaunchSpeed.Length > -1 ? info.MaximumLaunchSpeed.Length : info.Speed.Length;
loopRadius = LoopRadius(speed, info.VerticalRateOfTurn); loopRadius = LoopRadius(speed, info.VerticalRateOfTurn);
// Compute current distance from target position // Compute current distance from target position
@@ -304,7 +306,7 @@ namespace OpenRA.Mods.Common.Effects
else if (lastHt != 0) else if (lastHt != 0)
{ {
vFacing = System.Math.Max((sbyte)(info.MinimumLaunchAngle.Angle >> 2), (sbyte)0); vFacing = System.Math.Max((sbyte)(info.MinimumLaunchAngle.Angle >> 2), (sbyte)0);
speed = info.MaximumLaunchSpeed.Length; speed = info.MaximumLaunchSpeed.Length > -1 ? info.MaximumLaunchSpeed.Length : info.Speed.Length;
} }
else else
{ {
@@ -398,7 +400,7 @@ namespace OpenRA.Mods.Common.Effects
void ChangeSpeed(int sign = 1) void ChangeSpeed(int sign = 1)
{ {
speed = (speed + sign * info.Acceleration.Length).Clamp(0, info.MaximumSpeed.Length); speed = (speed + sign * info.Acceleration.Length).Clamp(0, info.Speed.Length);
// Compute the vertical loop radius // Compute the vertical loop radius
loopRadius = LoopRadius(speed, info.VerticalRateOfTurn); loopRadius = LoopRadius(speed, info.VerticalRateOfTurn);
@@ -409,7 +411,7 @@ namespace OpenRA.Mods.Common.Effects
// Compute the projectile's freefall displacement // Compute the projectile's freefall displacement
var move = velocity + gravity / 2; var move = velocity + gravity / 2;
velocity += gravity; velocity += gravity;
var velRatio = info.MaximumSpeed.Length * 1024 / velocity.Length; var velRatio = info.Speed.Length * 1024 / velocity.Length;
if (velRatio < 1024) if (velRatio < 1024)
velocity = velocity * velRatio / 1024; velocity = velocity * velRatio / 1024;

View File

@@ -3453,6 +3453,25 @@ namespace OpenRA.Mods.Common.UtilityCommands
} }
} }
// Rename some speed-related Missile properties
if (engineVersion < 20160205)
{
var mod = Game.ModData.Manifest.Mod.Id;
if (mod == "ts")
{
if (node.Key == "Projectile" && node.Value.Value == "Missile")
{
node.Value.Nodes.Add(new MiniYamlNode("MinimumLaunchSpeed", "75"));
node.Value.Nodes.Add(new MiniYamlNode("Speed", "384"));
}
}
else
{
if (node.Key == "MaximumLaunchSpeed" && parent.Value.Value == "Missile")
node.Key = "Speed";
}
}
UpgradeWeaponRules(engineVersion, ref node.Value.Nodes, node, depth + 1); UpgradeWeaponRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
} }
} }

View File

@@ -12,7 +12,7 @@ Rockets:
HorizontalRateOfTurn: 15 HorizontalRateOfTurn: 15
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
MaximumLaunchSpeed: 298 Speed: 298
RangeLimit: 20 RangeLimit: 20
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
@@ -46,7 +46,7 @@ BikeRockets:
HorizontalRateOfTurn: 10 HorizontalRateOfTurn: 10
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
MaximumLaunchSpeed: 213 Speed: 213
RangeLimit: 30 RangeLimit: 30
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
@@ -81,7 +81,7 @@ OrcaAGMissiles:
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
MaximumLaunchSpeed: 256 Speed: 256
RangeLimit: 30 RangeLimit: 30
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
@@ -115,7 +115,7 @@ OrcaAAMissiles:
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
MaximumLaunchSpeed: 298 Speed: 298
RangeLimit: 30 RangeLimit: 30
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
@@ -146,7 +146,7 @@ MammothMissiles:
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
MaximumLaunchSpeed: 341 Speed: 341
RangeLimit: 35 RangeLimit: 35
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 298 Spread: 298
@@ -219,7 +219,7 @@ MammothMissiles:
HorizontalRateOfTurn: 10 HorizontalRateOfTurn: 10
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
MaximumLaunchSpeed: 213 Speed: 213
RangeLimit: 40 RangeLimit: 40
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
@@ -251,7 +251,7 @@ BoatMissile:
HorizontalRateOfTurn: 10 HorizontalRateOfTurn: 10
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
MaximumLaunchSpeed: 170 Speed: 170
RangeLimit: 60 RangeLimit: 60
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 256 Spread: 256
@@ -286,7 +286,7 @@ TowerMissle:
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
MaximumLaunchSpeed: 298 Speed: 298
RangeLimit: 40 RangeLimit: 40
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 683 Spread: 683
@@ -314,7 +314,7 @@ SAMMissile:
Blockable: false Blockable: false
Image: MISSILE Image: MISSILE
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
MaximumLaunchSpeed: 426 Speed: 426
RangeLimit: 35 RangeLimit: 35
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
@@ -375,7 +375,7 @@ Patriot:
TrailImage: smokey TrailImage: smokey
ContrailLength: 8 ContrailLength: 8
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
MaximumLaunchSpeed: 300 Speed: 300
RangeLimit: 30 RangeLimit: 30
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 682 Spread: 682

View File

@@ -3,7 +3,7 @@ Bazooka:
Range: 3c0 Range: 3c0
Report: ROCKET1.WAV Report: ROCKET1.WAV
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 281 Speed: 281
Inaccuracy: 256 Inaccuracy: 256
Image: RPG Image: RPG
HorizontalRateOfTurn: 1 HorizontalRateOfTurn: 1
@@ -42,7 +42,7 @@ Rocket:
TrailImage: bazooka_trail2 TrailImage: bazooka_trail2
TrailPalette: effect75alpha TrailPalette: effect75alpha
TrailInterval: 1 TrailInterval: 1
MaximumLaunchSpeed: 343 Speed: 343
RangeLimit: 35 RangeLimit: 35
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 160 Spread: 160
@@ -81,7 +81,7 @@ TowerMissile:
Image: MISSILE2 Image: MISSILE2
TrailImage: large_trail TrailImage: large_trail
TrailInterval: 1 TrailInterval: 1
MaximumLaunchSpeed: 320 Speed: 320
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 256 Spread: 256
Falloff: 100, 50, 25, 0 Falloff: 100, 50, 25, 0
@@ -111,7 +111,7 @@ mtank_pri:
Report: ROCKET1.WAV Report: ROCKET1.WAV
ValidTargets: Ground, Air ValidTargets: Ground, Air
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 281 Speed: 281
RangeLimit: 50 RangeLimit: 50
HorizontalRateOfTurn: 3 HorizontalRateOfTurn: 3
Blockable: false Blockable: false
@@ -146,7 +146,7 @@ DeviatorMissile:
Range: 5c0 Range: 5c0
Report: MISSLE1.WAV Report: MISSLE1.WAV
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 281 Speed: 281
RangeLimit: 40 RangeLimit: 40
HorizontalRateOfTurn: 3 HorizontalRateOfTurn: 3
Blockable: false Blockable: false

View File

@@ -841,8 +841,8 @@ Weapons:
Range: 10c0 Range: 10c0
ValidTargets: Ground, Air ValidTargets: Ground, Air
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 128
Blockable: false Blockable: false
Speed: 128
TrailImage: smokey TrailImage: smokey
ContrailLength: 150 ContrailLength: 150
Inaccuracy: 0c853 Inaccuracy: 0c853

View File

@@ -7,7 +7,7 @@ Maverick:
BurstDelay: 7 BurstDelay: 7
ValidTargets: Ground, Water ValidTargets: Ground, Water
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 256 Speed: 256
Arm: 2 Arm: 2
Blockable: false Blockable: false
ContrailLength: 10 ContrailLength: 10
@@ -43,7 +43,7 @@ Dragon:
Report: missile6.aud Report: missile6.aud
ValidTargets: Ground, Water ValidTargets: Ground, Water
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 213 Speed: 213
Arm: 2 Arm: 2
Blockable: false Blockable: false
TrailImage: smokey TrailImage: smokey
@@ -82,7 +82,7 @@ HellfireAG:
BurstDelay: 10 BurstDelay: 10
ValidTargets: Ground, Water ValidTargets: Ground, Water
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 256 Speed: 256
Arm: 2 Arm: 2
Blockable: false Blockable: false
ContrailLength: 10 ContrailLength: 10
@@ -120,7 +120,7 @@ HellfireAA:
BurstDelay: 10 BurstDelay: 10
ValidTargets: Air ValidTargets: Air
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 384 Speed: 384
Arm: 2 Arm: 2
Blockable: false Blockable: false
ContrailLength: 10 ContrailLength: 10
@@ -156,7 +156,7 @@ MammothTusk:
Burst: 2 Burst: 2
ValidTargets: Air, Infantry ValidTargets: Air, Infantry
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 341 Speed: 341
Arm: 2 Arm: 2
Blockable: false Blockable: false
ContrailLength: 10 ContrailLength: 10
@@ -201,7 +201,7 @@ Nike:
Image: MISSILE Image: MISSILE
HorizontalRateOfTurn: 25 HorizontalRateOfTurn: 25
RangeLimit: 50 RangeLimit: 50
MaximumLaunchSpeed: 341 Speed: 341
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 50 Damage: 50
@@ -229,7 +229,7 @@ RedEye:
Image: MISSILE Image: MISSILE
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
RangeLimit: 30 RangeLimit: 30
MaximumLaunchSpeed: 298 Speed: 298
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 40 Damage: 40
@@ -293,7 +293,7 @@ Stinger:
Image: DRAGON Image: DRAGON
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
RangeLimit: 50 RangeLimit: 50
MaximumLaunchSpeed: 170 Speed: 170
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 30 Damage: 30
@@ -333,7 +333,7 @@ StingerAA:
Image: DRAGON Image: DRAGON
HorizontalRateOfTurn: 20 HorizontalRateOfTurn: 20
RangeLimit: 50 RangeLimit: 50
MaximumLaunchSpeed: 255 Speed: 255
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 30 Damage: 30
@@ -369,7 +369,7 @@ TorpTube:
Projectile: Missile Projectile: Missile
Image: torpedo Image: torpedo
Arm: 3 Arm: 3
MaximumLaunchSpeed: 85 Speed: 85
TrailImage: bubbles TrailImage: bubbles
HorizontalRateOfTurn: 1 HorizontalRateOfTurn: 1
RangeLimit: 160 RangeLimit: 160
@@ -441,7 +441,7 @@ APTusk:
Report: missile6.aud Report: missile6.aud
ValidTargets: Ground, Water ValidTargets: Ground, Water
Projectile: Missile Projectile: Missile
MaximumLaunchSpeed: 298 Speed: 298
Arm: 2 Arm: 2
Blockable: false Blockable: false
TrailImage: smokey TrailImage: smokey

View File

@@ -111,6 +111,8 @@ CyCannon:
HorizontalRateOfTurn: 2 HorizontalRateOfTurn: 2
Shadow: true Shadow: true
Image: TORPEDO Image: TORPEDO
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 43 Spread: 43
Damage: 120 Damage: 120

View File

@@ -14,6 +14,8 @@ Bazooka:
HorizontalRateOfTurn: 8 HorizontalRateOfTurn: 8
RangeLimit: 50 RangeLimit: 50
Palette: ra Palette: ra
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 25 Damage: 25
@@ -58,6 +60,8 @@ HoverMissile:
HorizontalRateOfTurn: 8 HorizontalRateOfTurn: 8
RangeLimit: 35 RangeLimit: 35
Palette: ra Palette: ra
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 30 Damage: 30
@@ -101,6 +105,8 @@ MammothTusk:
MaximumLaunchSpeed: 213 MaximumLaunchSpeed: 213
RangeLimit: 50 RangeLimit: 50
Palette: ra Palette: ra
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 171 Spread: 171
Damage: 40 Damage: 40
@@ -140,6 +146,8 @@ BikeMissile:
MaximumLaunchSpeed: 213 MaximumLaunchSpeed: 213
RangeLimit: 50 RangeLimit: 50
Palette: ra Palette: ra
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 256 Spread: 256
Damage: 40 Damage: 40
@@ -180,6 +188,8 @@ Dragon:
HorizontalRateOfTurn: 8 HorizontalRateOfTurn: 8
RangeLimit: 50 RangeLimit: 50
Palette: ra Palette: ra
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 30 Damage: 30
@@ -224,6 +234,8 @@ Hellfire:
HorizontalRateOfTurn: 8 HorizontalRateOfTurn: 8
RangeLimit: 35 RangeLimit: 35
Palette: ra Palette: ra
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 85 Spread: 85
Damage: 30 Damage: 30
@@ -267,6 +279,8 @@ RedEye2:
HorizontalRateOfTurn: 5 HorizontalRateOfTurn: 5
RangeLimit: 100 RangeLimit: 100
Palette: ra Palette: ra
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 33 Damage: 33

View File

@@ -13,6 +13,8 @@ MultiCluster:
HorizontalRateOfTurn: 8 HorizontalRateOfTurn: 8
RangeLimit: 35 RangeLimit: 35
Palette: ra Palette: ra
MinimumLaunchSpeed: 75
Speed: 384
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 128 Spread: 128
Damage: 65 Damage: 65