fix RA Desert palette rotation regressions

This commit is contained in:
Matthias Mailänder
2013-03-23 13:18:15 +01:00
parent aa6f12f0a1
commit 3e63751960
2 changed files with 19 additions and 1 deletions

View File

@@ -15,7 +15,13 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class LightPaletteRotatorInfo : TraitInfo<LightPaletteRotator> { }
class LightPaletteRotatorInfo : ITraitInfo
{
public readonly string[] ExcludePalettes = {};
public object Create(ActorInitializer init) { return new LightPaletteRotator(this); }
}
class LightPaletteRotator : ITick, IPaletteModifier
{
float t = 0;
@@ -24,10 +30,20 @@ namespace OpenRA.Mods.RA
t += .5f;
}
readonly LightPaletteRotatorInfo info;
public LightPaletteRotator(LightPaletteRotatorInfo info)
{
this.info = info;
}
public void AdjustPalette(Dictionary<string,Palette> palettes)
{
foreach (var pal in palettes)
{
if (info.ExcludePalettes.Contains(pal.Key))
continue;
var rotate = (int)t % 18;
if (rotate > 9)
rotate = 18 - rotate;