diff --git a/OpenRA.Mods.RA/Move/Mobile.cs b/OpenRA.Mods.RA/Move/Mobile.cs index e7cc75110a..b33da09276 100755 --- a/OpenRA.Mods.RA/Move/Mobile.cs +++ b/OpenRA.Mods.RA/Move/Mobile.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Move [FieldLoader.Load] public readonly bool OnRails = false; [FieldLoader.Load] - public readonly bool SharesCell = true; + public readonly bool SharesCell = false; public virtual object Create(ActorInitializer init) { return new Mobile(init, this); } @@ -124,7 +124,7 @@ namespace OpenRA.Mods.RA.Move int __facing; int2 __fromCell, __toCell; - SubCell __fromSubCell, __toSubCell; + public SubCell __fromSubCell, __toSubCell; int __altitude; @@ -296,13 +296,13 @@ namespace OpenRA.Mods.RA.Move public IEnumerable> OccupiedCells() { if (fromCell == toCell) - yield return Pair.New(fromCell, SubCell.FullCell); + yield return Pair.New(fromCell, __fromSubCell); else if (CanEnterCell(toCell)) - yield return Pair.New(toCell, SubCell.FullCell); + yield return Pair.New(toCell, __toSubCell); else { - yield return Pair.New(fromCell, SubCell.FullCell); - yield return Pair.New(toCell, SubCell.FullCell); + yield return Pair.New(fromCell, __fromSubCell); + yield return Pair.New(toCell, __toSubCell); } } diff --git a/OpenRA.Mods.RA/Move/Move.cs b/OpenRA.Mods.RA/Move/Move.cs index b4236cc740..6f5642dbfa 100755 --- a/OpenRA.Mods.RA/Move/Move.cs +++ b/OpenRA.Mods.RA/Move/Move.cs @@ -146,6 +146,8 @@ namespace OpenRA.Mods.RA.Move this, Util.CenterOfCell( mobile.fromCell ), Util.BetweenCells( mobile.fromCell, mobile.toCell ), + mobile.__fromSubCell, + mobile.__toSubCell, mobile.Facing, mobile.Facing, 0 ); @@ -249,15 +251,18 @@ namespace OpenRA.Mods.RA.Move { public readonly Move move; public readonly int2 from, to; + public readonly SubCell fromSubCell, toSubCell; public readonly int fromFacing, toFacing; public int moveFraction; public readonly int moveFractionTotal; - public MovePart( Move move, int2 from, int2 to, int fromFacing, int toFacing, int startingFraction ) + public MovePart( Move move, int2 from, int2 to, SubCell fromSubCell, SubCell toSubCell, int fromFacing, int toFacing, int startingFraction ) { this.move = move; this.from = from; this.to = to; + this.fromSubCell = fromSubCell; + this.toSubCell = toSubCell; this.fromFacing = fromFacing; this.toFacing = toFacing; this.moveFraction = startingFraction; @@ -302,7 +307,7 @@ namespace OpenRA.Mods.RA.Move void UpdateCenterLocation( Actor self, Mobile mobile ) { - mobile.PxPosition = int2.Lerp( from, to, moveFraction, moveFractionTotal ); + mobile.PxPosition = int2.Lerp( from + mobile.Info.SubCellOffsets[fromSubCell], to + mobile.Info.SubCellOffsets[toSubCell], moveFraction, moveFractionTotal ); if( moveFraction >= moveFractionTotal ) mobile.Facing = toFacing & 0xFF; @@ -320,8 +325,8 @@ namespace OpenRA.Mods.RA.Move class MoveFirstHalf : MovePart { - public MoveFirstHalf( Move move, int2 from, int2 to, int fromFacing, int toFacing, int startingFraction ) - : base( move, from, to, fromFacing, toFacing, startingFraction ) + public MoveFirstHalf( Move move, int2 from, int2 to, SubCell fromSubCell, SubCell toSubCell, int fromFacing, int toFacing, int startingFraction ) + : base( move, from, to, fromSubCell, toSubCell, fromFacing, toFacing, startingFraction ) { } @@ -336,6 +341,8 @@ namespace OpenRA.Mods.RA.Move move, Util.BetweenCells( mobile.fromCell, mobile.toCell ), Util.BetweenCells( mobile.toCell, nextCell.Value ), + mobile.__fromSubCell, + mobile.__toSubCell, mobile.Facing, Util.GetNearestFacing( mobile.Facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.Facing ) ), moveFraction - moveFractionTotal ); @@ -349,6 +356,8 @@ namespace OpenRA.Mods.RA.Move move, Util.BetweenCells( mobile.fromCell, mobile.toCell ), Util.CenterOfCell( mobile.toCell ), + mobile.__fromSubCell, + mobile.__toSubCell, mobile.Facing, mobile.Facing, moveFraction - moveFractionTotal ); @@ -359,8 +368,8 @@ namespace OpenRA.Mods.RA.Move class MoveSecondHalf : MovePart { - public MoveSecondHalf( Move move, int2 from, int2 to, int fromFacing, int toFacing, int startingFraction ) - : base( move, from, to, fromFacing, toFacing, startingFraction ) + public MoveSecondHalf( Move move, int2 from, int2 to, SubCell fromSubCell, SubCell toSubCell, int fromFacing, int toFacing, int startingFraction ) + : base( move, from, to, fromSubCell, toSubCell, fromFacing, toFacing, startingFraction ) { } diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 741081285f..abbfd793e0 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -89,6 +89,7 @@ Range: 4 Mobile: Crushes: crate + SharesCell: true TerrainSpeeds: Clear: 90 Rough: 80 @@ -113,7 +114,6 @@ PoisonedByTiberium: GainsExperience: GivesExperience: -# SharesCell: DrawLineToTarget: ActorLostNotification: Notification: unitlost.aud diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 151b712976..5150cb518c 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -63,6 +63,7 @@ Range: 4 Mobile: Crushes: apmine, crate + SharesCell: true TerrainSpeeds: Clear: 90 Rough: 80