Fix palette issues with Oil Derricks and walls (fixes #501).

This commit is contained in:
Paul Chote
2011-01-29 13:21:55 +13:00
parent 9b17bfe697
commit 4b538fd2fe
7 changed files with 56 additions and 28 deletions

View File

@@ -15,20 +15,9 @@ using OpenRA.FileFormats;
namespace OpenRA.Mods.RA
{
class WaterPaletteRotationInfo : ITraitInfo
{
public readonly bool CncMode = false;
public object Create(ActorInitializer init) { return new WaterPaletteRotation(CncMode); }
}
class WaterPaletteRotationInfo : TraitInfo<WaterPaletteRotation> {}
class WaterPaletteRotation : ITick, IPaletteModifier
{
bool cncmode = false;
public WaterPaletteRotation(bool cncmode)
{
this.cncmode = cncmode;
}
float t = 0;
public void Tick(Actor self)
{
@@ -46,12 +35,7 @@ namespace OpenRA.Mods.RA
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]);
}
pal.Value.SetColor(0x60 + (rotate + i) % 7, copy[0x60 + i]);
}
}
}