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/Graphics/HardwarePalette.cs b/OpenRa.Game/Graphics/HardwarePalette.cs
index 2092291dd0..84e898f15f 100644
--- a/OpenRa.Game/Graphics/HardwarePalette.cs
+++ b/OpenRa.Game/Graphics/HardwarePalette.cs
@@ -21,9 +21,9 @@ 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()));