Split pip artwork into their own files and kill the hardcoded size/offset junk. Add a blue pip to support C&C blue tib. Fixes #836.
This commit is contained in:
@@ -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<IPips>();
|
||||
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<IPips>())
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 };
|
||||
|
||||
|
||||
BIN
mods/cnc/bits/pips.shp
Normal file
BIN
mods/cnc/bits/pips.shp
Normal file
Binary file not shown.
@@ -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:
|
||||
|
||||
@@ -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: *
|
||||
|
||||
BIN
mods/ra/bits/pips2.shp
Normal file
BIN
mods/ra/bits/pips2.shp
Normal file
Binary file not shown.
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user