Fix some style nits in WorldRenderer.

This commit is contained in:
Paul Chote
2013-09-29 21:15:46 +13:00
parent 19e0c2a83f
commit 5f0bb4b6c2

View File

@@ -155,21 +155,21 @@ namespace OpenRA.Graphics
var pos = ScreenPxPosition(a.CenterPosition); var pos = ScreenPxPosition(a.CenterPosition);
var bounds = a.Bounds.Value; var bounds = a.Bounds.Value;
var xy = pos + new float2(bounds.Left, bounds.Top); var tl = pos + new float2(bounds.Left, bounds.Top);
var Xy = pos + new float2(bounds.Right, bounds.Top); var tr = pos + new float2(bounds.Right, bounds.Top);
var xY = pos + new float2(bounds.Left, bounds.Bottom); var bl = pos + new float2(bounds.Left, bounds.Bottom);
var XY = pos + new float2(bounds.Right, bounds.Bottom); var br = pos + new float2(bounds.Right, bounds.Bottom);
var wlr = Game.Renderer.WorldLineRenderer; var wlr = Game.Renderer.WorldLineRenderer;
wlr.DrawLine(xy, xy + new float2(4, 0), c, c); wlr.DrawLine(tl, tl + new float2(4, 0), c, c);
wlr.DrawLine(xy, xy + new float2(0, 4), c, c); wlr.DrawLine(tl, tl + new float2(0, 4), c, c);
wlr.DrawLine(Xy, Xy + new float2(-4, 0), c, c); wlr.DrawLine(tr, tr + new float2(-4, 0), c, c);
wlr.DrawLine(Xy, Xy + new float2(0, 4), c, c); wlr.DrawLine(tr, tr + new float2(0, 4), c, c);
wlr.DrawLine(xY, xY + new float2(4, 0), c, c); wlr.DrawLine(bl, bl + new float2(4, 0), c, c);
wlr.DrawLine(xY, xY + new float2(0, -4), c, c); wlr.DrawLine(bl, bl + new float2(0, -4), c, c);
wlr.DrawLine(XY, XY + new float2(-4, 0), c, c); wlr.DrawLine(br, br + new float2(-4, 0), c, c);
wlr.DrawLine(XY, XY + new float2(0, -4), c, c); wlr.DrawLine(br, br + new float2(0, -4), c, c);
} }
public void DrawRollover(Actor unit) public void DrawRollover(Actor unit)
@@ -192,9 +192,10 @@ namespace OpenRA.Graphics
public void DrawRangeCircleWithContrast(Color fg, float2 location, float range, Color bg, int offset) public void DrawRangeCircleWithContrast(Color fg, float2 location, float range, Color bg, int offset)
{ {
if (offset > 0) { if (offset > 0)
DrawRangeCircle(bg, location, range + (float) offset/Game.CellSize); {
DrawRangeCircle(bg, location, range - (float) offset/Game.CellSize); DrawRangeCircle(bg, location, range + (float)offset / Game.CellSize);
DrawRangeCircle(bg, location, range - (float)offset / Game.CellSize);
} }
DrawRangeCircle(fg, location, range); DrawRangeCircle(fg, location, range);
@@ -209,8 +210,8 @@ namespace OpenRA.Graphics
// Conversion between world and screen coordinates // Conversion between world and screen coordinates
public float2 ScreenPosition(WPos pos) public float2 ScreenPosition(WPos pos)
{ {
var c = Game.CellSize/1024f; var c = Game.CellSize / 1024f;
return new float2(c*pos.X, c*(pos.Y - pos.Z)); return new float2(c * pos.X, c * (pos.Y - pos.Z));
} }
public int2 ScreenPxPosition(WPos pos) public int2 ScreenPxPosition(WPos pos)
@@ -223,8 +224,8 @@ namespace OpenRA.Graphics
// For scaling vectors to pixel sizes in the voxel renderer // For scaling vectors to pixel sizes in the voxel renderer
public float[] ScreenVector(WVec vec) public float[] ScreenVector(WVec vec)
{ {
var c = Game.CellSize/1024f; var c = Game.CellSize / 1024f;
return new float[] {c*vec.X, c*vec.Y, c*vec.Z, 1}; return new float[] { c * vec.X, c * vec.Y, c * vec.Z, 1 };
} }
public int2 ScreenPxOffset(WVec vec) public int2 ScreenPxOffset(WVec vec)
@@ -234,7 +235,10 @@ namespace OpenRA.Graphics
return new int2((int)Math.Round(px[0]), (int)Math.Round(px[1] - px[2])); return new int2((int)Math.Round(px[0]), (int)Math.Round(px[1] - px[2]));
} }
public float ScreenZPosition(WPos pos, int zOffset) { return (pos.Y + pos.Z + zOffset)*Game.CellSize/1024f; } public float ScreenZPosition(WPos pos, int offset)
{
return (pos.Y + pos.Z + offset) * Game.CellSize / 1024f;
}
public WPos Position(int2 screenPx) public WPos Position(int2 screenPx)
{ {