remove VisualDest crap from bullets & combat code
This commit is contained in:
@@ -40,7 +40,7 @@ namespace OpenRA
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void DoImpact(WarheadInfo warhead, ProjectileArgs args, int2 visualLocation)
|
||||
public static void DoImpact(WarheadInfo warhead, ProjectileArgs args)
|
||||
{
|
||||
var world = args.firedBy.World;
|
||||
var targetTile = ((1f / Game.CellSize) * args.dest.ToFloat2()).ToInt2();
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA
|
||||
|
||||
if (warhead.Explosion != 0)
|
||||
world.AddFrameEndTask(
|
||||
w => w.Add(new Explosion(w, visualLocation, warhead.Explosion, isWater)));
|
||||
w => w.Add(new Explosion(w, args.dest, warhead.Explosion, isWater)));
|
||||
|
||||
Sound.Play(GetImpactSound(warhead, isWater));
|
||||
|
||||
@@ -92,11 +92,11 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoImpacts(ProjectileArgs args, int2 visualLocation)
|
||||
public static void DoImpacts(ProjectileArgs args)
|
||||
{
|
||||
foreach (var warhead in args.weapon.Warheads)
|
||||
{
|
||||
Action a = () => DoImpact(warhead, args, visualLocation);
|
||||
Action a = () => DoImpact(warhead, args);
|
||||
if (warhead.Delay > 0)
|
||||
args.firedBy.World.AddFrameEndTask(
|
||||
w => w.Add(new DelayedAction(warhead.Delay, a)));
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA
|
||||
facing = 0
|
||||
};
|
||||
|
||||
DoImpacts(args, location);
|
||||
DoImpacts(args);
|
||||
}
|
||||
|
||||
static float GetDamageToInflict(Actor target, ProjectileArgs args, WarheadInfo warhead, float modifier)
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace OpenRA.Effects
|
||||
{
|
||||
readonly BulletInfo Info;
|
||||
readonly ProjectileArgs Args;
|
||||
readonly int2 VisualDest;
|
||||
|
||||
int t = 0;
|
||||
Animation anim;
|
||||
@@ -63,8 +62,6 @@ namespace OpenRA.Effects
|
||||
Args.dest += (info.Inaccuracy * factor * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2();
|
||||
}
|
||||
|
||||
VisualDest = Args.dest + (10 * Game.CosmeticRandom.Gauss2D(1)).ToInt2();
|
||||
|
||||
if (Info.Image != null)
|
||||
{
|
||||
anim = new Animation(Info.Image, () => Traits.Util.GetFacing(Args.dest - Args.src, 0));
|
||||
@@ -84,11 +81,11 @@ namespace OpenRA.Effects
|
||||
{
|
||||
var at = (float)t / TotalTime();
|
||||
var altitude = float2.Lerp(Args.srcAltitude, Args.destAltitude, at);
|
||||
var pos = float2.Lerp(Args.src, VisualDest, at)
|
||||
var pos = float2.Lerp(Args.src, Args.dest, at)
|
||||
- 0.5f * anim.Image.size - new float2(0, altitude);
|
||||
|
||||
var highPos = (Info.High || Info.Arcing)
|
||||
? (pos - new float2(0, (VisualDest - Args.src).Length * height * 4 * at * (1 - at)))
|
||||
? (pos - new float2(0, (Args.dest - Args.src).Length * height * 4 * at * (1 - at)))
|
||||
: pos;
|
||||
|
||||
world.AddFrameEndTask(w => w.Add(
|
||||
@@ -105,7 +102,7 @@ namespace OpenRA.Effects
|
||||
var at = (float)t / TotalTime();
|
||||
|
||||
var altitude = float2.Lerp(Args.srcAltitude, Args.destAltitude, at);
|
||||
var pos = float2.Lerp( Args.src, VisualDest, at)
|
||||
var pos = float2.Lerp( Args.src, Args.dest, at)
|
||||
- 0.5f * anim.Image.size - new float2( 0, altitude );
|
||||
|
||||
if (Info.High || Info.Arcing)
|
||||
@@ -113,7 +110,7 @@ namespace OpenRA.Effects
|
||||
if (Info.Shadow)
|
||||
yield return new Renderable(anim.Image, pos - .5f * anim.Image.size, "shadow");
|
||||
|
||||
var highPos = pos - new float2(0, (VisualDest - Args.src).Length * height * 4 * at * (1 - at));
|
||||
var highPos = pos - new float2(0, (Args.dest - Args.src).Length * height * 4 * at * (1 - at));
|
||||
|
||||
yield return new Renderable(anim.Image, highPos - .5f * anim.Image.size, Args.firedBy.Owner.Palette);
|
||||
}
|
||||
@@ -126,7 +123,7 @@ namespace OpenRA.Effects
|
||||
void Explode( World world )
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
Combat.DoImpacts(Args, VisualDest - new int2(0, Args.destAltitude));
|
||||
Combat.DoImpacts(Args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Effects
|
||||
if (--altitude <= Args.destAltitude)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
Combat.DoImpacts(Args, Args.dest);
|
||||
Combat.DoImpacts(Args);
|
||||
}
|
||||
|
||||
anim.Tick();
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Effects
|
||||
|
||||
if (!doneDamage)
|
||||
{
|
||||
Combat.DoImpacts(args, args.dest);
|
||||
Combat.DoImpacts(args);
|
||||
doneDamage = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace OpenRA.Effects
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
Args.dest = Pos.ToInt2();
|
||||
if (t > Info.Arm * 40) /* don't blow up in our launcher's face! */
|
||||
Combat.DoImpacts(Args, Pos.ToInt2());
|
||||
Combat.DoImpacts(Args);
|
||||
}
|
||||
|
||||
public IEnumerable<Renderable> Render()
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Effects
|
||||
|
||||
if (!doneDamage)
|
||||
{
|
||||
Combat.DoImpacts(Args, Args.dest);
|
||||
Combat.DoImpacts(Args);
|
||||
doneDamage = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Cnc
|
||||
firedBy = self,
|
||||
target = self,
|
||||
weapon = Rules.Weapons[info.Weapon.ToLowerInvariant()]
|
||||
}, self.CenterLocation.ToInt2());
|
||||
});
|
||||
|
||||
poisonTicks = Rules.Weapons[info.Weapon.ToLowerInvariant()].ROF;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user