shroud: it works. perf is pretty ugly, and there are a lot of small bugs.
This commit is contained in:
9
OpenRa.FileFormats/IPaletteRemap.cs
Normal file
9
OpenRa.FileFormats/IPaletteRemap.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
namespace OpenRa.FileFormats
|
||||
{
|
||||
public interface IPaletteRemap
|
||||
{
|
||||
Color GetRemappedColor(Color original, int index);
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@
|
||||
<Compile Include="Format80.cs" />
|
||||
<Compile Include="IniFile.cs" />
|
||||
<Compile Include="IniWriter.cs" />
|
||||
<Compile Include="IPaletteRemap.cs" />
|
||||
<Compile Include="Map.cs" />
|
||||
<Compile Include="PackageEntry.cs" />
|
||||
<Compile Include="Package.cs" />
|
||||
@@ -62,6 +63,7 @@
|
||||
<Compile Include="PaletteRemap.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ShpReader.cs" />
|
||||
<Compile Include="ShroudPaletteRemap.cs" />
|
||||
<Compile Include="Terrain.cs" />
|
||||
<Compile Include="TileReference.cs" />
|
||||
<Compile Include="TileSet.cs" />
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRa.FileFormats
|
||||
colors[4] = Color.FromArgb(140, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Palette(Palette p, PaletteRemap r)
|
||||
public Palette(Palette p, IPaletteRemap r)
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
colors.Add(r.GetRemappedColor(p.GetColor(i), i));
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.IO;
|
||||
|
||||
namespace OpenRa.FileFormats
|
||||
{
|
||||
public class PaletteRemap
|
||||
public class PaletteRemap : IPaletteRemap
|
||||
{
|
||||
int offset;
|
||||
List<Color> remapColors = new List<Color>();
|
||||
|
||||
32
OpenRa.FileFormats/ShroudPaletteRemap.cs
Normal file
32
OpenRa.FileFormats/ShroudPaletteRemap.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRa.FileFormats
|
||||
{
|
||||
public class ShroudPaletteRemap : IPaletteRemap
|
||||
{
|
||||
public Color GetRemappedColor(Color original, int index)
|
||||
{
|
||||
// false-color version for debug
|
||||
|
||||
//return new[] {
|
||||
// Color.Orange, Color.Green,
|
||||
// Color.Blue, Color.Yellow,
|
||||
// Color.Black,
|
||||
// Color.Red,
|
||||
// Color.Purple,
|
||||
// Color.Cyan}[index % 8];
|
||||
|
||||
return new[] {
|
||||
Color.Transparent, Color.Green,
|
||||
Color.Blue, Color.Yellow,
|
||||
Color.Black,
|
||||
Color.FromArgb(192,0,0,0),
|
||||
Color.FromArgb(128,0,0,0),
|
||||
Color.FromArgb(64,0,0,0)}[index % 8];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user