Preserve original brightness when remapping player colors.
This commit is contained in:
@@ -29,9 +29,6 @@ namespace OpenRA.Traits
|
||||
[Desc("Remap these indices to player colors.")]
|
||||
public readonly int[] RemapIndex = { };
|
||||
|
||||
[Desc("Luminosity range to span.")]
|
||||
public readonly float Ramp = 0.05f;
|
||||
|
||||
[Desc("Allow palette modifiers to change the palette.")]
|
||||
public readonly bool AllowModifiers = true;
|
||||
|
||||
@@ -49,7 +46,9 @@ namespace OpenRA.Traits
|
||||
|
||||
public void LoadPlayerPalettes(WorldRenderer wr, string playerName, Color color, bool replaceExisting)
|
||||
{
|
||||
var remap = new PlayerColorRemap(info.RemapIndex, color, info.Ramp);
|
||||
color.ToAhsv(out _, out var h, out var s, out _);
|
||||
|
||||
var remap = new PlayerColorRemap(info.RemapIndex, h, s);
|
||||
var pal = new ImmutablePalette(wr.Palette(info.BasePalette).Palette, remap);
|
||||
wr.AddPalette(info.BaseName + playerName, pal, info.AllowModifiers, replaceExisting);
|
||||
}
|
||||
|
||||
@@ -31,9 +31,6 @@ namespace OpenRA.Traits
|
||||
[Desc("The fixed color to remap.")]
|
||||
public readonly Color Color;
|
||||
|
||||
[Desc("Luminosity range to span.")]
|
||||
public readonly float Ramp = 0.05f;
|
||||
|
||||
[Desc("Allow palette modifiers to change the palette.")]
|
||||
public readonly bool AllowModifiers = true;
|
||||
|
||||
@@ -51,7 +48,9 @@ namespace OpenRA.Traits
|
||||
|
||||
public void LoadPalettes(WorldRenderer wr)
|
||||
{
|
||||
var remap = new PlayerColorRemap(info.RemapIndex, info.Color, info.Ramp);
|
||||
info.Color.ToAhsv(out _, out var h, out var s, out _);
|
||||
|
||||
var remap = new PlayerColorRemap(info.RemapIndex, h, s);
|
||||
wr.AddPalette(info.Name, new ImmutablePalette(wr.Palette(info.Base).Palette, remap), info.AllowModifiers);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user