Merge pull request #11348 from reaperrr/clean-effects
Remove redundant Effects
This commit is contained in:
@@ -227,7 +227,6 @@
|
|||||||
<Compile Include="Graphics\IGraphicsDevice.cs" />
|
<Compile Include="Graphics\IGraphicsDevice.cs" />
|
||||||
<Compile Include="Sound\Sound.cs" />
|
<Compile Include="Sound\Sound.cs" />
|
||||||
<Compile Include="Sound\SoundDevice.cs" />
|
<Compile Include="Sound\SoundDevice.cs" />
|
||||||
<Compile Include="Effects\SpriteEffect.cs" />
|
|
||||||
<Compile Include="Graphics\SelectionBarsRenderable.cs" />
|
<Compile Include="Graphics\SelectionBarsRenderable.cs" />
|
||||||
<Compile Include="Graphics\TargetLineRenderable.cs" />
|
<Compile Include="Graphics\TargetLineRenderable.cs" />
|
||||||
<Compile Include="Graphics\UISpriteRenderable.cs" />
|
<Compile Include="Graphics\UISpriteRenderable.cs" />
|
||||||
@@ -241,7 +240,6 @@
|
|||||||
<Compile Include="Widgets\WidgetLoader.cs" />
|
<Compile Include="Widgets\WidgetLoader.cs" />
|
||||||
<Compile Include="Widgets\ChromeMetrics.cs" />
|
<Compile Include="Widgets\ChromeMetrics.cs" />
|
||||||
<Compile Include="Widgets\WidgetUtils.cs" />
|
<Compile Include="Widgets\WidgetUtils.cs" />
|
||||||
<Compile Include="Widgets\WorldInteractionControllerWidget.cs" />
|
|
||||||
<Compile Include="Graphics\PaletteReference.cs" />
|
<Compile Include="Graphics\PaletteReference.cs" />
|
||||||
<Compile Include="Graphics\TerrainSpriteLayer.cs" />
|
<Compile Include="Graphics\TerrainSpriteLayer.cs" />
|
||||||
<Compile Include="Map\ProjectedCellRegion.cs" />
|
<Compile Include="Map\ProjectedCellRegion.cs" />
|
||||||
|
|||||||
@@ -182,7 +182,8 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
if (!string.IsNullOrEmpty(info.Trail) && --smokeTicks < 0)
|
if (!string.IsNullOrEmpty(info.Trail) && --smokeTicks < 0)
|
||||||
{
|
{
|
||||||
var delayedPos = WPos.LerpQuadratic(args.Source, target, angle, ticks - info.TrailDelay, length);
|
var delayedPos = WPos.LerpQuadratic(args.Source, target, angle, ticks - info.TrailDelay, length);
|
||||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, delayedPos, GetEffectiveFacing(), info.Trail, trailPalette, info.TrailSequences.Random(world.SharedRandom))));
|
world.AddFrameEndTask(w => w.Add(new SpriteEffect(delayedPos, w, info.Trail, info.TrailSequences.Random(world.SharedRandom),
|
||||||
|
trailPalette, false, false, GetEffectiveFacing())));
|
||||||
smokeTicks = info.TrailInterval;
|
smokeTicks = info.TrailInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenRA.Effects;
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Effects
|
|
||||||
{
|
|
||||||
public class Corpse : IEffect
|
|
||||||
{
|
|
||||||
readonly World world;
|
|
||||||
readonly WPos pos;
|
|
||||||
readonly string paletteName;
|
|
||||||
readonly Animation anim;
|
|
||||||
|
|
||||||
public Corpse(World world, WPos pos, string image, string sequence, string paletteName)
|
|
||||||
{
|
|
||||||
this.world = world;
|
|
||||||
this.pos = pos;
|
|
||||||
this.paletteName = paletteName;
|
|
||||||
anim = new Animation(world, image);
|
|
||||||
anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Tick(World world) { anim.Tick(); }
|
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
|
||||||
{
|
|
||||||
if (world.FogObscures(pos))
|
|
||||||
return SpriteRenderable.None;
|
|
||||||
|
|
||||||
return anim.Render(pos, wr.Palette(paletteName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenRA.Effects;
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Effects
|
|
||||||
{
|
|
||||||
public class Explosion : IEffect
|
|
||||||
{
|
|
||||||
readonly World world;
|
|
||||||
readonly string palette;
|
|
||||||
readonly Animation anim;
|
|
||||||
WPos pos;
|
|
||||||
|
|
||||||
public Explosion(World world, WPos pos, string image, string sequence, string palette)
|
|
||||||
{
|
|
||||||
this.world = world;
|
|
||||||
this.pos = pos;
|
|
||||||
this.palette = palette;
|
|
||||||
anim = new Animation(world, image);
|
|
||||||
anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Tick(World world) { anim.Tick(); }
|
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
|
||||||
{
|
|
||||||
if (world.FogObscures(pos))
|
|
||||||
return SpriteRenderable.None;
|
|
||||||
|
|
||||||
return anim.Render(pos, wr.Palette(palette));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -820,7 +820,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
// Create the smoke trail effect
|
// Create the smoke trail effect
|
||||||
if (!string.IsNullOrEmpty(info.TrailImage) && --ticksToNextSmoke < 0 && (state != States.Freefall || info.TrailWhenDeactivated))
|
if (!string.IsNullOrEmpty(info.TrailImage) && --ticksToNextSmoke < 0 && (state != States.Freefall || info.TrailWhenDeactivated))
|
||||||
{
|
{
|
||||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, pos - 3 * move / 2, renderFacing, info.TrailImage, trailPalette, info.TrailSequence)));
|
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos - 3 * move / 2, w, info.TrailImage, info.TrailSequence, trailPalette, false, false, renderFacing)));
|
||||||
ticksToNextSmoke = info.TrailInterval;
|
ticksToNextSmoke = info.TrailInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenRA.Effects;
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Effects
|
|
||||||
{
|
|
||||||
public class Smoke : IEffect
|
|
||||||
{
|
|
||||||
readonly World world;
|
|
||||||
readonly WPos pos;
|
|
||||||
readonly Animation anim;
|
|
||||||
readonly string palette;
|
|
||||||
|
|
||||||
public Smoke(World world, WPos pos, string trail, string palette, string sequence)
|
|
||||||
: this(world, pos, 0, trail, palette, sequence) { }
|
|
||||||
|
|
||||||
public Smoke(World world, WPos pos, int facing, string trail, string palette, string sequence)
|
|
||||||
{
|
|
||||||
this.world = world;
|
|
||||||
this.pos = pos;
|
|
||||||
this.palette = palette;
|
|
||||||
|
|
||||||
anim = new Animation(world, trail, () => facing);
|
|
||||||
anim.PlayThen(sequence,
|
|
||||||
() => world.AddFrameEndTask(w => w.Remove(this)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Tick(World world) { anim.Tick(); }
|
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
|
||||||
{
|
|
||||||
if (world.FogObscures(pos))
|
|
||||||
return SpriteRenderable.None;
|
|
||||||
|
|
||||||
return anim.Render(pos, wr.Palette(palette));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,9 +10,10 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using OpenRA.Effects;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
namespace OpenRA.Effects
|
namespace OpenRA.Mods.Common.Effects
|
||||||
{
|
{
|
||||||
public class SpriteEffect : IEffect
|
public class SpriteEffect : IEffect
|
||||||
{
|
{
|
||||||
@@ -150,9 +150,7 @@
|
|||||||
<Compile Include="Effects\Bullet.cs" />
|
<Compile Include="Effects\Bullet.cs" />
|
||||||
<Compile Include="Effects\Contrail.cs" />
|
<Compile Include="Effects\Contrail.cs" />
|
||||||
<Compile Include="Effects\ContrailFader.cs" />
|
<Compile Include="Effects\ContrailFader.cs" />
|
||||||
<Compile Include="Effects\Corpse.cs" />
|
|
||||||
<Compile Include="Effects\CrateEffect.cs" />
|
<Compile Include="Effects\CrateEffect.cs" />
|
||||||
<Compile Include="Effects\Explosion.cs" />
|
|
||||||
<Compile Include="Effects\FloatingText.cs" />
|
<Compile Include="Effects\FloatingText.cs" />
|
||||||
<Compile Include="Effects\GravityBomb.cs" />
|
<Compile Include="Effects\GravityBomb.cs" />
|
||||||
<Compile Include="Effects\LaserZap.cs" />
|
<Compile Include="Effects\LaserZap.cs" />
|
||||||
@@ -162,7 +160,7 @@
|
|||||||
<Compile Include="Effects\PowerdownIndicator.cs" />
|
<Compile Include="Effects\PowerdownIndicator.cs" />
|
||||||
<Compile Include="Effects\RallyPointIndicator.cs" />
|
<Compile Include="Effects\RallyPointIndicator.cs" />
|
||||||
<Compile Include="Effects\RepairIndicator.cs" />
|
<Compile Include="Effects\RepairIndicator.cs" />
|
||||||
<Compile Include="Effects\Smoke.cs" />
|
<Compile Include="Effects\SpriteEffect.cs" />
|
||||||
<Compile Include="Commands\ChatCommands.cs" />
|
<Compile Include="Commands\ChatCommands.cs" />
|
||||||
<Compile Include="Commands\DevCommands.cs" />
|
<Compile Include="Commands\DevCommands.cs" />
|
||||||
<Compile Include="Commands\HelpCommand.cs" />
|
<Compile Include="Commands\HelpCommand.cs" />
|
||||||
@@ -646,6 +644,7 @@
|
|||||||
<Compile Include="Widgets\SupportPowerTimerWidget.cs" />
|
<Compile Include="Widgets\SupportPowerTimerWidget.cs" />
|
||||||
<Compile Include="Widgets\TerrainTemplatePreviewWidget.cs" />
|
<Compile Include="Widgets\TerrainTemplatePreviewWidget.cs" />
|
||||||
<Compile Include="Widgets\WorldCommandWidget.cs" />
|
<Compile Include="Widgets\WorldCommandWidget.cs" />
|
||||||
|
<Compile Include="Widgets\WorldInteractionControllerWidget.cs" />
|
||||||
<Compile Include="SpriteLoaders\ShpTDLoader.cs" />
|
<Compile Include="SpriteLoaders\ShpTDLoader.cs" />
|
||||||
<Compile Include="SpriteLoaders\ShpTSLoader.cs" />
|
<Compile Include="SpriteLoaders\ShpTSLoader.cs" />
|
||||||
<Compile Include="SpriteLoaders\TmpRALoader.cs" />
|
<Compile Include="SpriteLoaders\TmpRALoader.cs" />
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var sequence = terrain.IsWater ? info.WaterCorpseSequence : info.GroundCorpseSequence;
|
var sequence = terrain.IsWater ? info.WaterCorpseSequence : info.GroundCorpseSequence;
|
||||||
var palette = terrain.IsWater ? info.WaterCorpsePalette : info.GroundCorpsePalette;
|
var palette = terrain.IsWater ? info.WaterCorpsePalette : info.GroundCorpsePalette;
|
||||||
if (sequence != null && palette != null)
|
if (sequence != null && palette != null)
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Explosion(w, self.OccupiesSpace.CenterPosition, info.Image, sequence, palette)));
|
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(self.OccupiesSpace.CenterPosition, w, info.Image, sequence, palette)));
|
||||||
|
|
||||||
self.Kill(self);
|
self.Kill(self);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRA.Effects;
|
using OpenRA.Mods.Common.Effects;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits.Render
|
namespace OpenRA.Mods.Common.Traits.Render
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
void SpawnExplosions(World world, IEnumerable<CPos> cells)
|
void SpawnExplosions(World world, IEnumerable<CPos> cells)
|
||||||
{
|
{
|
||||||
foreach (var c in cells)
|
foreach (var c in cells)
|
||||||
world.AddFrameEndTask(w => w.Add(new Explosion(w, w.Map.CenterOfCell(c), info.Image, info.Sequences.Random(w.SharedRandom), info.Palette)));
|
world.AddFrameEndTask(w => w.Add(new SpriteEffect(w.Map.CenterOfCell(c), w, info.Image, info.Sequences.Random(w.SharedRandom), info.Palette)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
public void SpawnDeathAnimation(Actor self, WPos pos, string image, string sequence, string palette)
|
public void SpawnDeathAnimation(Actor self, WPos pos, string image, string sequence, string palette)
|
||||||
{
|
{
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Corpse(w, pos, image, sequence, palette)));
|
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, image, sequence, palette)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyCrushed.OnCrush(Actor self, Actor crusher, HashSet<string> crushClasses)
|
void INotifyCrushed.OnCrush(Actor self, Actor crusher, HashSet<string> crushClasses)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
||||||
var pos = position + body.LocalToWorld(offset);
|
var pos = position + body.LocalToWorld(offset);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Smoke(w, pos, getFacing, info.Sprite, info.Palette, info.Sequence)));
|
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, info.Sprite, info.Sequence, info.Palette, false, false, getFacing)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ticks = info.Interval;
|
ticks = info.Interval;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using OpenRA.Effects;
|
|
||||||
using OpenRA.Mods.Common.Activities;
|
using OpenRA.Mods.Common.Activities;
|
||||||
|
using OpenRA.Mods.Common.Effects;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public void AddSmudge(CPos loc)
|
public void AddSmudge(CPos loc)
|
||||||
{
|
{
|
||||||
if (Game.CosmeticRandom.Next(0, 100) <= Info.SmokePercentage)
|
if (Game.CosmeticRandom.Next(0, 100) <= Info.SmokePercentage)
|
||||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, world.Map.CenterOfCell(loc), Info.SmokeType, Info.SmokePalette, Info.SmokeSequence)));
|
world.AddFrameEndTask(w => w.Add(new SpriteEffect(world.Map.CenterOfCell(loc), w, Info.SmokeType, Info.SmokeSequence, Info.SmokePalette)));
|
||||||
|
|
||||||
if (!dirty.ContainsKey(loc) && !tiles.ContainsKey(loc))
|
if (!dirty.ContainsKey(loc) && !tiles.ContainsKey(loc))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Warheads
|
|||||||
|
|
||||||
var explosion = Explosions.RandomOrDefault(Game.CosmeticRandom);
|
var explosion = Explosions.RandomOrDefault(Game.CosmeticRandom);
|
||||||
if (Image != null && explosion != null)
|
if (Image != null && explosion != null)
|
||||||
world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Image, explosion, palette)));
|
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, Image, explosion, palette)));
|
||||||
|
|
||||||
var impactSound = ImpactSounds.RandomOrDefault(Game.CosmeticRandom);
|
var impactSound = ImpactSounds.RandomOrDefault(Game.CosmeticRandom);
|
||||||
if (impactSound != null)
|
if (impactSound != null)
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.Common.Effects;
|
||||||
using OpenRA.Orders;
|
using OpenRA.Orders;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
{
|
{
|
||||||
public class WorldInteractionControllerWidget : Widget
|
public class WorldInteractionControllerWidget : Widget
|
||||||
{
|
{
|
||||||
Reference in New Issue
Block a user