diff --git a/OpenRa.FileFormats/OpenRa.FileFormats.csproj b/OpenRa.FileFormats/OpenRa.FileFormats.csproj
index 26f9983855..0016cbc237 100644
--- a/OpenRa.FileFormats/OpenRa.FileFormats.csproj
+++ b/OpenRa.FileFormats/OpenRa.FileFormats.csproj
@@ -60,10 +60,11 @@
-
+
+
diff --git a/OpenRa.FileFormats/PaletteRemap.cs b/OpenRa.FileFormats/PlayerColorRemap.cs
similarity index 53%
rename from OpenRa.FileFormats/PaletteRemap.cs
rename to OpenRa.FileFormats/PlayerColorRemap.cs
index 635c0d5653..164b06f4de 100644
--- a/OpenRa.FileFormats/PaletteRemap.cs
+++ b/OpenRa.FileFormats/PlayerColorRemap.cs
@@ -4,13 +4,12 @@ using System.IO;
namespace OpenRa.FileFormats
{
- public class PaletteRemap : IPaletteRemap
+ public class PlayerColorRemap : IPaletteRemap
{
int offset;
List remapColors = new List();
- Color shadowColor;
- public PaletteRemap(Stream s)
+ public PlayerColorRemap(Stream s)
{
using (BinaryReader reader = new BinaryReader(s))
{
@@ -27,22 +26,12 @@ namespace OpenRa.FileFormats
offset = 80;
}
- public PaletteRemap( Color shadowColor )
- {
- this.shadowColor = shadowColor;
- }
-
public Color GetRemappedColor(Color original, int index)
{
- if (remapColors.Count > 0)
- {
- if (index < offset || index >= offset + remapColors.Count)
- return original;
+ if (index < offset || index >= offset + remapColors.Count)
+ return original;
- return remapColors[index - offset];
- }
-
- return original.A > 0 ? shadowColor : original;
+ return remapColors[index - offset];
}
}
}
diff --git a/OpenRa.FileFormats/SingleColorRemap.cs b/OpenRa.FileFormats/SingleColorRemap.cs
new file mode 100644
index 0000000000..149779d96b
--- /dev/null
+++ b/OpenRa.FileFormats/SingleColorRemap.cs
@@ -0,0 +1,18 @@
+using System.Drawing;
+
+namespace OpenRa.FileFormats
+{
+ public class SingleColorRemap : IPaletteRemap
+ {
+ Color c;
+ public SingleColorRemap(Color c)
+ {
+ this.c = c;
+ }
+
+ public Color GetRemappedColor(Color original, int index)
+ {
+ return original.A > 0 ? c : original;
+ }
+ }
+}
diff --git a/OpenRa.Game/Effects/FlashTarget.cs b/OpenRa.Game/Effects/FlashTarget.cs
new file mode 100644
index 0000000000..21e0fe8c85
--- /dev/null
+++ b/OpenRa.Game/Effects/FlashTarget.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OpenRa.Game.Traits;
+using OpenRa.Game.Graphics;
+
+namespace OpenRa.Game.Effects
+{
+ class FlashTarget : IEffect
+ {
+ Actor target;
+ int remainingTicks = 4;
+
+ public FlashTarget(Actor target)
+ {
+ this.target = target;
+ foreach (var e in Game.world.Effects.OfType().Where(a => a.target == target).ToArray())
+ Game.world.Remove(e);
+ }
+
+ public void Tick()
+ {
+ if (--remainingTicks == 0)
+ Game.world.AddFrameEndTask(w => w.Remove(this));
+ }
+
+ public IEnumerable Render()
+ {
+ if (remainingTicks % 2 == 0)
+ foreach (var r in target.Render())
+ yield return r.WithPalette(PaletteType.Highlight);
+ }
+ }
+}
diff --git a/OpenRa.Game/Graphics/HardwarePalette.cs b/OpenRa.Game/Graphics/HardwarePalette.cs
index 2092291dd0..09132cc5be 100644
--- a/OpenRa.Game/Graphics/HardwarePalette.cs
+++ b/OpenRa.Game/Graphics/HardwarePalette.cs
@@ -6,7 +6,7 @@ namespace OpenRa.Game.Graphics
public enum PaletteType
{
Gold, Blue, Red, Orange, Teal, Salmon, Green, Gray,
- Shadow, Invuln, Chrome, Shroud,
+ Shadow, Invuln, Chrome, Shroud, Highlight,
};
class HardwarePalette : Sheet
@@ -21,12 +21,13 @@ namespace OpenRa.Game.Graphics
AddPalette(pal);
foreach (string remap in new string[] { "blue", "red", "orange", "teal", "salmon", "green", "gray" })
- AddPalette(new Palette(pal, new PaletteRemap(FileSystem.Open(remap + ".rem"))));
+ AddPalette(new Palette(pal, new PlayerColorRemap(FileSystem.Open(remap + ".rem"))));
- AddPalette(new Palette(pal, new PaletteRemap(Color.FromArgb(140, 0, 0, 0))));
+ AddPalette(new Palette(pal, new SingleColorRemap(Color.FromArgb(140, 0, 0, 0))));
AddPalette(pal); // iron curtain. todo: remap!
AddPalette(pal); // chrome (it's like gold, but we're not going to hax it in palettemods)
AddPalette(new Palette(pal, new ShroudPaletteRemap()));
+ AddPalette(new Palette(pal, new SingleColorRemap(Color.FromArgb(128, 255, 255, 255))));
}
int AddPalette(Palette p)
diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj
index 939be98dbc..112d4802ea 100644
--- a/OpenRa.Game/OpenRa.Game.csproj
+++ b/OpenRa.Game/OpenRa.Game.csproj
@@ -82,6 +82,7 @@
+
diff --git a/OpenRa.Game/Traits/AttackBase.cs b/OpenRa.Game/Traits/AttackBase.cs
index ebb76cbb6d..d3b713aa66 100644
--- a/OpenRa.Game/Traits/AttackBase.cs
+++ b/OpenRa.Game/Traits/AttackBase.cs
@@ -155,6 +155,9 @@ namespace OpenRa.Game.Traits
{
self.CancelActivity();
QueueAttack(self, order);
+
+ if (self.Owner == Game.LocalPlayer)
+ Game.world.AddFrameEndTask(w => w.Add(new FlashTarget(order.TargetActor)));
}
else
target = null;