diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index 6d47002c86..394e3c6f08 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -25,9 +25,9 @@ namespace OpenRA.Traits public class Selectable : IPostRenderSelection { // depends on the order of pips in TraitsInterfaces.cs! - static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray" }; + static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue" }; static readonly string[] tagStrings = { "", "tag-fake", "tag-primary" }; - + public void RenderAfterWorld (WorldRenderer wr, Actor self) { var bounds = self.Bounds.Value; @@ -154,11 +154,18 @@ namespace OpenRA.Traits { if (self.Owner != self.World.LocalPlayer) return; - // If a mod wants to implement a unit with multiple pip sources, then they are placed on multiple rows - var pipxyBase = basePosition + new float2(-12, -7); // Correct for the offset in the shp file + var pipSources = self.TraitsImplementing(); + if (pipSources.Count() == 0) + return; + + var pipImages = new Animation("pips"); + pipImages.PlayRepeating(pipStrings[0]); + + var pipSize = pipImages.Image.size; + var pipxyBase = basePosition + new float2(1, -pipSize.Y); var pipxyOffset = new float2(0, 0); // Correct for offset due to multiple columns/rows - foreach (var pips in self.TraitsImplementing()) + foreach (var pips in pipSources) { var thisRow = pips.GetPips(self); if (thisRow == null) @@ -168,19 +175,19 @@ namespace OpenRA.Traits foreach (var pip in thisRow) { - if (pipxyOffset.X+5 > width) + if (pipxyOffset.X + pipSize.X >= width) { pipxyOffset.X = 0; - pipxyOffset.Y -= 4; + pipxyOffset.Y -= pipSize.Y; } - var pipImages = new Animation("pips"); pipImages.PlayRepeating(pipStrings[(int)pip]); pipImages.Image.DrawAt(wr, pipxyBase + pipxyOffset, "chrome"); - pipxyOffset += new float2(4, 0); + pipxyOffset += new float2(pipSize.X, 0); } + // Increment row pipxyOffset.X = 0; - pipxyOffset.Y -= 5; + pipxyOffset.Y -= pipSize.Y + 1; } } diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index e4bac039a0..4abc737c77 100755 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -19,7 +19,7 @@ using OpenRA.Network; namespace OpenRA.Traits { // depends on the order of pips in WorldRenderer.cs! - public enum PipType { Transparent, Green, Yellow, Red, Gray }; + public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue }; public enum TagType { None, Fake, Primary }; public enum Stance { Enemy, Neutral, Ally }; diff --git a/mods/cnc/bits/pips.shp b/mods/cnc/bits/pips.shp new file mode 100644 index 0000000000..ba16ae2ace Binary files /dev/null and b/mods/cnc/bits/pips.shp differ diff --git a/mods/cnc/rules/system.yaml b/mods/cnc/rules/system.yaml index 1517c646b7..3d900d4cf8 100644 --- a/mods/cnc/rules/system.yaml +++ b/mods/cnc/rules/system.yaml @@ -115,8 +115,7 @@ World: SpriteNames: bti1,bti2,bti3,bti4,bti5,bti6,bti7,bti8,bti9,bti10,bti11,bti12 ValuePerUnit: 60 Name: Blue Tiberium - # todo: add a blue pip. - PipColor: Red + PipColor: Blue AllowedTerrainTypes: Clear,Road AllowUnderActors: false SmudgeLayer@SCORCH: diff --git a/mods/cnc/sequences/misc.yaml b/mods/cnc/sequences/misc.yaml index e34cc9ee84..a6127ba68a 100644 --- a/mods/cnc/sequences/misc.yaml +++ b/mods/cnc/sequences/misc.yaml @@ -197,22 +197,18 @@ clock: Start: 0 Length: * pips: - ready: hpips - Start: 3 - hold: hpips - Start: 4 - pip-empty: hpips + pip-empty: Start: 0 - pip-green: hpips + pip-green: Start: 1 - pip-yellow: hpips - Start: 5 - pip-gray: hpips - Start: 6 - pip-red: hpips - Start: 7 - tag-primary: hpips + pip-yellow: Start: 2 + pip-gray: + Start: 3 + pip-red: + Start: 4 + pip-blue: + Start: 5 groups: pdigits Start: 0 Length: * diff --git a/mods/ra/bits/pips2.shp b/mods/ra/bits/pips2.shp new file mode 100644 index 0000000000..c6f99ce727 Binary files /dev/null and b/mods/ra/bits/pips2.shp differ diff --git a/mods/ra/sequences.yaml b/mods/ra/sequences.yaml index 00366bd153..83970fbb33 100644 --- a/mods/ra/sequences.yaml +++ b/mods/ra/sequences.yaml @@ -843,21 +843,22 @@ pips: Start: 3 hold: Start: 4 - pip-empty: - Start: 0 - pip-green: - Start: 1 - pip-yellow: - Start: 5 - pip-gray: - Start: 6 - pip-red: - Start: 7 tag-fake: Start: 18 tag-primary: Start: 2 - + pip-empty: pips2 + Start: 0 + pip-green: pips2 + Start: 1 + pip-yellow: pips2 + Start: 2 + pip-gray: pips2 + Start: 3 + pip-red: pips2 + Start: 4 + pip-blue: pips2 + Start: 5 mig: idle: Start: 0