Fix turret muzzleflash.

This commit is contained in:
Paul Chote
2014-04-05 17:57:50 +13:00
parent 15c2930eeb
commit 4025db45a3
3 changed files with 13 additions and 6 deletions

View File

@@ -19,7 +19,10 @@ namespace OpenRA.Mods.RA.Render
{
class WithMuzzleFlashInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<AttackBaseInfo>, Requires<ArmamentInfo>
{
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.self); }
[Desc("Ignore the weapon position, and always draw relative to the center of the actor")]
public readonly bool IgnoreOffset = false;
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.self, this); }
}
class WithMuzzleFlash : INotifyAttack, IRender, ITick
@@ -28,7 +31,7 @@ namespace OpenRA.Mods.RA.Render
Dictionary<Barrel, AnimationWithOffset> anims = new Dictionary<Barrel, AnimationWithOffset>();
Func<int> getFacing;
public WithMuzzleFlash(Actor self)
public WithMuzzleFlash(Actor self, WithMuzzleFlashInfo info)
{
var render = self.Trait<RenderSprites>();
var facing = self.TraitOrDefault<IFacing>();
@@ -52,7 +55,7 @@ namespace OpenRA.Mods.RA.Render
visible.Add(barrel, false);
anims.Add(barrel,
new AnimationWithOffset(muzzleFlash,
() => arm.MuzzleOffset(self, barrel),
() => info.IgnoreOffset ? WVec.Zero : arm.MuzzleOffset(self, barrel),
() => !visible[barrel],
p => WithTurret.ZOffsetFromCenter(self, p, 2)));
}

View File

@@ -469,6 +469,7 @@ WALL:
QuantizedFacings: 32
WithTurret:
WithMuzzleFlash:
IgnoreOffset: true
Turreted:
ROT: 6
InitialFacing: 128

View File

@@ -61,9 +61,10 @@ guntowera:
Facings: -32
Offset: -24,16
muzzle: DATA
Frames: 3775, 3775, 3776, 3776, 3777, 3777, 3778, 3778, 3779, 3779, 3780, 3780, 3781, 3781, 3782, 3782, 3783, 3783, 3784, 3784, 3785, 3785, 3786, 3786, 3787, 3787, 3788, 3788, 3789, 3789, 3790, 3790, 3791, 3791, 3792, 3792, 3793, 3793, 3794, 3794, 3795, 3795, 3796, 3796, 3797, 3797, 3798, 3798, 3799, 3799, 3800, 3800, 3801, 3801, 3802, 3802, 3803, 3803, 3804, 3804, 3805, 3805, 3806, 3806
Frames: 3839, 3839, 3840, 3840, 3841, 3841, 3842, 3842, 3843, 3843, 3844, 3844, 3845, 3845, 3846, 3846, 3847, 3847, 3848, 3848, 3849, 3849, 3850, 3850, 3851, 3851, 3852, 3852, 3853, 3853, 3854, 3854, 3855, 3855, 3856, 3856, 3857, 3857, 3858, 3858, 3859, 3859, 3860, 3860, 3861, 3861, 3862, 3862, 3863, 3863, 3864, 3864, 3865, 3865, 3866, 3866, 3867, 3867, 3868, 3868, 3869, 3869, 3870, 3870
Facings: -32
Length: 2
Offset: 0,-12
BlendMode: Additive
icon: DATA
Start: 4069
@@ -83,9 +84,10 @@ guntowerh:
Facings: -32
Offset: -24,16
muzzle: DATA
Frames: 3775, 3775, 3776, 3776, 3777, 3777, 3778, 3778, 3779, 3779, 3780, 3780, 3781, 3781, 3782, 3782, 3783, 3783, 3784, 3784, 3785, 3785, 3786, 3786, 3787, 3787, 3788, 3788, 3789, 3789, 3790, 3790, 3791, 3791, 3792, 3792, 3793, 3793, 3794, 3794, 3795, 3795, 3796, 3796, 3797, 3797, 3798, 3798, 3799, 3799, 3800, 3800, 3801, 3801, 3802, 3802, 3803, 3803, 3804, 3804, 3805, 3805, 3806, 3806
Frames: 3839, 3839, 3840, 3840, 3841, 3841, 3842, 3842, 3843, 3843, 3844, 3844, 3845, 3845, 3846, 3846, 3847, 3847, 3848, 3848, 3849, 3849, 3850, 3850, 3851, 3851, 3852, 3852, 3853, 3853, 3854, 3854, 3855, 3855, 3856, 3856, 3857, 3857, 3858, 3858, 3859, 3859, 3860, 3860, 3861, 3861, 3862, 3862, 3863, 3863, 3864, 3864, 3865, 3865, 3866, 3866, 3867, 3867, 3868, 3868, 3869, 3869, 3870, 3870
Facings: -32
Length: 2
Offset: 0,-12
BlendMode: Additive
icon: DATA
Frames: 4070
@@ -105,9 +107,10 @@ guntowero:
Facings: -32
Offset: -24,16
muzzle: DATA
Frames: 3775, 3775, 3776, 3776, 3777, 3777, 3778, 3778, 3779, 3779, 3780, 3780, 3781, 3781, 3782, 3782, 3783, 3783, 3784, 3784, 3785, 3785, 3786, 3786, 3787, 3787, 3788, 3788, 3789, 3789, 3790, 3790, 3791, 3791, 3792, 3792, 3793, 3793, 3794, 3794, 3795, 3795, 3796, 3796, 3797, 3797, 3798, 3798, 3799, 3799, 3800, 3800, 3801, 3801, 3802, 3802, 3803, 3803, 3804, 3804, 3805, 3805, 3806, 3806
Frames: 3839, 3839, 3840, 3840, 3841, 3841, 3842, 3842, 3843, 3843, 3844, 3844, 3845, 3845, 3846, 3846, 3847, 3847, 3848, 3848, 3849, 3849, 3850, 3850, 3851, 3851, 3852, 3852, 3853, 3853, 3854, 3854, 3855, 3855, 3856, 3856, 3857, 3857, 3858, 3858, 3859, 3859, 3860, 3860, 3861, 3861, 3862, 3862, 3863, 3863, 3864, 3864, 3865, 3865, 3866, 3866, 3867, 3867, 3868, 3868, 3869, 3869, 3870, 3870
Facings: -32
Length: 2
Offset: 0,-12
BlendMode: Additive
icon: DATA
Start: 4071