diff --git a/OpenRA.Game/Effects/MoveFlash.cs b/OpenRA.Game/Effects/MoveFlash.cs new file mode 100644 index 0000000000..762ce5106c --- /dev/null +++ b/OpenRA.Game/Effects/MoveFlash.cs @@ -0,0 +1,41 @@ +#region Copyright & License Information +/* + * Copyright 2007-2013 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. For more information, + * see COPYING. + */ +#endregion + +using System.Collections.Generic; +using OpenRA.Effects; +using OpenRA.FileFormats; +using OpenRA.Graphics; +using OpenRA.Traits; + +namespace OpenRA.Effects +{ + public class MoveFlash : IEffect + { + Animation anim; + WPos pos; + + public MoveFlash(WPos pos, World world) + { + this.pos = pos; + anim = new Animation("moveflsh"); + anim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this))); + } + + public void Tick(World world) + { + anim.Tick(); + } + + public IEnumerable Render(WorldRenderer wr) + { + return anim.Render(pos, WVec.Zero, 0, wr.Palette("moveflash"), 1f / wr.Viewport.Zoom); + } + } +} \ No newline at end of file diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index e679a99d7b..8cfbecab7c 100755 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -94,7 +94,12 @@ namespace OpenRA.Graphics Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1; } - public CPos ViewToWorld(int2 view) + public WPos ViewToWorldPosition(int2 view) + { + return worldRenderer.Position(ViewToWorldPx(view)); + } + + public CPos ViewToWorldCellPosition(int2 view) { return worldRenderer.Position(ViewToWorldPx(view)).ToCPos(); } diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 108f137b14..4830545e52 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -236,6 +236,7 @@ + diff --git a/OpenRA.Game/Widgets/ViewportControllerWidget.cs b/OpenRA.Game/Widgets/ViewportControllerWidget.cs index b5ad7128ed..fe7224ee4e 100644 --- a/OpenRA.Game/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Game/Widgets/ViewportControllerWidget.cs @@ -95,7 +95,7 @@ namespace OpenRA.Widgets public void UpdateMouseover() { TooltipType = WorldTooltipType.None; - var cell = worldRenderer.Viewport.ViewToWorld(Viewport.LastMousePos); + var cell = worldRenderer.Viewport.ViewToWorldCellPosition(Viewport.LastMousePos); if (!world.Map.IsInMap(cell)) return; diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 27fb1e0b60..d4b51db045 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Linq; +using OpenRA.Effects; using OpenRA.FileFormats; using OpenRA.Graphics; using OpenRA.Orders; @@ -140,6 +141,8 @@ namespace OpenRA.Widgets orders.Do(o => world.IssueOrder(o)); world.PlayVoiceForOrders(orders); + if (orders.Where(o => o.OrderString != null && o.OrderString.EndsWith("Move")).Any()) + world.Add(new MoveFlash(worldRenderer.Viewport.ViewToWorldPosition(mi.Location), world)); } public override string GetCursor(int2 screenPos) diff --git a/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs old mode 100755 new mode 100644 index d3d32b61c5..9722f597c1 --- a/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs @@ -71,7 +71,7 @@ namespace OpenRA.Mods.RA.Orders public IEnumerable Render(WorldRenderer wr, World world) { yield break; } public void RenderAfterWorld(WorldRenderer wr, World world) { - var position = wr.Viewport.ViewToWorld(Viewport.LastMousePos); + var position = wr.Viewport.ViewToWorldCellPosition(Viewport.LastMousePos); var topLeft = position - FootprintUtils.AdjustForBuildingSize(BuildingInfo); var actorInfo = Rules.Info[Building]; diff --git a/OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs b/OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs old mode 100755 new mode 100644 index b01e915fcd..8aa2f8f952 --- a/OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs @@ -138,7 +138,7 @@ namespace OpenRA.Mods.RA public void RenderAfterWorld(WorldRenderer wr, World world) { - var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos); + var xy = wr.Viewport.ViewToWorldCellPosition(Viewport.LastMousePos); var targetUnits = power.UnitsInRange(xy); foreach (var unit in targetUnits) if (manager.self.Owner.Shroud.IsTargetable(unit) || manager.self.Owner.HasFogVisibility()) @@ -147,7 +147,7 @@ namespace OpenRA.Mods.RA public IEnumerable Render(WorldRenderer wr, World world) { - var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos); + var xy = wr.Viewport.ViewToWorldCellPosition(Viewport.LastMousePos); var tiles = world.FindTilesInCircle(xy, range); var pal = wr.Palette("terrain"); foreach (var t in tiles) @@ -226,7 +226,7 @@ namespace OpenRA.Mods.RA public IEnumerable Render(WorldRenderer wr, World world) { - var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos); + var xy = wr.Viewport.ViewToWorldCellPosition(Viewport.LastMousePos); var pal = wr.Palette("terrain"); // Source tiles diff --git a/OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs b/OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs old mode 100755 new mode 100644 index abfaeafc06..74930b698c --- a/OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs @@ -90,14 +90,14 @@ namespace OpenRA.Mods.RA public void RenderAfterWorld(WorldRenderer wr, World world) { - var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos); + var xy = wr.Viewport.ViewToWorldCellPosition(Viewport.LastMousePos); foreach (var unit in power.UnitsInRange(xy)) wr.DrawSelectionBox(unit, Color.Red); } public IEnumerable Render(WorldRenderer wr, World world) { - var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos); + var xy = wr.Viewport.ViewToWorldCellPosition(Viewport.LastMousePos); var pal = wr.Palette("terrain"); foreach (var t in world.FindTilesInCircle(xy, range)) yield return new SpriteRenderable(tile, t.CenterPosition, WVec.Zero, -511, pal, 1f, true); diff --git a/mods/cnc/rules/system.yaml b/mods/cnc/rules/system.yaml index 32013bfabb..fafbc8dba8 100644 --- a/mods/cnc/rules/system.yaml +++ b/mods/cnc/rules/system.yaml @@ -257,6 +257,12 @@ World: G: 255 B: 255 A: 128 + PaletteFromRGBA@moveflash: + Name: moveflash + R: 255 + G: 255 + B: 255 + A: 64 PaletteFromRGBA@disabled: Name: disabled R: 0 diff --git a/mods/cnc/sequences/misc.yaml b/mods/cnc/sequences/misc.yaml index 7328ce4543..d6a88dc522 100644 --- a/mods/cnc/sequences/misc.yaml +++ b/mods/cnc/sequences/misc.yaml @@ -304,4 +304,10 @@ icon: ioncannon: ionicnh Start: 0 abomb: atomicnh - Start: 0 \ No newline at end of file + Start: 0 + +moveflsh: + idle: + Start: 0 + Length: * + Tick: 80 \ No newline at end of file diff --git a/mods/d2k/rules/system.yaml b/mods/d2k/rules/system.yaml index 0e0e9a991d..a8ed891718 100644 --- a/mods/d2k/rules/system.yaml +++ b/mods/d2k/rules/system.yaml @@ -417,6 +417,11 @@ World: G: 0 B: 0 A: 128 + PaletteFromR8@moveflash: + Name: moveflash + Filename: DATA.R8 + Offset: 2572352 + A: 64 PaletteFromRGBA@disabled: Name: disabled R: 0 diff --git a/mods/d2k/sequences/misc.yaml b/mods/d2k/sequences/misc.yaml index 8391921077..50e14f4796 100644 --- a/mods/d2k/sequences/misc.yaml +++ b/mods/d2k/sequences/misc.yaml @@ -297,4 +297,11 @@ spicebloom: idle: DATA.R8 Start: 109 ZOffset: -511 - Offset: -16,-16 \ No newline at end of file + Offset: -16,-16 + +moveflsh: + idle: DATA.R8 + Start: 3621 + Length: 5 + Tick: 80 + BlendMode: Subtractive \ No newline at end of file diff --git a/mods/ra/rules/system.yaml b/mods/ra/rules/system.yaml index 286ea3d788..93a45a4dc0 100644 --- a/mods/ra/rules/system.yaml +++ b/mods/ra/rules/system.yaml @@ -587,6 +587,12 @@ World: G: 255 B: 255 A: 128 + PaletteFromRGBA@moveflash: + Name: moveflash + R: 255 + G: 255 + B: 255 + A: 64 PaletteFromRGBA@invuln: Name: invuln R: 128 diff --git a/mods/ra/sequences/misc.yaml b/mods/ra/sequences/misc.yaml index f1f5b2fd95..045c9ab0c5 100644 --- a/mods/ra/sequences/misc.yaml +++ b/mods/ra/sequences/misc.yaml @@ -162,6 +162,7 @@ moveflsh: idle: Start: 0 Length: * + Tick: 80 select: repair: diff --git a/mods/ts/rules/system.yaml b/mods/ts/rules/system.yaml index 0625b3ce46..0cc7f79d87 100644 --- a/mods/ts/rules/system.yaml +++ b/mods/ts/rules/system.yaml @@ -91,6 +91,12 @@ World: G: 0 B: 0 A: 128 + PaletteFromRGBA@moveflash: + Name: moveflash + R: 255 + G: 255 + B: 255 + A: 64 PaletteFromRGBA@disabled: Name: disabled R: 0 diff --git a/mods/ts/sequences/misc.yaml b/mods/ts/sequences/misc.yaml index 6e3ad05f23..434d185da1 100644 --- a/mods/ts/sequences/misc.yaml +++ b/mods/ts/sequences/misc.yaml @@ -242,4 +242,10 @@ crystal4: torpedo: idle: Start: 0 - Length: * \ No newline at end of file + Length: * + +moveflsh: + idle: + Start: 0 + Length: * + Tick: 80 \ No newline at end of file