diff --git a/OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs b/OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs deleted file mode 100644 index 6309af7bc0..0000000000 --- a/OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs +++ /dev/null @@ -1,37 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using System.Collections.Generic; -using OpenRA.FileFormats; -using OpenRA.Traits; - -namespace OpenRA.Mods.Cnc -{ - class CncWaterPaletteRotationInfo : TraitInfo {} - - class CncWaterPaletteRotation : ITick, IPaletteModifier - { - float t = 0; - - public void Tick(Actor self) { t += .25f; } - - public void AdjustPalette(Dictionary palettes) - { - // Only modify the terrain palette - var pal = palettes["terrain"]; - - var copy = (uint[])pal.Values.Clone(); - var rotate = (int)t % 7; - - for (int i = 0; i < 7; i++) - pal.SetColor(0x20 + (rotate + i) % 7, copy[0x20 + i]); - } - } -} diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index f32f60a411..91ee396a04 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -55,7 +55,6 @@ - diff --git a/OpenRA.Mods.RA/WaterPaletteRotation.cs b/OpenRA.Mods.RA/WaterPaletteRotation.cs index dbe6ae9b8b..b19233e777 100644 --- a/OpenRA.Mods.RA/WaterPaletteRotation.cs +++ b/OpenRA.Mods.RA/WaterPaletteRotation.cs @@ -15,18 +15,24 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - class WaterPaletteRotationInfo : TraitInfo {} + class WaterPaletteRotationInfo : ITraitInfo + { + public readonly int Base = 0x60; + + public object Create(ActorInitializer init) { return new WaterPaletteRotation(this); } + } class WaterPaletteRotation : ITick, IPaletteModifier { float t = 0; - public void Tick(Actor self) - { - t += .25f; - } + readonly WaterPaletteRotationInfo info; + + public WaterPaletteRotation(WaterPaletteRotationInfo info) { this.info = info; } + + public void Tick(Actor self) { t += .25f; } static string[] excludePalettes = { "cursor", "chrome", "colorpicker" }; - static uint[] temp = new uint[7]; + static uint[] temp = new uint[7]; /* allocating this on the fly actually hurts our profile */ public void AdjustPalette(Dictionary palettes) { @@ -39,10 +45,10 @@ namespace OpenRA.Mods.RA var rotate = (int)t % 7; for (var i = 0; i < 7; i++) - temp[(rotate + i) % 7] = colors[0x60 + i]; + temp[(rotate + i) % 7] = colors[info.Base + i]; for (var i = 0; i < 7; i++) - pal.Value.SetColor(0x60 + i, temp[i]); + pal.Value.SetColor(info.Base + i, temp[i]); } } } diff --git a/mods/cnc/rules/system.yaml b/mods/cnc/rules/system.yaml index 542b08d410..4cc8326695 100644 --- a/mods/cnc/rules/system.yaml +++ b/mods/cnc/rules/system.yaml @@ -52,7 +52,8 @@ World: CncMenuPaletteEffect: ScreenShaker: NukePaletteEffect: - CncWaterPaletteRotation: + WaterPaletteRotation: + Base: 32 BuildingInfluence: BridgeLayer: Bridges: bridge1, bridge2, bridge3, bridge4