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