Moved MobileInfo.SubCellOffsets to Map (dropping static) & added Map.SubCellsDefaultIndex

This commit is contained in:
atlimit8
2014-07-29 09:01:37 -05:00
parent 43478dd500
commit 4b7537bb13
5 changed files with 21 additions and 21 deletions

View File

@@ -133,16 +133,6 @@ namespace OpenRA.Mods.RA.Move
return TilesetMovementClass[tileset];
}
public static readonly WVec[] SubCellOffsets =
{
new WVec(0, 0, 0),
new WVec(-299, -256, 0),
new WVec(256, -256, 0),
new WVec(0, 0, 0),
new WVec(-299, 256, 0),
new WVec(256, 256, 0),
};
static bool IsMovingInMyDirection(Actor self, Actor other)
{
if (!other.IsMoving()) return false;
@@ -248,8 +238,7 @@ namespace OpenRA.Mods.RA.Move
this.self = init.self;
this.Info = info;
// TODO replace 3 w/ SubCellDefaultIndex
toSubCell = fromSubCell = info.SharesCell ? 3 : 0;
toSubCell = fromSubCell = info.SharesCell ? init.world.Map.SubCellsDefaultIndex : 0;
if (init.Contains<SubCellInit>())
{
this.fromSubCell = this.toSubCell = init.Get<SubCellInit, int>();
@@ -258,7 +247,7 @@ namespace OpenRA.Mods.RA.Move
if (init.Contains<LocationInit>())
{
this.__fromCell = this.__toCell = init.Get<LocationInit, CPos>();
SetVisualPosition(self, init.world.Map.CenterOfCell(fromCell) + MobileInfo.SubCellOffsets[fromSubCell]);
SetVisualPosition(self, init.world.Map.CenterOfCell(fromCell) + self.World.Map.SubCellOffsets[fromSubCell]);
}
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : info.InitialFacing;
@@ -272,7 +261,7 @@ namespace OpenRA.Mods.RA.Move
public void SetPosition(Actor self, CPos cell)
{
SetLocation(cell, fromSubCell, cell, fromSubCell);
SetVisualPosition(self, self.World.Map.CenterOfCell(fromCell) + MobileInfo.SubCellOffsets[fromSubCell]);
SetVisualPosition(self, self.World.Map.CenterOfCell(fromCell) + self.World.Map.SubCellOffsets[fromSubCell]);
FinishedMoving(self);
}