Support additive blending for D2K explosions.

This commit is contained in:
Paul Chote
2013-08-14 17:00:57 +12:00
parent 2b6b212d02
commit a1dd7cff7b
9 changed files with 55 additions and 26 deletions

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
namespace OpenRA.Graphics
{
@@ -36,16 +37,20 @@ namespace OpenRA.Graphics
Name = name;
var d = info.NodesDict;
var offset = float2.Zero;
var blendMode = BlendMode.Alpha;
Start = int.Parse(d["Start"].Value);
if (d.ContainsKey("Offset"))
offset = FieldLoader.GetValue<float2>("Offset", d["Offset"].Value);
if (d.ContainsKey("BlendMode"))
blendMode = FieldLoader.GetValue<BlendMode>("BlendMode", d["BlendMode"].Value);
// Apply offset to each sprite in the sequence
// Different sequences may apply different offsets to the same frame
sprites = Game.modData.SpriteLoader.LoadAllSprites(srcOverride ?? unit).Select(
s => new Sprite(s.sheet, s.bounds, s.offset + offset, s.channel)).ToArray();
s => new Sprite(s.sheet, s.bounds, s.offset + offset, s.channel, blendMode)).ToArray();
if (!d.ContainsKey("Length"))
Length = 1;