Replace ColorRamp with HSLColor everywhere.
Fixes: * Nuclear-purple color exploit. * #3247. * Removes a bunch of unnecessary color conversions every frame. Caveats: * The ramp range is now defined on the palette, so ramps can no longer be set per-player (may impact maps which define custom colors). * It's no longer possible to perfectly recreate the original WW color ramps (I doubt we care). * The old ColorRamp setting isn't migrated, so players will lose their color settings.
This commit is contained in:
@@ -22,9 +22,10 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
{
|
||||
public readonly string Palette = "colorpicker";
|
||||
public readonly int[] RemapIndices = {};
|
||||
public ColorRamp Ramp;
|
||||
public readonly float Ramp = 0.05f;
|
||||
public HSLColor Color;
|
||||
|
||||
ColorRamp cachedRamp;
|
||||
HSLColor cachedColor;
|
||||
WorldRenderer worldRenderer;
|
||||
Palette preview;
|
||||
|
||||
@@ -43,11 +44,11 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
|
||||
public override void Tick()
|
||||
{
|
||||
if (cachedRamp == Ramp)
|
||||
if (cachedColor == Color)
|
||||
return;
|
||||
|
||||
preview.ApplyRemap(new PlayerColorRemap(RemapIndices, Ramp));
|
||||
cachedRamp = Ramp;
|
||||
preview.ApplyRemap(new PlayerColorRemap(RemapIndices, Color, Ramp));
|
||||
cachedColor = Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user