strip all the allocation out of WaterPaletteRotation too (saves ~25M/min)
This commit is contained in:
@@ -6,12 +6,12 @@
|
|||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see COPYING.
|
* see COPYING.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Drawing;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenRA.FileFormats;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
@@ -22,20 +22,26 @@ namespace OpenRA.Mods.RA
|
|||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
t += .25f;
|
t += .25f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string[] excludePalettes = { "cursor", "chrome", "colorpicker" };
|
||||||
|
static uint[] temp = new uint[7];
|
||||||
|
|
||||||
public void AdjustPalette(Dictionary<string,Palette> palettes)
|
public void AdjustPalette(Dictionary<string,Palette> palettes)
|
||||||
{
|
{
|
||||||
var excludePalettes = new List<string>(){"cursor", "chrome", "colorpicker"};
|
|
||||||
foreach (var pal in palettes)
|
foreach (var pal in palettes)
|
||||||
{
|
{
|
||||||
if (excludePalettes.Contains(pal.Key))
|
if (excludePalettes.Contains(pal.Key))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var copy = (uint[])pal.Value.Values.Clone();
|
var colors = pal.Value.Values;
|
||||||
var rotate = (int)t % 7;
|
var rotate = (int)t % 7;
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
pal.Value.SetColor(0x60 + (rotate + i) % 7, copy[0x60 + i]);
|
for (var i = 0; i < 7; i++)
|
||||||
|
temp[(rotate + i) % 7] = colors[0x60 + i];
|
||||||
|
|
||||||
|
for (var i = 0; i < 7; i++)
|
||||||
|
pal.Value.SetColor(0x60 + i, temp[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user