From bb9790c754e13c9a3495062bf1a56157a1100f18 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Thu, 20 Apr 2017 20:50:04 +0200 Subject: [PATCH 1/3] Move legacy map import commands into matching subfolder --- OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj | 4 ++-- .../{ => UtilityCommands}/ImportRedAlertLegacyMapCommand.cs | 0 .../ImportTiberianDawnLegacyMapCommand.cs | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename OpenRA.Mods.Cnc/{ => UtilityCommands}/ImportRedAlertLegacyMapCommand.cs (100%) rename OpenRA.Mods.Cnc/{ => UtilityCommands}/ImportTiberianDawnLegacyMapCommand.cs (100%) diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index e9de67301b..6ba96ea6dc 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -72,7 +72,7 @@ - + @@ -130,7 +130,7 @@ - + diff --git a/OpenRA.Mods.Cnc/ImportRedAlertLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs similarity index 100% rename from OpenRA.Mods.Cnc/ImportRedAlertLegacyMapCommand.cs rename to OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs diff --git a/OpenRA.Mods.Cnc/ImportTiberianDawnLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs similarity index 100% rename from OpenRA.Mods.Cnc/ImportTiberianDawnLegacyMapCommand.cs rename to OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs From 04f8a85cc6356ec234dd2e0bb9cf9451b66f305d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Thu, 20 Apr 2017 21:12:07 +0200 Subject: [PATCH 2/3] Make LightPaletteRotator interfaces explicit and add desc --- OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs b/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs index 13ed8c21ad..14a72d7fb3 100644 --- a/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs +++ b/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs @@ -18,6 +18,7 @@ namespace OpenRA.Mods.Cnc.Traits [Desc("Palette effect used for blinking \"animations\" on actors.")] class LightPaletteRotatorInfo : ITraitInfo { + [Desc("Palettes this effect should not apply to.")] public readonly HashSet ExcludePalettes = new HashSet(); public object Create(ActorInitializer init) { return new LightPaletteRotator(this); } @@ -33,12 +34,12 @@ namespace OpenRA.Mods.Cnc.Traits this.info = info; } - public void Tick(Actor self) + void ITick.Tick(Actor self) { t += .5f; } - public void AdjustPalette(IReadOnlyDictionary palettes) + void IPaletteModifier.AdjustPalette(IReadOnlyDictionary palettes) { foreach (var pal in palettes) { From 4a8571161a6ef3ad71f201b6c0c9356b6d424f77 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Thu, 20 Apr 2017 21:13:02 +0200 Subject: [PATCH 3/3] Unhardcode LightPaletteRotator properties --- .../PaletteEffects/LightPaletteRotator.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs b/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs index 14a72d7fb3..e6c80d8402 100644 --- a/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs +++ b/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs @@ -21,6 +21,15 @@ namespace OpenRA.Mods.Cnc.Traits [Desc("Palettes this effect should not apply to.")] public readonly HashSet ExcludePalettes = new HashSet(); + [Desc("'Speed' at which the effect cycles through palette indices.")] + public readonly float TimeStep = .5f; + + [Desc("Palette index to map to rotating color indices.")] + public readonly int ModifyIndex = 103; + + [Desc("Palette indices to rotate through.")] + public readonly int[] RotationIndices = { 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 238, 237, 236, 235, 234, 233, 232, 231 }; + public object Create(ActorInitializer init) { return new LightPaletteRotator(this); } } @@ -36,7 +45,7 @@ namespace OpenRA.Mods.Cnc.Traits void ITick.Tick(Actor self) { - t += .5f; + t += info.TimeStep; } void IPaletteModifier.AdjustPalette(IReadOnlyDictionary palettes) @@ -46,11 +55,8 @@ namespace OpenRA.Mods.Cnc.Traits if (info.ExcludePalettes.Contains(pal.Key)) continue; - var rotate = (int)t % 18; - if (rotate > 9) - rotate = 18 - rotate; - - pal.Value.SetColor(0x67, pal.Value.GetColor(230 + rotate)); + var rotate = (int)t % info.RotationIndices.Length; + pal.Value.SetColor(info.ModifyIndex, pal.Value.GetColor(info.RotationIndices[rotate])); } } }