Add Multiply blend mode for D2K move-flash and shroud.

This commit is contained in:
Paul Chote
2013-12-11 08:58:46 +13:00
parent 89d1d17b80
commit 089973280d
6 changed files with 21 additions and 7 deletions

View File

@@ -10,8 +10,8 @@
using System.IO;
using OpenRA.FileFormats;
using OpenRA.Traits;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
@@ -24,6 +24,7 @@ namespace OpenRA.Mods.RA
[Desc("Palette byte offset")]
public readonly long Offset = 0;
public readonly bool AllowModifiers = true;
public readonly bool InvertColor = false;
public object Create(ActorInitializer init) { return new PaletteFromR8(this); }
}
@@ -42,10 +43,11 @@ namespace OpenRA.Mods.RA
for (var i = 0; i < 256; i++)
{
// The custom palette is scaled into the range 0-128.
// This makes the move-flash match the original game, but may not be correct in other cases.
var packed = s.ReadUInt16();
colors[i] = (uint)((255 << 24) | ((packed & 0xF800) << 7) | ((packed & 0x7E0) << 4) | ((packed & 0x1f) << 2));
colors[i] = (uint)((255 << 24) | ((packed & 0xF800) << 8) | ((packed & 0x7E0) << 5) | ((packed & 0x1f) << 3));
if (info.InvertColor)
colors[i] ^= 0x00FFFFFF;
}
}