diff --git a/OpenRA.Mods.RA/Armament.cs b/OpenRA.Mods.RA/Armament.cs index 7060b11a9a..4dc3d61362 100644 --- a/OpenRA.Mods.RA/Armament.cs +++ b/OpenRA.Mods.RA/Armament.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -47,6 +47,9 @@ namespace OpenRA.Mods.RA [Desc("Muzzle flash sequence to render")] public readonly string MuzzleSequence = null; + [Desc("Palette to render Muzzle flash sequence in")] + public readonly string MuzzlePalette = "effect"; + [Desc("Use multiple muzzle images if non-zero")] public readonly int MuzzleSplitFacings = 0; diff --git a/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs b/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs index 8d6933f5e2..8f314288ed 100644 --- a/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs +++ b/OpenRA.Mods.RA/Attack/AttackGarrisoned.cs @@ -38,6 +38,8 @@ namespace OpenRA.Mods.RA [Desc("Fire port yaw cone angle")] public readonly WAngle[] PortCones = {}; + public readonly string MuzzlePalette = "effect"; + public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.self, this); } } @@ -175,9 +177,10 @@ namespace OpenRA.Mods.RA public IEnumerable Render(Actor self, WorldRenderer wr) { + var pal = wr.Palette(info.MuzzlePalette); // Display muzzle flashes foreach (var m in muzzles) - foreach (var r in m.Render(self, wr, wr.Palette("effect"), 1f)) + foreach (var r in m.Render(self, wr, pal, 1f)) yield return r; } diff --git a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs index 448d060e42..57f0f7f77c 100644 --- a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs +++ b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -78,16 +78,20 @@ namespace OpenRA.Mods.RA.Render public IEnumerable Render(Actor self, WorldRenderer wr) { - foreach (var kv in anims) + foreach (var arm in self.TraitsImplementing()) { - if (!visible[kv.Key]) - continue; + var palette = wr.Palette(arm.Info.MuzzlePalette); + foreach (var kv in anims) + { + if (!visible[kv.Key]) + continue; - if (kv.Value.DisableFunc != null && kv.Value.DisableFunc()) - continue; + if (kv.Value.DisableFunc != null && kv.Value.DisableFunc()) + continue; - foreach (var r in kv.Value.Render(self, wr, wr.Palette("effect"), 1f)) - yield return r; + foreach (var r in kv.Value.Render(self, wr, palette, 1f)) + yield return r; + } } }