git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1203 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
chrisf
2007-07-13 15:14:07 +00:00
parent 8cc0e26b3e
commit c5bfcacc69
5 changed files with 52 additions and 11 deletions

View File

@@ -52,16 +52,12 @@ namespace OpenRa.Game
foreach (TreeReference treeReference in map.Trees)
world.Add(new Tree(treeReference, treeCache, map));
//UnitSheetBuilder.AddUnit("e4");
//UnitSheetBuilder.AddUnit("mcv");
//UnitSheetBuilder.AddUnit("1tnk");
//UnitSheetBuilder.AddUnit("2tnk");
UnitSheetBuilder.AddUnit("3tnk");
world.Add(new Mcv(new PointF(24 * 5, 24 * 5), 3));
world.Add(new Mcv(new PointF(24 * 7, 24 * 5), 2));
world.Add(new Mcv(new PointF(24 * 9, 24 * 5), 1));
world.Add(new Refinery(new PointF(24 * 5, 24 * 7), 1));
sidebar = new Sidebar(OpenRa.TechTree.Race.None, renderer);
}

View File

@@ -3,15 +3,21 @@ using System.Collections.Generic;
using System.Text;
using OpenRa.FileFormats;
using System.Drawing;
using BluntDirectX.Direct3D;
namespace OpenRa.Game
{
class Mcv : Actor
{
static Range<int>? mcvRange = null;
public Mcv( PointF location, int palette )
{
this.location = location;
this.palette = palette;
if (mcvRange == null)
mcvRange = UnitSheetBuilder.AddUnit("mcv");
}
int GetFacing()
@@ -27,8 +33,7 @@ namespace OpenRa.Game
{
return new SheetRectangle<Sheet>[]
{
UnitSheetBuilder.McvSheet[GetFacing()],
UnitSheetBuilder.McvSheet[63 - GetFacing()]
UnitSheetBuilder.sprites[GetFacing() + mcvRange.Value.Start]
};
}
}

View File

@@ -50,6 +50,7 @@
<Compile Include="Mcv.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Refinery.cs" />
<Compile Include="Renderer.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Sheet.cs" />

36
OpenRa.Game/Refinery.cs Normal file
View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenRa.FileFormats;
using BluntDirectX.Direct3D;
using System.Drawing;
namespace OpenRa.Game
{
class Refinery : Actor
{
static Range<int>? refineryRange = null;
public Refinery(PointF location, int palette)
{
if (refineryRange == null)
refineryRange = UnitSheetBuilder.AddUnit("proc");
this.location = location;
this.palette = palette;
}
int GetFrame()
{
return 1;//
}
public override SheetRectangle<Sheet>[] CurrentImages
{
get
{
return new SheetRectangle<Sheet>[] { UnitSheetBuilder.sprites[refineryRange.Value.Start + GetFrame()] };
}
}
}
}

View File

@@ -12,7 +12,7 @@ namespace OpenRa.Game
static readonly Package unitsPackage = new Package( "../../../conquer.mix" );
static readonly Package otherUnitsPackage = new Package("../../../hires.mix");
public static readonly List<SheetRectangle<Sheet>> McvSheet = new List<SheetRectangle<Sheet>>();
public static readonly List<SheetRectangle<Sheet>> sprites = new List<SheetRectangle<Sheet>>();
static ShpReader Load(string filename)
{
@@ -23,11 +23,14 @@ namespace OpenRa.Game
throw new NotImplementedException();
}
public static void AddUnit( string name )
public static Range<int> AddUnit( string name )
{
int low = sprites.Count;
ShpReader reader = Load(name + ".shp");
foreach (ImageHeader h in reader)
McvSheet.Add(CoreSheetBuilder.Add(h.Image, reader.Size));
sprites.Add(CoreSheetBuilder.Add(h.Image, reader.Size));
return new Range<int>(low, sprites.Count - 1);
}
}
}