removing some dead crap
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1301 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -74,22 +74,11 @@ namespace OpenRa.Game
|
||||
PathFinder.Instance = new PathFinder( map, terrain.tileSet );
|
||||
}
|
||||
|
||||
void PrecacheStructure(string name)
|
||||
{
|
||||
UnitSheetBuilder.GetUnit(name);
|
||||
UnitSheetBuilder.GetUnit(name + "make");
|
||||
}
|
||||
|
||||
void PrecacheUnit(string name)
|
||||
{
|
||||
UnitSheetBuilder.GetUnit(name);
|
||||
}
|
||||
|
||||
internal void Run()
|
||||
{
|
||||
while (Created && Visible)
|
||||
{
|
||||
Frame();
|
||||
viewport.DrawRegions();
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
@@ -120,10 +109,5 @@ namespace OpenRa.Game
|
||||
lastPos = p;
|
||||
}
|
||||
}
|
||||
|
||||
void Frame()
|
||||
{
|
||||
viewport.DrawRegions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ using BluntDirectX.Direct3D;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
delegate void TickFunc(World world, double t);
|
||||
|
||||
class Mcv : Actor, ISelectable
|
||||
{
|
||||
static Range<int> mcvRange = UnitSheetBuilder.GetUnit("mcv");
|
||||
@@ -15,14 +17,11 @@ namespace OpenRa.Game
|
||||
int2 fromCell, toCell;
|
||||
int moveFraction, moveFractionTotal;
|
||||
|
||||
delegate void TickFunc( World world, double t );
|
||||
TickFunc currentOrder = null;
|
||||
TickFunc nextOrder = null;
|
||||
TickFunc currentOrder, nextOrder;
|
||||
|
||||
public Mcv(int2 cell, int palette)
|
||||
{
|
||||
fromCell = toCell = cell;
|
||||
// HACK: display the mcv centered in it's cell;
|
||||
renderLocation = (cell * 24).ToFloat2() - new float2(12, 12);
|
||||
this.palette = palette;
|
||||
}
|
||||
@@ -116,9 +115,7 @@ namespace OpenRa.Game
|
||||
else
|
||||
location = 24 * fromCell.ToFloat2();
|
||||
|
||||
renderLocation = location - new float2( 12, 12 ); // HACK: center mcv in it's cell
|
||||
|
||||
renderLocation = renderLocation.Round();
|
||||
renderLocation = (location - new float2( 12, 12 )).Round();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ namespace OpenRa.Game
|
||||
}
|
||||
}
|
||||
|
||||
static bool first = true;
|
||||
|
||||
public List<int2> FindUnitPath( World world, Mcv unit, int2 destination )
|
||||
{
|
||||
int2 offset = new int2( map.XOffset, map.YOffset );
|
||||
@@ -61,24 +59,18 @@ namespace OpenRa.Game
|
||||
queue.Add( new PathDistance( Estimate( startLocation, destination ), startLocation ) );
|
||||
minCost[ startLocation.X, startLocation.Y ] = Estimate( startLocation, destination );
|
||||
|
||||
int hax = 0;
|
||||
int seenCount = 0;
|
||||
int impassableCount = 0;
|
||||
|
||||
while( !queue.Empty )
|
||||
{
|
||||
++hax;
|
||||
PathDistance p = queue.Pop();
|
||||
int2 here = p.Location;
|
||||
seen[ here.X, here.Y ] = true;
|
||||
|
||||
if( hax < 128 )
|
||||
world.AddFrameEndTask( delegate { world.Add( new Mcv( here - offset, 2 ) ); } );
|
||||
|
||||
if( p.Location == destination )
|
||||
{
|
||||
Log.Write( "{0}, {1}, {2}", hax, seenCount, impassableCount );
|
||||
first = false;
|
||||
Log.Write( "{0}, {1}", seenCount, impassableCount );
|
||||
return MakePath( path, destination, offset );
|
||||
}
|
||||
|
||||
@@ -147,22 +139,22 @@ namespace OpenRa.Game
|
||||
int straight = Math.Abs( d.X - d.Y );
|
||||
return 1.5 * diag + straight;
|
||||
}
|
||||
}
|
||||
|
||||
struct PathDistance : IComparable<PathDistance>
|
||||
struct PathDistance : IComparable<PathDistance>
|
||||
{
|
||||
public double EstTotal;
|
||||
public int2 Location;
|
||||
|
||||
public PathDistance(double estTotal, int2 location)
|
||||
{
|
||||
public double EstTotal;
|
||||
public int2 Location;
|
||||
EstTotal = estTotal;
|
||||
Location = location;
|
||||
}
|
||||
|
||||
public PathDistance( double estTotal, int2 location )
|
||||
{
|
||||
EstTotal = estTotal;
|
||||
Location = location;
|
||||
}
|
||||
|
||||
public int CompareTo( PathDistance other )
|
||||
{
|
||||
return Math.Sign( EstTotal - other.EstTotal );
|
||||
}
|
||||
public int CompareTo(PathDistance other)
|
||||
{
|
||||
return Math.Sign(EstTotal - other.EstTotal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace OpenRa.Game
|
||||
readonly GraphicsDevice device;
|
||||
Texture texture;
|
||||
|
||||
string filename = string.Format("../../../block-cache-{0}.png", suffix++);
|
||||
|
||||
public Size Size { get { return bitmap.Size; } }
|
||||
|
||||
public Sheet(Size size, GraphicsDevice d)
|
||||
@@ -36,10 +38,9 @@ namespace OpenRa.Game
|
||||
|
||||
void LoadTexture()
|
||||
{
|
||||
string tempFile = string.Format("../../../block-cache-{0}.png", suffix++);
|
||||
bitmap.Save(tempFile);
|
||||
bitmap.Save(filename);
|
||||
|
||||
using( Stream s = File.OpenRead(tempFile) )
|
||||
using( Stream s = File.OpenRead(filename) )
|
||||
texture = Texture.Create(s, device);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRa.Game
|
||||
const int spritesPerBatch = 1024;
|
||||
|
||||
List<Vertex> vertices = new List<Vertex>();
|
||||
List<ushort> indicies = new List<ushort>();
|
||||
List<ushort> indices = new List<ushort>();
|
||||
Sheet currentSheet = null;
|
||||
int sprites = 0;
|
||||
ShaderQuality quality;
|
||||
@@ -38,15 +38,15 @@ namespace OpenRa.Game
|
||||
renderer.DrawWithShader(quality, delegate
|
||||
{
|
||||
vertexBuffer.SetData(vertices.ToArray());
|
||||
indexBuffer.SetData(indicies.ToArray());
|
||||
indexBuffer.SetData(indices.ToArray());
|
||||
renderer.DrawBatch(vertexBuffer, indexBuffer,
|
||||
new Range<int>(0, vertices.Count),
|
||||
new Range<int>(0, indicies.Count),
|
||||
new Range<int>(0, indices.Count),
|
||||
currentSheet.Texture);
|
||||
});
|
||||
|
||||
vertices = new List<Vertex>();
|
||||
indicies = new List<ushort>();
|
||||
indices = new List<ushort>();
|
||||
currentSheet = null;
|
||||
sprites = 0;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace OpenRa.Game
|
||||
Flush();
|
||||
|
||||
currentSheet = s.sheet;
|
||||
Util.CreateQuad(vertices, indicies, location, s, palette);
|
||||
Util.CreateQuad(vertices, indices, location, s, palette);
|
||||
|
||||
if (++sprites >= spritesPerBatch)
|
||||
Flush();
|
||||
|
||||
Reference in New Issue
Block a user