Make MuzzleFlash palette customizable.

This commit is contained in:
reaperrr
2014-05-03 00:06:31 +02:00
parent 9f0f11db54
commit 7ba00ced5a
3 changed files with 20 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #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 * 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 * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -47,6 +47,9 @@ namespace OpenRA.Mods.RA
[Desc("Muzzle flash sequence to render")] [Desc("Muzzle flash sequence to render")]
public readonly string MuzzleSequence = null; 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")] [Desc("Use multiple muzzle images if non-zero")]
public readonly int MuzzleSplitFacings = 0; public readonly int MuzzleSplitFacings = 0;

View File

@@ -38,6 +38,8 @@ namespace OpenRA.Mods.RA
[Desc("Fire port yaw cone angle")] [Desc("Fire port yaw cone angle")]
public readonly WAngle[] PortCones = {}; public readonly WAngle[] PortCones = {};
public readonly string MuzzlePalette = "effect";
public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.self, this); } public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.self, this); }
} }
@@ -175,9 +177,10 @@ namespace OpenRA.Mods.RA
public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr) public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr)
{ {
var pal = wr.Palette(info.MuzzlePalette);
// Display muzzle flashes // Display muzzle flashes
foreach (var m in muzzles) 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; yield return r;
} }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #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 * 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 * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -78,6 +78,9 @@ namespace OpenRA.Mods.RA.Render
public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr) public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr)
{ {
foreach (var arm in self.TraitsImplementing<Armament>())
{
var palette = wr.Palette(arm.Info.MuzzlePalette);
foreach (var kv in anims) foreach (var kv in anims)
{ {
if (!visible[kv.Key]) if (!visible[kv.Key])
@@ -86,10 +89,11 @@ namespace OpenRA.Mods.RA.Render
if (kv.Value.DisableFunc != null && kv.Value.DisableFunc()) if (kv.Value.DisableFunc != null && kv.Value.DisableFunc())
continue; continue;
foreach (var r in kv.Value.Render(self, wr, wr.Palette("effect"), 1f)) foreach (var r in kv.Value.Render(self, wr, palette, 1f))
yield return r; yield return r;
} }
} }
}
public void Tick(Actor self) public void Tick(Actor self)
{ {