diff --git a/OpenRa.FileFormats/Map.cs b/OpenRa.FileFormats/Map.cs index 5251dce625..6c957274dc 100644 --- a/OpenRa.FileFormats/Map.cs +++ b/OpenRa.FileFormats/Map.cs @@ -157,5 +157,7 @@ namespace OpenRa.FileFormats Y = xy / 128; Image = image; } + + public Point Location { get { return new Point(X, Y); } } } } diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index a558fa6d13..2e0add3797 100644 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -10,7 +10,7 @@ namespace OpenRa.Game { abstract class Actor { - public PointF location; + public float2 location; public int palette; public abstract Sprite[] CurrentImages { get; } } diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index af3d908477..c670650938 100644 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -32,7 +32,7 @@ namespace OpenRa.Game settings.GetValue("height", desktopResolution.Height)); } - public MainWindow( Settings settings ) + public MainWindow(Settings settings) { FormBorderStyle = FormBorderStyle.None; BackColor = Color.Black; @@ -59,11 +59,11 @@ namespace OpenRa.Game foreach (TreeReference treeReference in map.Trees) world.Add(new Tree(treeReference, treeCache, map)); - 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 Mcv(24 * new float2(5, 5), 3)); + world.Add(new Mcv(24 * new float2(7, 5), 2)); + world.Add(new Mcv(24 * new float2(9, 5), 1)); - world.Add(new Refinery(new PointF(24 * 5, 24 * 7), 1)); + world.Add(new Refinery(24 * new float2(5, 7), 1)); sidebar = new Sidebar(Race.Soviet, renderer); } diff --git a/OpenRa.Game/Mcv.cs b/OpenRa.Game/Mcv.cs index c5b6efaf60..162433b01f 100644 --- a/OpenRa.Game/Mcv.cs +++ b/OpenRa.Game/Mcv.cs @@ -11,7 +11,7 @@ namespace OpenRa.Game { static Range? mcvRange = null; - public Mcv( PointF location, int palette ) + public Mcv( float2 location, int palette ) { this.location = location; this.palette = palette; diff --git a/OpenRa.Game/Refinery.cs b/OpenRa.Game/Refinery.cs index adc4d61009..3feca0bfea 100644 --- a/OpenRa.Game/Refinery.cs +++ b/OpenRa.Game/Refinery.cs @@ -11,7 +11,7 @@ namespace OpenRa.Game { static Range? refineryRange = null; - public Refinery(PointF location, int palette) + public Refinery(float2 location, int palette) { if (refineryRange == null) refineryRange = UnitSheetBuilder.AddUnit("proc"); diff --git a/OpenRa.Game/Tree.cs b/OpenRa.Game/Tree.cs index 94043dc99a..8230450efe 100644 --- a/OpenRa.Game/Tree.cs +++ b/OpenRa.Game/Tree.cs @@ -10,7 +10,7 @@ namespace OpenRa.Game { public Tree(TreeReference r, TreeCache renderer, Map map) { - location = new PointF(24 * (r.X - map.XOffset), 24 * (r.Y - map.YOffset)); + location = 24 * (new float2(r.Location) - new float2(map.XOffset, map.YOffset)); currentImages = new Sprite[] { renderer.GetImage(r.Image) }; } diff --git a/OpenRa.Game/World.cs b/OpenRa.Game/World.cs index a05b461682..90bfb3e346 100644 --- a/OpenRa.Game/World.cs +++ b/OpenRa.Game/World.cs @@ -37,7 +37,7 @@ namespace OpenRa.Game continue; foreach (Sprite image in images) - spriteRenderer.DrawSprite(image, a.location, a.palette); + spriteRenderer.DrawSprite(image, a.location.ToPointF(), a.palette); } spriteRenderer.Flush(); diff --git a/OpenRa.Game/float2.cs b/OpenRa.Game/float2.cs index 4dc5c3496b..a20dbdac19 100644 --- a/OpenRa.Game/float2.cs +++ b/OpenRa.Game/float2.cs @@ -8,7 +8,7 @@ using BluntDirectX.Direct3D; namespace OpenRa.Game { [StructLayout(LayoutKind.Sequential)] - class float2 + struct float2 { public float X, Y;