Hacky fix for group movement

This commit is contained in:
Paul Chote
2011-02-03 19:27:05 +13:00
parent 7c2a7db794
commit 73a08624ef
4 changed files with 23 additions and 13 deletions

View File

@@ -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<Pair<int2, SubCell>> 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);
}
}

View File

@@ -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 )
{
}

View File

@@ -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

View File

@@ -63,6 +63,7 @@
Range: 4
Mobile:
Crushes: apmine, crate
SharesCell: true
TerrainSpeeds:
Clear: 90
Rough: 80