Convert non-aircraft positioning to world coords.

This removes the incomplete and unused hover code
on Mobile, which would be more trouble that it is
currently worth to carry over.
This commit is contained in:
Paul Chote
2013-07-21 13:42:25 +12:00
parent 29009fe3a4
commit c3f04cc32e
20 changed files with 67 additions and 96 deletions

View File

@@ -135,10 +135,11 @@ namespace OpenRA
var ios = occupySpace.Value;
if (ios != null)
{
loc -= new PVecInt(0, ios.Altitude);
var altitude = ios.CenterPosition.Z * Game.CellSize / 1024;
loc -= new PVecInt(0, altitude);
if (useAltitude)
size = new PVecInt(size.X, size.Y + ios.Altitude);
size = new PVecInt(size.X, size.Y + altitude);
}
return new Rectangle(loc.X, loc.Y, size.X, size.Y);

View File

@@ -97,15 +97,12 @@ namespace OpenRA.Traits
public interface IVisibilityModifier { bool IsVisible(Actor self, Player byPlayer); }
public interface IRadarColorModifier { Color RadarColorOverride(Actor self); }
public interface IOccupySpaceInfo { }
public interface IOccupySpace
{
WPos CenterPosition { get; }
CPos TopLeft { get; }
IEnumerable<Pair<CPos, SubCell>> OccupiedCells();
// TODO: We shouldn't expose the setter here
// This will be going away soon, so isn't a big deal
int Altitude { get; set; }
}
public static class IOccupySpaceExts

View File

@@ -13,7 +13,7 @@ using OpenRA.FileFormats;
namespace OpenRA.Traits
{
class WaypointInfo : ITraitInfo
class WaypointInfo : ITraitInfo, IOccupySpaceInfo
{
public object Create( ActorInitializer init ) { return new Waypoint( init ); }
}
@@ -28,10 +28,7 @@ namespace OpenRA.Traits
}
public CPos TopLeft { get { return location; } }
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells() { yield break; }
public WPos CenterPosition { get { return location.CenterPosition; } }
public PPos PxPosition { get { return Util.CenterOfCell(location); } }
public int Altitude { get { return 0; } set { } }
}
}