adds bib rendering. still wrong for a few buildings, but not *too* bad.
This commit is contained in:
@@ -129,7 +129,7 @@ namespace OpenRa.Game
|
||||
}
|
||||
|
||||
public float2 CenterLocation;
|
||||
public float2 SelectedSize { get { return Render().FirstOrDefault().First.size; } }
|
||||
public float2 SelectedSize { get { return Render().LastOrDefault().First.size; } }
|
||||
|
||||
public IEnumerable<Pair<Sprite, float2>> Render()
|
||||
{
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace OpenRa.Game
|
||||
game = new Game(settings.GetValue("map", "scg11eb.ini"), renderer, new int2(ClientSize));
|
||||
|
||||
SequenceProvider.ForcePrecache();
|
||||
Traits.RenderBuilding.Prefetch();
|
||||
|
||||
game.world.Add( new Actor( "mcv", new int2( 5, 5 ), game.players[ 3 ]) );
|
||||
game.world.Add( new Actor( "mcv", new int2( 7, 5 ), game.players[ 2 ] ) );
|
||||
|
||||
@@ -4,19 +4,48 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using IjwFramework.Types;
|
||||
using OpenRa.Game.Graphics;
|
||||
using OpenRa.Game.GameRules;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class RenderBuilding : RenderSimple
|
||||
{
|
||||
static Sprite[] largeBib;
|
||||
static Sprite[] smallBib;
|
||||
|
||||
static int2[] largeBibPos = new[] { new int2(0,0), new int2(1,0), new int2(2,0),
|
||||
new int2(0,1), new int2(1,1), new int2(2,1) };
|
||||
|
||||
static int2[] smallBibPos = new[] { new int2(0,0), new int2(1,0),
|
||||
new int2(0,1), new int2(1,1)};
|
||||
|
||||
public RenderBuilding(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
anim.PlayThen("make", () => anim.PlayRepeating("idle"));
|
||||
}
|
||||
|
||||
public static void Prefetch()
|
||||
{
|
||||
largeBib = SpriteSheetBuilder.LoadAllSprites("bib2.", "tem", "sno", "int");
|
||||
smallBib = SpriteSheetBuilder.LoadAllSprites("bib3.", "tem", "sno", "int");
|
||||
}
|
||||
|
||||
public override IEnumerable<Pair<Sprite, float2>> Render(Actor self)
|
||||
{
|
||||
if (((UnitInfo.BuildingInfo)self.unitInfo).Bib)
|
||||
{
|
||||
var fp = Rules.Footprint.GetFootprint(self.unitInfo.Name );
|
||||
var bibOffset = new int2(0, fp.Length - 2);
|
||||
var hasSmallBib = fp.First().Length == 2;
|
||||
|
||||
var bib = hasSmallBib ? smallBib : largeBib;
|
||||
var bibPos = hasSmallBib ? smallBibPos : largeBibPos;
|
||||
|
||||
for (int i = 0; i < bib.Length; i++)
|
||||
yield return Pair.New(bib[i], 24f * (float2)(self.Location + bibOffset + bibPos[i]));
|
||||
}
|
||||
|
||||
yield return Pair.New(anim.Image, 24f * (float2)self.Location);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
x : ftur sbag brik fenc gun pbox hbox silo gap kenn *
|
||||
_ x : tsla agun
|
||||
xx xx == : powr dome barr tent domf hpad atek
|
||||
xxx xxx === : fact facf weap weaf apwr stek
|
||||
xxx xxx xxx : syrf syrd spen spef
|
||||
xxx xxx === : weap weaf apwr stek
|
||||
xxx xxx xxx : syrf syrd spen spef fact facf
|
||||
xx : sam mslo
|
||||
_x_ xxx x== === : proc
|
||||
xxx xxx : afld
|
||||
|
||||
Reference in New Issue
Block a user