Fix palettes and all palettemods. Remap palettes broken.
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Traits;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
@@ -33,18 +35,24 @@ namespace OpenRA.Mods.RA
|
||||
t += .25f;
|
||||
}
|
||||
|
||||
public void AdjustPalette(Bitmap b)
|
||||
public void AdjustPalette(Dictionary<string,Palette> palettes)
|
||||
{
|
||||
var rotate = (int)t % 7;
|
||||
using (var bitmapCopy = new Bitmap(b))
|
||||
for (int j = 0; j < b.Height; j++)
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
if (cncmode)
|
||||
b.SetPixel(0x20 + (rotate + i) % 7, j, bitmapCopy.GetPixel(0x20 + i, j));
|
||||
else
|
||||
b.SetPixel(0x60 + (rotate + i) % 7, j, bitmapCopy.GetPixel(0x60 + i, j));
|
||||
}
|
||||
var excludePalettes = new List<string>(){"cursor", "chrome", "colorpicker"};
|
||||
foreach (var pal in palettes)
|
||||
{
|
||||
if (excludePalettes.Contains(pal.Key))
|
||||
continue;
|
||||
|
||||
var copy = (uint[])pal.Value.Values.Clone();
|
||||
var rotate = (int)t % 7;
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
if (cncmode)
|
||||
pal.Value.SetColor(0x20 + (rotate + i) % 7, copy[0x20 + i]);
|
||||
else
|
||||
pal.Value.SetColor(0x60 + (rotate + i) % 7, copy[0x60 + i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user