Convert AnimationWithOffset to world coords.

Animations (via Actor.CenterPosition) now
understand Altitude, so there is potential for
mis-positioned animations if any existing altitude
hacks were missed.
This commit is contained in:
Paul Chote
2013-05-14 21:02:46 +12:00
parent fb17654ea0
commit fe716e76a7
16 changed files with 64 additions and 66 deletions

View File

@@ -28,11 +28,13 @@ namespace OpenRA.Mods.RA.Render
/* rude hack */
var visualOffset = ((move is Helicopter || move is Mobile) && move.Altitude > 0)
? Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0;
? (int)Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0;
var shadowSprites = r.Select(a => a.WithPalette(wr.Palette("shadow")));
var flyingSprites = (move.Altitude <= 0) ? r
: r.Select(a => a.WithPxOffset(new float2(0, -(move.Altitude + visualOffset))).WithZOffset(move.Altitude + a.ZOffset));
var shadowSprites = r.Select(a => a.WithPalette(wr.Palette("shadow"))
.WithPos(a.Pos - new WVec(0, 0, a.Pos.Z)).WithZOffset(-24));
var flyingSprites = (move.Altitude <= 0) ? r :
r.Select(a => a.WithPos(a.Pos - new WVec(0,0,43*visualOffset)));
return shadowSprites.Concat(flyingSprites);
}