split remap classes
This commit is contained in:
@@ -60,10 +60,11 @@
|
||||
<Compile Include="PackageEntry.cs" />
|
||||
<Compile Include="Package.cs" />
|
||||
<Compile Include="Palette.cs" />
|
||||
<Compile Include="PaletteRemap.cs" />
|
||||
<Compile Include="PlayerColorRemap.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ShpReader.cs" />
|
||||
<Compile Include="ShroudPaletteRemap.cs" />
|
||||
<Compile Include="SingleColorRemap.cs" />
|
||||
<Compile Include="Terrain.cs" />
|
||||
<Compile Include="TileReference.cs" />
|
||||
<Compile Include="TileSet.cs" />
|
||||
|
||||
@@ -4,13 +4,12 @@ using System.IO;
|
||||
|
||||
namespace OpenRa.FileFormats
|
||||
{
|
||||
public class PaletteRemap : IPaletteRemap
|
||||
public class PlayerColorRemap : IPaletteRemap
|
||||
{
|
||||
int offset;
|
||||
List<Color> remapColors = new List<Color>();
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
18
OpenRa.FileFormats/SingleColorRemap.cs
Normal file
18
OpenRa.FileFormats/SingleColorRemap.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user