diff --git a/OpenRa.FileFormats/OpenRa.FileFormats.csproj b/OpenRa.FileFormats/OpenRa.FileFormats.csproj index 9ac47d6448..7bd764613a 100644 --- a/OpenRa.FileFormats/OpenRa.FileFormats.csproj +++ b/OpenRa.FileFormats/OpenRa.FileFormats.csproj @@ -36,6 +36,7 @@ + @@ -47,6 +48,7 @@ + diff --git a/OpenRa.FileFormats/Palette.cs b/OpenRa.FileFormats/Palette.cs index 3976b1b67d..f366157d5c 100644 --- a/OpenRa.FileFormats/Palette.cs +++ b/OpenRa.FileFormats/Palette.cs @@ -32,5 +32,11 @@ namespace OpenRa.FileFormats colors[3] = Color.FromArgb(178, 0, 0, 0); colors[4] = Color.FromArgb(140, 0, 0, 0); } + + public Palette(Palette p, PaletteRemap r) + { + for (int i = 0; i < 256; i++) + colors.Add(r.GetRemappedColor(p.GetColor(i), i)); + } } } diff --git a/OpenRa.FileFormats/PaletteRemap.cs b/OpenRa.FileFormats/PaletteRemap.cs new file mode 100644 index 0000000000..f4d3b57c41 --- /dev/null +++ b/OpenRa.FileFormats/PaletteRemap.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Drawing; + +namespace OpenRa.FileFormats +{ + public class PaletteRemap + { + List remapColors = new List(); + + public PaletteRemap(Stream s) + { + using (BinaryReader reader = new BinaryReader(s)) + { + for (int i = 0; i < 16; i++) + { + byte r = reader.ReadByte(); + byte g = reader.ReadByte(); + byte b = reader.ReadByte(); + + remapColors.Add(Color.FromArgb(r, g, b)); + } + } + } + + public Color GetRemappedColor(Color original, int index) + { + if (index < 80 || index >= 96) + return original; + + return remapColors[index - 80]; + } + } +} diff --git a/ShpViewer/ShpViewForm.cs b/ShpViewer/ShpViewForm.cs index 23ea225fc0..b62c7ef541 100644 --- a/ShpViewer/ShpViewForm.cs +++ b/ShpViewer/ShpViewForm.cs @@ -26,6 +26,9 @@ namespace ShpViewer Palette pal = new Palette( File.OpenRead( "../../../temperat.pal" ) ); + PaletteRemap remap = new PaletteRemap(File.OpenRead("../../../blue.rem")); + pal = new Palette(pal, remap); + foreach( ImageHeader h in shpReader ) bitmaps.Add( BitmapBuilder.FromBytes( h.Image, shpReader.Width, shpReader.Height, pal ) ); } diff --git a/atek.shp b/atek.shp new file mode 100644 index 0000000000..ed251e2cda Binary files /dev/null and b/atek.shp differ diff --git a/blue.rem b/blue.rem new file mode 100644 index 0000000000..9589fb20cb --- /dev/null +++ b/blue.rem @@ -0,0 +1 @@ +궾ޡʍ}iuYiDU8H}0@u(8m ,a,U D4 \ No newline at end of file diff --git a/fact.shp b/fact.shp new file mode 100644 index 0000000000..c867fd27ed Binary files /dev/null and b/fact.shp differ diff --git a/gold.rem b/gold.rem new file mode 100644 index 0000000000..e35abd6942 --- /dev/null +++ b/gold.rem @@ -0,0 +1 @@ +yq־iƲaYULu@q8me8YU,UL$HD 844,(  \ No newline at end of file diff --git a/gray.rem b/gray.rem new file mode 100644 index 0000000000..e397db43d6 --- /dev/null +++ b/gray.rem @@ -0,0 +1 @@ +κ}qqeqYP]H@P<4P<4<,(<,(,, \ No newline at end of file diff --git a/green.rem b/green.rem new file mode 100644 index 0000000000..b66e9436e3 --- /dev/null +++ b/green.rem @@ -0,0 +1 @@ +慲}umyei]YuLLe<