From b5602684953ec55e7f573c66ffa67d1b28906a0a Mon Sep 17 00:00:00 2001 From: Pavlos Touboulidis Date: Sun, 11 May 2014 03:05:47 +0300 Subject: [PATCH] Change animations to use the proper SequenceProvider Remove references to the global "Game" and use the SequenceProvider of the current world/map. --- OpenRA.Game/Effects/MoveFlash.cs | 2 +- OpenRA.Game/Graphics/Animation.cs | 24 +++++++------------ OpenRA.Game/Traits/Render/RenderSimple.cs | 6 ++--- OpenRA.Game/Traits/SelectionDecorations.cs | 6 ++--- OpenRA.Game/Widgets/SpriteSequenceWidget.cs | 2 +- OpenRA.Game/Widgets/SpriteWidget.cs | 2 +- OpenRA.Mods.Cnc/Effects/IonCannon.cs | 12 +++++----- OpenRA.Mods.Cnc/RenderGunboat.cs | 8 +++---- .../Widgets/ProductionPaletteWidget.cs | 6 ++--- .../Widgets/SupportPowersWidget.cs | 4 ++-- OpenRA.Mods.Cnc/WithFire.cs | 2 +- OpenRA.Mods.Cnc/WithRoof.cs | 2 +- .../Render/WithBuildingPlacedOverlayInfo.cs | 2 +- OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs | 2 +- .../Render/WithProductionOverlay.cs | 2 +- OpenRA.Mods.RA/Attack/AttackGarrisoned.cs | 2 +- OpenRA.Mods.RA/Buildings/Bib.cs | 2 +- OpenRA.Mods.RA/Burns.cs | 2 +- OpenRA.Mods.RA/Effects/Beacon.cs | 9 ++++--- OpenRA.Mods.RA/Effects/Bullet.cs | 4 +++- OpenRA.Mods.RA/Effects/Corpse.cs | 2 +- OpenRA.Mods.RA/Effects/CrateEffect.cs | 6 +++-- OpenRA.Mods.RA/Effects/Explosion.cs | 2 +- OpenRA.Mods.RA/Effects/GpsDot.cs | 2 +- OpenRA.Mods.RA/Effects/GpsSatellite.cs | 20 +++++++++------- OpenRA.Mods.RA/Effects/GravityBomb.cs | 2 +- OpenRA.Mods.RA/Effects/LaserZap.cs | 2 +- OpenRA.Mods.RA/Effects/Missile.cs | 2 +- OpenRA.Mods.RA/Effects/NukeLaunch.cs | 2 +- OpenRA.Mods.RA/Effects/Parachute.cs | 2 +- OpenRA.Mods.RA/Effects/PowerdownIndicator.cs | 9 ++++--- OpenRA.Mods.RA/Effects/RallyPoint.cs | 11 ++++++--- OpenRA.Mods.RA/Effects/Rank.cs | 7 +++--- OpenRA.Mods.RA/Effects/RepairIndicator.cs | 12 ++++++---- OpenRA.Mods.RA/Effects/SatelliteLaunch.cs | 8 ++++--- OpenRA.Mods.RA/Effects/Smoke.cs | 3 ++- .../Orders/PlaceBuildingOrderGenerator.cs | 2 +- .../Render/RenderBuildingWarFactory.cs | 12 +++++----- OpenRA.Mods.RA/Render/RenderHarvester.cs | 2 +- OpenRA.Mods.RA/Render/WithCrateBody.cs | 6 ++--- OpenRA.Mods.RA/Render/WithHarvestAnimation.cs | 2 +- OpenRA.Mods.RA/Render/WithIdleOverlay.cs | 2 +- OpenRA.Mods.RA/Render/WithMuzzleFlash.cs | 2 +- OpenRA.Mods.RA/Render/WithResources.cs | 2 +- OpenRA.Mods.RA/Render/WithRotor.cs | 2 +- OpenRA.Mods.RA/Render/WithSmoke.cs | 2 +- OpenRA.Mods.RA/Render/WithTurret.cs | 2 +- OpenRA.Mods.RA/ThrowsParticle.cs | 2 +- OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs | 6 ++--- .../Widgets/ObserverProductionIconsWidget.cs | 4 ++-- .../ObserverSupportPowerIconsWidget.cs | 4 ++-- .../Widgets/SupportPowerBinWidget.cs | 4 ++-- 52 files changed, 132 insertions(+), 117 deletions(-) diff --git a/OpenRA.Game/Effects/MoveFlash.cs b/OpenRA.Game/Effects/MoveFlash.cs index 3017a150fe..63c70814b5 100644 --- a/OpenRA.Game/Effects/MoveFlash.cs +++ b/OpenRA.Game/Effects/MoveFlash.cs @@ -21,7 +21,7 @@ namespace OpenRA.Effects public MoveFlash(WPos pos, World world) { this.pos = pos; - anim = new Animation("moveflsh"); + anim = new Animation(world, "moveflsh"); anim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this))); } diff --git a/OpenRA.Game/Graphics/Animation.cs b/OpenRA.Game/Graphics/Animation.cs index fc29c228bd..22bdf63967 100644 --- a/OpenRA.Game/Graphics/Animation.cs +++ b/OpenRA.Game/Graphics/Animation.cs @@ -19,7 +19,7 @@ namespace OpenRA.Graphics public bool IsDecoration = false; public Func Paused; - Func facingFunc; + readonly Func facingFunc; int frame = 0; bool backwards = false; @@ -29,27 +29,19 @@ namespace OpenRA.Graphics public string Name { get { return name; } } readonly SequenceProvider sequenceProvider; - static SequenceProvider lastSequenceProvider; - public Animation(string name) - : this(name, () => 0) {} + public Animation(World world, string name) + : this(world, name, () => 0) { } - public Animation(string name, Func facingFunc) + public Animation(World world, string name, Func facingFunc) + : this(world.Map.SequenceProvider, name, facingFunc) { } + + public Animation(SequenceProvider sequenceProvider, string name, Func facingFunc) { + this.sequenceProvider = sequenceProvider; this.name = name.ToLowerInvariant(); this.tickFunc = () => {}; this.facingFunc = facingFunc; - - // TODO: This is wrong, don't use the static - if (Game.orderManager != null && Game.orderManager.world != null && Game.orderManager.world.Map != null) - sequenceProvider = Game.orderManager.world.Map.SequenceProvider; - // HACK: This just makes sure we have a sequence provider in between map changes for delayed actions - // It sucks but it can only be removed when we don't use the statics above but replace them with - // a possible parameter on this constructor. - if (sequenceProvider == null) - sequenceProvider = lastSequenceProvider; - else - lastSequenceProvider = sequenceProvider; } int CurrentFrame { get { return backwards ? CurrentSequence.Start + CurrentSequence.Length - frame - 1 : frame; } } diff --git a/OpenRA.Game/Traits/Render/RenderSimple.cs b/OpenRA.Game/Traits/Render/RenderSimple.cs index 4296960f04..03f38ac302 100755 --- a/OpenRA.Game/Traits/Render/RenderSimple.cs +++ b/OpenRA.Game/Traits/Render/RenderSimple.cs @@ -19,9 +19,9 @@ namespace OpenRA.Traits { public override object Create(ActorInitializer init) { return new RenderSimple(init.self); } - public virtual IEnumerable RenderPreview(ActorInfo ai, PaletteReference pr) + public virtual IEnumerable RenderPreview(World world, ActorInfo ai, PaletteReference pr) { - var anim = new Animation(RenderSimple.GetImage(ai), () => 0); + var anim = new Animation(world, RenderSimple.GetImage(ai), () => 0); anim.PlayRepeating("idle"); return anim.Render(WPos.Zero, WVec.Zero, 0, pr, Scale); @@ -35,7 +35,7 @@ namespace OpenRA.Traits public RenderSimple(Actor self, Func baseFacing) : base(self) { - anims.Add("", new Animation(GetImage(self), baseFacing)); + anims.Add("", new Animation(self.World, GetImage(self), baseFacing)); Info = self.Info.Traits.Get(); } diff --git a/OpenRA.Game/Traits/SelectionDecorations.cs b/OpenRA.Game/Traits/SelectionDecorations.cs index 58a1db9c0f..c8cc65888a 100644 --- a/OpenRA.Game/Traits/SelectionDecorations.cs +++ b/OpenRA.Game/Traits/SelectionDecorations.cs @@ -57,7 +57,7 @@ namespace OpenRA.Traits var group = self.World.Selection.GetControlGroupForActor(self); if (group == null) return; - var pipImages = new Animation("pips"); + var pipImages = new Animation(self.World, "pips"); var pal = wr.Palette(Info.Palette); pipImages.PlayFetchIndex("groups", () => (int)group); pipImages.Tick(); @@ -75,7 +75,7 @@ namespace OpenRA.Traits if (!pipSources.Any()) return; - var pipImages = new Animation("pips"); + var pipImages = new Animation(self.World, "pips"); pipImages.PlayRepeating(pipStrings[0]); var pipSize = pipImages.Image.size.ToInt2(); @@ -115,7 +115,7 @@ namespace OpenRA.Traits if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) return; - var tagImages = new Animation("pips"); + var tagImages = new Animation(self.World, "pips"); var pal = wr.Palette(Info.Palette); var tagxyOffset = new int2(0, 6); var tagBase = wr.Viewport.WorldToViewPx(basePosition); diff --git a/OpenRA.Game/Widgets/SpriteSequenceWidget.cs b/OpenRA.Game/Widgets/SpriteSequenceWidget.cs index e4535bb203..85d43a55a3 100644 --- a/OpenRA.Game/Widgets/SpriteSequenceWidget.cs +++ b/OpenRA.Game/Widgets/SpriteSequenceWidget.cs @@ -36,7 +36,7 @@ namespace OpenRA.Widgets if (Unit != null && Sequence != null) { - var anim = new Animation(Unit, () => Facing); + var anim = new Animation(worldRenderer.world, Unit, () => Facing); anim.PlayFetchIndex(Sequence, () => Frame); GetAnimation = () => anim; } diff --git a/OpenRA.Game/Widgets/SpriteWidget.cs b/OpenRA.Game/Widgets/SpriteWidget.cs index 6e81dc8cbf..5c9a5ab860 100644 --- a/OpenRA.Game/Widgets/SpriteWidget.cs +++ b/OpenRA.Game/Widgets/SpriteWidget.cs @@ -19,7 +19,7 @@ namespace OpenRA.Widgets public Func GetPalette; public Func GetSprite; - readonly WorldRenderer worldRenderer; + protected readonly WorldRenderer worldRenderer; [ObjectCreator.UseCtor] public SpriteWidget(WorldRenderer worldRenderer) diff --git a/OpenRA.Mods.Cnc/Effects/IonCannon.cs b/OpenRA.Mods.Cnc/Effects/IonCannon.cs index b7c66ad98b..17f69b4d04 100644 --- a/OpenRA.Mods.Cnc/Effects/IonCannon.cs +++ b/OpenRA.Mods.Cnc/Effects/IonCannon.cs @@ -18,11 +18,11 @@ namespace OpenRA.Mods.Cnc.Effects { public class IonCannon : IEffect { - Target target; - Animation anim; - Player firedBy; - string palette; - string weapon; + readonly Target target; + readonly Animation anim; + readonly Player firedBy; + readonly string palette; + readonly string weapon; public IonCannon(Player firedBy, string weapon, World world, CPos location, string effect, string palette) { @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Effects this.weapon = weapon; this.palette = palette; target = Target.FromCell(location); - anim = new Animation(effect); + anim = new Animation(world, effect); anim.PlayThen("idle", () => Finish(world)); } diff --git a/OpenRA.Mods.Cnc/RenderGunboat.cs b/OpenRA.Mods.Cnc/RenderGunboat.cs index 55654b921d..be6b082ced 100644 --- a/OpenRA.Mods.Cnc/RenderGunboat.cs +++ b/OpenRA.Mods.Cnc/RenderGunboat.cs @@ -35,19 +35,19 @@ namespace OpenRA.Mods.RA.Render var turret = self.TraitsImplementing() .First(t => t.Name == info.Turret); - left = new Animation(name, () => turret.turretFacing); + left = new Animation(self.World, name, () => turret.turretFacing); left.Play("left"); anims.Add("left", new AnimationWithOffset(left, null, () => facing.Facing > 128, 0)); - right = new Animation(name, () => turret.turretFacing); + right = new Animation(self.World, name, () => turret.turretFacing); right.Play("right"); anims.Add("right", new AnimationWithOffset(right, null, () => facing.Facing <= 128, 0)); - var leftWake = new Animation(name); + var leftWake = new Animation(self.World, name); leftWake.Play("wake-left"); anims.Add("wake-left", new AnimationWithOffset(leftWake, null, () => facing.Facing > 128, -87)); - var rightWake = new Animation(name); + var rightWake = new Animation(self.World, name); rightWake.Play("wake-right"); anims.Add("wake-right", new AnimationWithOffset(rightWake, null, () => facing.Facing <= 128, -87)); diff --git a/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs index 1abb648d68..00d56db16a 100644 --- a/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs @@ -72,9 +72,9 @@ namespace OpenRA.Mods.Cnc.Widgets tooltipContainer = Exts.Lazy(() => Ui.Root.Get(TooltipContainer)); - cantBuild = new Animation("clock"); + cantBuild = new Animation(world, "clock"); cantBuild.PlayFetchIndex("idle", () => 0); - clock = new Animation("clock"); + clock = new Animation(world, "clock"); } public override void Tick() @@ -183,7 +183,7 @@ namespace OpenRA.Mods.Cnc.Widgets var x = i % Columns; var y = i / Columns; var rect = new Rectangle(rb.X + x * 64 + 1, rb.Y + y * 48 + 1, 64, 48); - var icon = new Animation(RenderSimple.GetImage(item)); + var icon = new Animation(World, RenderSimple.GetImage(item)); icon.Play(item.Traits.Get().Icon); var pi = new ProductionIcon() { diff --git a/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs index e5551c989c..3c506bed49 100644 --- a/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs @@ -52,8 +52,8 @@ namespace OpenRA.Mods.Cnc.Widgets tooltipContainer = Exts.Lazy(() => Ui.Root.Get(TooltipContainer)); - icon = new Animation("icon"); - clock = new Animation("clock"); + icon = new Animation(world, "icon"); + clock = new Animation(world, "clock"); } public class SupportPowerIcon diff --git a/OpenRA.Mods.Cnc/WithFire.cs b/OpenRA.Mods.Cnc/WithFire.cs index 3ee0f2dbeb..ec5bc55c16 100644 --- a/OpenRA.Mods.Cnc/WithFire.cs +++ b/OpenRA.Mods.Cnc/WithFire.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc public WithFire(Actor self, WithFireInfo info) { var rs = self.Trait(); - var roof = new Animation(rs.GetImage(self)); + var roof = new Animation(self.World, rs.GetImage(self)); roof.PlayThen("fire-start", () => roof.PlayRepeating("fire-loop")); rs.anims.Add("fire", new AnimationWithOffset(roof, null, null, 1024)); } diff --git a/OpenRA.Mods.Cnc/WithRoof.cs b/OpenRA.Mods.Cnc/WithRoof.cs index 44eb4021da..0cfb42c047 100644 --- a/OpenRA.Mods.Cnc/WithRoof.cs +++ b/OpenRA.Mods.Cnc/WithRoof.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc public WithRoof(Actor self) { var rs = self.Trait(); - var roof = new Animation(rs.GetImage(self), () => self.Trait().Facing); + var roof = new Animation(self.World, rs.GetImage(self), () => self.Trait().Facing); roof.Play("roof"); rs.anims.Add("roof", new AnimationWithOffset(roof, null, null, 1024)); } diff --git a/OpenRA.Mods.D2k/Render/WithBuildingPlacedOverlayInfo.cs b/OpenRA.Mods.D2k/Render/WithBuildingPlacedOverlayInfo.cs index ed4ad54b83..ff26b3e5a8 100644 --- a/OpenRA.Mods.D2k/Render/WithBuildingPlacedOverlayInfo.cs +++ b/OpenRA.Mods.D2k/Render/WithBuildingPlacedOverlayInfo.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Render buildComplete = !self.HasTrait(); // always render instantly for units - overlay = new Animation(rs.GetImage(self)); + overlay = new Animation(self.World, rs.GetImage(self)); overlay.Play(info.Sequence); rs.anims.Add("crane_overlay_{0}".F(info.Sequence), new AnimationWithOffset(overlay, diff --git a/OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs b/OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs index 36f984435b..089290adab 100644 --- a/OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs +++ b/OpenRA.Mods.D2k/Render/WithCrumbleOverlay.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Render if (!init.Contains()) { - var overlay = new Animation(rs.GetImage(init.self)); + var overlay = new Animation(init.world, rs.GetImage(init.self)); overlay.PlayThen(info.Sequence, () => buildComplete = false); rs.anims.Add("make_overlay_{0}".F(info.Sequence), new AnimationWithOffset(overlay, null, () => !buildComplete)); diff --git a/OpenRA.Mods.D2k/Render/WithProductionOverlay.cs b/OpenRA.Mods.D2k/Render/WithProductionOverlay.cs index 8d4351e172..c9847baec6 100644 --- a/OpenRA.Mods.D2k/Render/WithProductionOverlay.cs +++ b/OpenRA.Mods.D2k/Render/WithProductionOverlay.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Render buildComplete = !self.HasTrait(); // always render instantly for units - overlay = new Animation(rs.GetImage(self)); + overlay = new Animation(self.World, rs.GetImage(self)); overlay.PlayRepeating(info.Sequence); rs.anims.Add("production_overlay_{0}".F(info.Sequence), new AnimationWithOffset(overlay, diff --git a/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs b/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs index f59354601b..caf816463d 100644 --- a/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs +++ b/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs @@ -157,7 +157,7 @@ namespace OpenRA.Mods.RA if (barrel != null && a.Info.MuzzleSequence != null) { // Muzzle facing is fixed once the firing starts - var muzzleAnim = new Animation(paxRender[a.Actor].GetImage(a.Actor), () => muzzleFacing); + var muzzleAnim = new Animation(self.World, paxRender[a.Actor].GetImage(a.Actor), () => muzzleFacing); var sequence = a.Info.MuzzleSequence; if (a.Info.MuzzleSplitFacings > 0) diff --git a/OpenRA.Mods.RA/Buildings/Bib.cs b/OpenRA.Mods.RA/Buildings/Bib.cs index 251fd58a3c..979fbaa0ac 100755 --- a/OpenRA.Mods.RA/Buildings/Bib.cs +++ b/OpenRA.Mods.RA/Buildings/Bib.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Buildings for (var i = 0; i < rows * width; i++) { var index = i; - var anim = new Animation(rs.GetImage(self)); + var anim = new Animation(self.World, rs.GetImage(self)); var cellOffset = new CVec(i % width, i / width + bibOffset); // Some mods may define terrain-specific bibs diff --git a/OpenRA.Mods.RA/Burns.cs b/OpenRA.Mods.RA/Burns.cs index bac3079031..e6347ab581 100644 --- a/OpenRA.Mods.RA/Burns.cs +++ b/OpenRA.Mods.RA/Burns.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA { Info = info; - var anim = new Animation("fire", () => 0); + var anim = new Animation(self.World, "fire", () => 0); anim.IsDecoration = true; anim.PlayRepeating(Info.Anim); self.Trait().anims.Add("fire", anim); diff --git a/OpenRA.Mods.RA/Effects/Beacon.cs b/OpenRA.Mods.RA/Effects/Beacon.cs index f5433e3469..ec3d5889ce 100644 --- a/OpenRA.Mods.RA/Effects/Beacon.cs +++ b/OpenRA.Mods.RA/Effects/Beacon.cs @@ -21,8 +21,8 @@ namespace OpenRA.Mods.RA.Effects readonly WPos position; readonly string palettePrefix; readonly string posterPalette; - readonly Animation arrow = new Animation("beacon"); - readonly Animation circles = new Animation("beacon"); + readonly Animation arrow; + readonly Animation circles; readonly Animation poster; static readonly int maxArrowHeight = 512; int arrowHeight = maxArrowHeight; @@ -35,12 +35,15 @@ namespace OpenRA.Mods.RA.Effects this.palettePrefix = palettePrefix; this.posterPalette = posterPalette; + arrow = new Animation(owner.World, "beacon"); + circles = new Animation(owner.World, "beacon"); + arrow.Play("arrow"); circles.Play("circles"); if (posterType != null) { - poster = new Animation("beacon"); + poster = new Animation(owner.World, "beacon"); poster.Play(posterType); } diff --git a/OpenRA.Mods.RA/Effects/Bullet.cs b/OpenRA.Mods.RA/Effects/Bullet.cs index 9c323ecd37..69f767ffa3 100755 --- a/OpenRA.Mods.RA/Effects/Bullet.cs +++ b/OpenRA.Mods.RA/Effects/Bullet.cs @@ -66,6 +66,8 @@ namespace OpenRA.Mods.RA.Effects this.args = args; this.pos = args.Source; + var world = args.SourceActor.World; + if (info.Angle.Length > 1 && info.Speed.Length > 1) { angle = new WAngle(args.SourceActor.World.SharedRandom.Next(info.Angle[0].Angle, info.Angle[1].Angle)); @@ -89,7 +91,7 @@ namespace OpenRA.Mods.RA.Effects if (info.Image != null) { - anim = new Animation(info.Image, GetEffectiveFacing); + anim = new Animation(world, info.Image, GetEffectiveFacing); anim.PlayRepeating("idle"); } diff --git a/OpenRA.Mods.RA/Effects/Corpse.cs b/OpenRA.Mods.RA/Effects/Corpse.cs index 8430f01b70..17f49fd380 100644 --- a/OpenRA.Mods.RA/Effects/Corpse.cs +++ b/OpenRA.Mods.RA/Effects/Corpse.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Effects this.pos = pos; this.cell = pos.ToCPos(); this.paletteName = paletteName; - anim = new Animation(image); + anim = new Animation(world, image); anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this))); } diff --git a/OpenRA.Mods.RA/Effects/CrateEffect.cs b/OpenRA.Mods.RA/Effects/CrateEffect.cs index fe20e2769a..3c2b78b7c1 100644 --- a/OpenRA.Mods.RA/Effects/CrateEffect.cs +++ b/OpenRA.Mods.RA/Effects/CrateEffect.cs @@ -17,13 +17,15 @@ namespace OpenRA.Mods.RA.Effects class CrateEffect : IEffect { readonly string palette; - Actor a; - Animation anim = new Animation("crate-effects"); + readonly Actor a; + readonly Animation anim; public CrateEffect(Actor a, string seq, string palette) { this.a = a; this.palette = palette; + + anim = new Animation(a.World, "crate-effects"); anim.PlayThen(seq, () => a.World.AddFrameEndTask(w => w.Remove(this))); } diff --git a/OpenRA.Mods.RA/Effects/Explosion.cs b/OpenRA.Mods.RA/Effects/Explosion.cs index f8764bd74a..2c4cd3900c 100644 --- a/OpenRA.Mods.RA/Effects/Explosion.cs +++ b/OpenRA.Mods.RA/Effects/Explosion.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Effects this.pos = pos; this.cell = pos.ToCPos(); this.palette = palette; - anim = new Animation("explosion"); + anim = new Animation(world, "explosion"); anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this))); } diff --git a/OpenRA.Mods.RA/Effects/GpsDot.cs b/OpenRA.Mods.RA/Effects/GpsDot.cs index 9b5691d6f8..345dfc2a6e 100644 --- a/OpenRA.Mods.RA/Effects/GpsDot.cs +++ b/OpenRA.Mods.RA/Effects/GpsDot.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Effects { this.self = self; this.info = info; - anim = new Animation("gpsdot"); + anim = new Animation(self.World, "gpsdot"); anim.PlayRepeating(info.String); self.World.AddFrameEndTask(w => w.Add(this)); diff --git a/OpenRA.Mods.RA/Effects/GpsSatellite.cs b/OpenRA.Mods.RA/Effects/GpsSatellite.cs index 382c5845ee..69b11fcf71 100644 --- a/OpenRA.Mods.RA/Effects/GpsSatellite.cs +++ b/OpenRA.Mods.RA/Effects/GpsSatellite.cs @@ -16,27 +16,29 @@ namespace OpenRA.Mods.RA.Effects { class GpsSatellite : IEffect { - WPos Pos; - Animation Anim = new Animation("sputnik"); + WPos pos; + readonly Animation anim; - public GpsSatellite(WPos pos) + public GpsSatellite(World world, WPos pos) { - Pos = pos; - Anim.PlayRepeating("idle"); + this.pos = pos; + + anim = new Animation(world, "sputnik"); + anim.PlayRepeating("idle"); } public void Tick( World world ) { - Anim.Tick(); - Pos += new WVec(0, 0, 427); + anim.Tick(); + pos += new WVec(0, 0, 427); - if (Pos.Z > Pos.Y) + if (pos.Z > pos.Y) world.AddFrameEndTask(w => w.Remove(this)); } public IEnumerable Render(WorldRenderer wr) { - return Anim.Render(Pos, wr.Palette("effect")); + return anim.Render(pos, wr.Palette("effect")); } } } diff --git a/OpenRA.Mods.RA/Effects/GravityBomb.cs b/OpenRA.Mods.RA/Effects/GravityBomb.cs index 9a129e847d..9d52e1258d 100644 --- a/OpenRA.Mods.RA/Effects/GravityBomb.cs +++ b/OpenRA.Mods.RA/Effects/GravityBomb.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Effects pos = args.Source; velocity = new WVec(WRange.Zero, WRange.Zero, -info.Velocity); - anim = new Animation(info.Image); + anim = new Animation(args.SourceActor.World, info.Image); if (anim.HasSequence("open")) anim.PlayThen("open", () => anim.PlayRepeating("idle")); else diff --git a/OpenRA.Mods.RA/Effects/LaserZap.cs b/OpenRA.Mods.RA/Effects/LaserZap.cs index c164892c03..a9e23c9e81 100644 --- a/OpenRA.Mods.RA/Effects/LaserZap.cs +++ b/OpenRA.Mods.RA/Effects/LaserZap.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Effects this.target = args.PassiveTarget; if (info.HitAnim != null) - this.hitanim = new Animation(info.HitAnim); + this.hitanim = new Animation(args.SourceActor.World, info.HitAnim); } public void Tick(World world) diff --git a/OpenRA.Mods.RA/Effects/Missile.cs b/OpenRA.Mods.RA/Effects/Missile.cs index eac4983278..22f27442c3 100755 --- a/OpenRA.Mods.RA/Effects/Missile.cs +++ b/OpenRA.Mods.RA/Effects/Missile.cs @@ -88,7 +88,7 @@ namespace OpenRA.Mods.RA.Effects if (info.Image != null) { - anim = new Animation(info.Image, () => facing); + anim = new Animation(args.SourceActor.World, info.Image, () => facing); anim.PlayRepeating("idle"); } diff --git a/OpenRA.Mods.RA/Effects/NukeLaunch.cs b/OpenRA.Mods.RA/Effects/NukeLaunch.cs index e94e3cb8ae..577eefa0ce 100755 --- a/OpenRA.Mods.RA/Effects/NukeLaunch.cs +++ b/OpenRA.Mods.RA/Effects/NukeLaunch.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA.Effects descendSource = targetPos + offset; descendTarget = targetPos; - anim = new Animation(weapon); + anim = new Animation(firedBy.World, weapon); anim.PlayRepeating("up"); pos = launchPos; diff --git a/OpenRA.Mods.RA/Effects/Parachute.cs b/OpenRA.Mods.RA/Effects/Parachute.cs index b9904fc2e6..2726d92725 100644 --- a/OpenRA.Mods.RA/Effects/Parachute.cs +++ b/OpenRA.Mods.RA/Effects/Parachute.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Effects this.cargo = cargo; var pai = cargo.Info.Traits.GetOrDefault(); - paraAnim = new Animation(pai != null ? pai.ParachuteSprite : "parach"); + paraAnim = new Animation(cargo.World, pai != null ? pai.ParachuteSprite : "parach"); paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle")); if (pai != null) diff --git a/OpenRA.Mods.RA/Effects/PowerdownIndicator.cs b/OpenRA.Mods.RA/Effects/PowerdownIndicator.cs index e8522ce76b..d3b5eb5d9a 100644 --- a/OpenRA.Mods.RA/Effects/PowerdownIndicator.cs +++ b/OpenRA.Mods.RA/Effects/PowerdownIndicator.cs @@ -18,12 +18,15 @@ namespace OpenRA.Mods.RA.Effects { class PowerdownIndicator : IEffect { - Actor a; - Animation anim = new Animation("poweroff"); + readonly Actor a; + readonly Animation anim; public PowerdownIndicator(Actor a) { - this.a = a; anim.PlayRepeating("offline"); + this.a = a; + + anim = new Animation(a.World, "poweroff"); + anim.PlayRepeating("offline"); } public void Tick(World world) diff --git a/OpenRA.Mods.RA/Effects/RallyPoint.cs b/OpenRA.Mods.RA/Effects/RallyPoint.cs index 247d215891..67e95de691 100755 --- a/OpenRA.Mods.RA/Effects/RallyPoint.cs +++ b/OpenRA.Mods.RA/Effects/RallyPoint.cs @@ -21,14 +21,19 @@ namespace OpenRA.Mods.RA.Effects readonly Actor building; readonly RA.RallyPoint rp; readonly string palettePrefix; - public Animation flag = new Animation("rallypoint"); - public Animation circles = new Animation("rallypoint"); + readonly Animation flag; + readonly Animation circles; public RallyPoint(Actor building, string palettePrefix) { this.building = building; - rp = building.Trait(); this.palettePrefix = palettePrefix; + + rp = building.Trait(); + + flag = new Animation(building.World, "rallypoint"); + circles = new Animation(building.World, "rallypoint"); + flag.PlayRepeating("flag"); circles.Play("circles"); } diff --git a/OpenRA.Mods.RA/Effects/Rank.cs b/OpenRA.Mods.RA/Effects/Rank.cs index 8262a12b65..3f2208332a 100644 --- a/OpenRA.Mods.RA/Effects/Rank.cs +++ b/OpenRA.Mods.RA/Effects/Rank.cs @@ -17,16 +17,17 @@ namespace OpenRA.Mods.RA.Effects { class Rank : IEffect { - Actor self; - Animation anim = new Animation("rank"); + readonly Actor self; + readonly Animation anim; readonly string paletteName; public Rank(Actor self, string paletteName) { this.self = self; this.paletteName = paletteName; - var xp = self.Trait(); + var xp = self.Trait(); + anim = new Animation(self.World, "rank"); anim.PlayRepeating("rank"); anim.PlayFetchIndex("rank", () => xp.Level == 0 ? 0 : xp.Level - 1); } diff --git a/OpenRA.Mods.RA/Effects/RepairIndicator.cs b/OpenRA.Mods.RA/Effects/RepairIndicator.cs index f8e7a352b7..7c239be907 100755 --- a/OpenRA.Mods.RA/Effects/RepairIndicator.cs +++ b/OpenRA.Mods.RA/Effects/RepairIndicator.cs @@ -18,18 +18,20 @@ namespace OpenRA.Mods.RA.Effects { class RepairIndicator : IEffect { - Actor building; - Player player; - string palettePrefix; - Animation anim = new Animation("allyrepair"); - RepairableBuilding rb; + readonly Actor building; + readonly Player player; + readonly string palettePrefix; + readonly Animation anim; + readonly RepairableBuilding rb; public RepairIndicator(Actor building, string palettePrefix, Player player) { this.building = building; this.player = player; this.palettePrefix = palettePrefix; + rb = building.Trait(); + anim = new Animation(building.World, "allyrepair"); anim.PlayRepeating("repair"); } diff --git a/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs b/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs index 17287e33f8..885ca79423 100644 --- a/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs +++ b/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs @@ -17,11 +17,13 @@ namespace OpenRA.Mods.RA.Effects class SatelliteLaunch : IEffect { int frame = 0; - Animation doors = new Animation("atek"); - WPos pos; + readonly Animation doors; + readonly WPos pos; public SatelliteLaunch(Actor a) { + doors = new Animation(a.World, "atek"); + doors.PlayThen("active", () => a.World.AddFrameEndTask(w => w.Remove(this))); @@ -33,7 +35,7 @@ namespace OpenRA.Mods.RA.Effects doors.Tick(); if (++frame == 19) - world.AddFrameEndTask(w => w.Add(new GpsSatellite(pos))); + world.AddFrameEndTask(w => w.Add(new GpsSatellite(world, pos))); } public IEnumerable Render(WorldRenderer wr) diff --git a/OpenRA.Mods.RA/Effects/Smoke.cs b/OpenRA.Mods.RA/Effects/Smoke.cs index f781a59ea0..857ef58c6a 100644 --- a/OpenRA.Mods.RA/Effects/Smoke.cs +++ b/OpenRA.Mods.RA/Effects/Smoke.cs @@ -26,7 +26,8 @@ namespace OpenRA.Mods.RA.Effects this.world = world; this.pos = pos; this.cell = pos.ToCPos(); - anim = new Animation(trail); + + anim = new Animation(world, trail); anim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this))); } diff --git a/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs index 5ccac71774..5fd40ee8f9 100644 --- a/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs @@ -100,7 +100,7 @@ namespace OpenRA.Mods.RA.Orders var palette = rbi.Palette ?? (Producer.Owner != null ? rbi.PlayerPalette + Producer.Owner.InternalName : null); - preview = rbi.RenderPreview(rules.Actors[Building], wr.Palette(palette)); + preview = rbi.RenderPreview(world, rules.Actors[Building], wr.Palette(palette)); } initialized = true; diff --git a/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs b/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs index 0bfb4eef63..42b54fe82b 100755 --- a/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs @@ -21,15 +21,15 @@ namespace OpenRA.Mods.RA.Render public override object Create(ActorInitializer init) { return new RenderBuildingWarFactory( init, this ); } /* get around unverifiability */ - IEnumerable BaseBuildingPreview(ActorInfo building, PaletteReference pr) + IEnumerable BaseBuildingPreview(World world, ActorInfo building, PaletteReference pr) { - return base.RenderPreview(building, pr); + return base.RenderPreview(world, building, pr); } - public override IEnumerable RenderPreview(ActorInfo building, PaletteReference pr) + public override IEnumerable RenderPreview(World world, ActorInfo building, PaletteReference pr) { - var p = BaseBuildingPreview(building, pr); - var anim = new Animation(RenderSprites.GetImage(building), () => 0); + var p = BaseBuildingPreview(world, building, pr); + var anim = new Animation(world, RenderSprites.GetImage(building), () => 0); anim.PlayRepeating("idle-top"); return p.Concat(anim.Render(WPos.Zero, WVec.Zero, 0, pr, Scale)); @@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Render public RenderBuildingWarFactory(ActorInitializer init, RenderBuildingInfo info) : base(init, info) { - roof = new Animation(GetImage(init.self)); + roof = new Animation(init.world, GetImage(init.self)); var bi = init.self.Info.Traits.Get(); // Additional 512 units move from center -> top of cell diff --git a/OpenRA.Mods.RA/Render/RenderHarvester.cs b/OpenRA.Mods.RA/Render/RenderHarvester.cs index eadc30f0c8..ba4cec2b98 100644 --- a/OpenRA.Mods.RA/Render/RenderHarvester.cs +++ b/OpenRA.Mods.RA/Render/RenderHarvester.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Render // HACK: Force images to be loaded up-front foreach (var image in info.ImagesByFullness) - new Animation(image); + new Animation(self.World, image); } public override void Tick(Actor self) diff --git a/OpenRA.Mods.RA/Render/WithCrateBody.cs b/OpenRA.Mods.RA/Render/WithCrateBody.cs index 662fdc46c1..10703fb2d4 100755 --- a/OpenRA.Mods.RA/Render/WithCrateBody.cs +++ b/OpenRA.Mods.RA/Render/WithCrateBody.cs @@ -25,15 +25,15 @@ namespace OpenRA.Mods.RA.Render class WithCrateBody : INotifyParachuteLanded { - Actor self; - Animation anim; + readonly Actor self; + readonly Animation anim; public WithCrateBody(Actor self, WithCrateBodyInfo info) { this.self = self; var rs = self.Trait(); var images = info.XmasImages.Any() && DateTime.Today.Month == 12 ? info.XmasImages : info.Images; - anim = new Animation(images.Random(Game.CosmeticRandom)); + anim = new Animation(self.World, images.Random(Game.CosmeticRandom)); anim.Play("idle"); rs.anims.Add("", anim); } diff --git a/OpenRA.Mods.RA/Render/WithHarvestAnimation.cs b/OpenRA.Mods.RA/Render/WithHarvestAnimation.cs index 1d23b82789..ca6edd92cc 100644 --- a/OpenRA.Mods.RA/Render/WithHarvestAnimation.cs +++ b/OpenRA.Mods.RA/Render/WithHarvestAnimation.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Render var rs = self.Trait(); var body = self.Trait(); - anim = new Animation(rs.GetImage(self), RenderSimple.MakeFacingFunc(self)); + anim = new Animation(self.World, rs.GetImage(self), RenderSimple.MakeFacingFunc(self)); anim.Play(info.Sequence); rs.anims.Add("harvest_{0}".F(info.Sequence), new AnimationWithOffset(anim, () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), diff --git a/OpenRA.Mods.RA/Render/WithIdleOverlay.cs b/OpenRA.Mods.RA/Render/WithIdleOverlay.cs index a37c091ad3..47a3313028 100644 --- a/OpenRA.Mods.RA/Render/WithIdleOverlay.cs +++ b/OpenRA.Mods.RA/Render/WithIdleOverlay.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Render var disabled = self.TraitsImplementing(); buildComplete = !self.HasTrait(); // always render instantly for units - overlay = new Animation(rs.GetImage(self)); + overlay = new Animation(self.World, rs.GetImage(self)); overlay.PlayRepeating(info.Sequence); rs.anims.Add("idle_overlay_{0}".F(info.Sequence), new AnimationWithOffset(overlay, diff --git a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs index 57f0f7f77c..61f9252c00 100644 --- a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs +++ b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Render getFacing = turreted != null ? () => turreted.turretFacing : facing != null ? (Func)(() => facing.Facing) : () => 0; - var muzzleFlash = new Animation(render.GetImage(self), getFacing); + var muzzleFlash = new Animation(self.World, render.GetImage(self), getFacing); visible.Add(barrel, false); anims.Add(barrel, new AnimationWithOffset(muzzleFlash, diff --git a/OpenRA.Mods.RA/Render/WithResources.cs b/OpenRA.Mods.RA/Render/WithResources.cs index 26c68c6908..bc202da05c 100755 --- a/OpenRA.Mods.RA/Render/WithResources.cs +++ b/OpenRA.Mods.RA/Render/WithResources.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Render rs = self.Trait(); playerResources = self.Owner.PlayerActor.Trait(); - anim = new Animation(rs.GetImage(self)); + anim = new Animation(self.World, rs.GetImage(self)); anim.PlayFetchIndex(info.Sequence, () => playerResources.OreCapacity != 0 ? ((10 * anim.CurrentSequence.Length - 1) * playerResources.Ore) / (10 * playerResources.OreCapacity) diff --git a/OpenRA.Mods.RA/Render/WithRotor.cs b/OpenRA.Mods.RA/Render/WithRotor.cs index bc24df4adf..764df91589 100755 --- a/OpenRA.Mods.RA/Render/WithRotor.cs +++ b/OpenRA.Mods.RA/Render/WithRotor.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Render var body = self.Trait(); movement = self.Trait(); - rotorAnim = new Animation(rs.GetImage(self)); + rotorAnim = new Animation(self.World, rs.GetImage(self)); rotorAnim.PlayRepeating(info.Sequence); rs.anims.Add(info.Id, new AnimationWithOffset(rotorAnim, () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), diff --git a/OpenRA.Mods.RA/Render/WithSmoke.cs b/OpenRA.Mods.RA/Render/WithSmoke.cs index d4dc2915a5..0b82ed3da3 100644 --- a/OpenRA.Mods.RA/Render/WithSmoke.cs +++ b/OpenRA.Mods.RA/Render/WithSmoke.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Render { var rs = self.Trait(); - anim = new Animation("smoke_m"); + anim = new Animation(self.World, "smoke_m"); rs.anims.Add("smoke", new AnimationWithOffset(anim, null, () => !isSmoking)); } diff --git a/OpenRA.Mods.RA/Render/WithTurret.cs b/OpenRA.Mods.RA/Render/WithTurret.cs index 5e2283a611..7ca2be9efa 100755 --- a/OpenRA.Mods.RA/Render/WithTurret.cs +++ b/OpenRA.Mods.RA/Render/WithTurret.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Render arms = self.TraitsImplementing() .Where(w => w.Info.Turret == info.Turret); - anim = new Animation(rs.GetImage(self), () => t.turretFacing); + anim = new Animation(self.World, rs.GetImage(self), () => t.turretFacing); anim.Play(info.Sequence); rs.anims.Add("turret_{0}".F(info.Turret), new AnimationWithOffset( anim, () => TurretOffset(self), null, () => false, p => ZOffsetFromCenter(self, p, 1))); diff --git a/OpenRA.Mods.RA/ThrowsParticle.cs b/OpenRA.Mods.RA/ThrowsParticle.cs index e2cfac4ec0..b472b4daa0 100644 --- a/OpenRA.Mods.RA/ThrowsParticle.cs +++ b/OpenRA.Mods.RA/ThrowsParticle.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA // Facing rotation rotation = WRange.FromPDF(Game.CosmeticRandom, 2).Range * info.ROT / 1024; - var anim = new Animation(rs.GetImage(self), () => (int)facing); + var anim = new Animation(init.world, rs.GetImage(self), () => (int)facing); anim.PlayRepeating(info.Anim); rs.anims.Add(info.Anim, new AnimationWithOffset(anim, () => pos, null)); } diff --git a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs index c82a2153b4..9cf2e66309 100644 --- a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs +++ b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs @@ -63,9 +63,9 @@ namespace OpenRA.Mods.RA.Widgets this.world = world; this.worldRenderer = worldRenderer; - cantBuild = new Animation("clock"); + cantBuild = new Animation(world, "clock"); cantBuild.PlayFetchIndex("idle", () => 0); - clock = new Animation("clock"); + clock = new Animation(world, "clock"); VisibleQueues = new List(); CurrentQueue = null; } @@ -231,7 +231,7 @@ namespace OpenRA.Mods.RA.Widgets { var rect = new RectangleF(origin.X + x * IconWidth, origin.Y + IconHeight * y, IconWidth, IconHeight); var drawPos = new float2(rect.Location); - var icon = new Animation(RenderSimple.GetImage(item)); + var icon = new Animation(world, RenderSimple.GetImage(item)); icon.Play(item.Traits.Get().Icon); WidgetUtils.DrawSHPCentered(icon.Image, drawPos + iconOffset, worldRenderer); diff --git a/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs b/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs index 028b40b044..3a7c502674 100644 --- a/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs +++ b/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA.Widgets { if (!clocks.ContainsKey(queue.Trait)) { - clocks.Add(queue.Trait, new Animation("clock")); + clocks.Add(queue.Trait, new Animation(world, "clock")); } } @@ -75,7 +75,7 @@ namespace OpenRA.Mods.RA.Widgets if (actor == null) continue; - var icon = new Animation(RenderSimple.GetImage(actor)); + var icon = new Animation(world, RenderSimple.GetImage(actor)); icon.Play(actor.Traits.Get().Icon); var location = new float2(RenderBounds.Location) + new float2(queue.i * (IconWidth + IconSpacing), 0); WidgetUtils.DrawSHPCentered(icon.Image, location + 0.5f * iconSize, worldRenderer, 0.5f); diff --git a/OpenRA.Mods.RA/Widgets/ObserverSupportPowerIconsWidget.cs b/OpenRA.Mods.RA/Widgets/ObserverSupportPowerIconsWidget.cs index 408510763f..3d929ce46a 100644 --- a/OpenRA.Mods.RA/Widgets/ObserverSupportPowerIconsWidget.cs +++ b/OpenRA.Mods.RA/Widgets/ObserverSupportPowerIconsWidget.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Widgets this.world = world; this.worldRenderer = worldRenderer; clocks = new Dictionary(); - icon = new Animation("icon"); + icon = new Animation(world, "icon"); } protected ObserverSupportPowerIconsWidget(ObserverSupportPowerIconsWidget other) @@ -62,7 +62,7 @@ namespace OpenRA.Mods.RA.Widgets { if (!clocks.ContainsKey(power.a.Key)) { - clocks.Add(power.a.Key, new Animation("clock")); + clocks.Add(power.a.Key, new Animation(world, "clock")); } } diff --git a/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs b/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs index 93b844e953..6155b6606d 100755 --- a/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs @@ -44,8 +44,8 @@ namespace OpenRA.Mods.RA.Widgets { base.Initialize(args); - icon = new Animation("icon"); - clock = new Animation("clock"); + icon = new Animation(world, "icon"); + clock = new Animation(world, "clock"); } public override Rectangle EventBounds