fixed flames; fixed ftur 'rotation'; fixed repair cursor hotspot

This commit is contained in:
Chris Forbes
2010-01-22 23:27:51 +13:00
parent cef25cf192
commit a67fc5ba76
9 changed files with 38 additions and 14 deletions

View File

@@ -66,6 +66,21 @@ namespace OpenRa.Effects
Combat.DoImpact(Dest, VisualDest - new int2( 0, DestAltitude ),
Weapon, Projectile, Warhead, FiredBy);
}
if (Projectile.Trail != null)
{
var at = (float)t / TotalTime();
var altitude = float2.Lerp(SrcAltitude, DestAltitude, at);
var pos = float2.Lerp(Src.ToFloat2(), VisualDest.ToFloat2(), at)
- 0.5f * anim.Image.size - new float2(0, altitude);
var highPos = (Projectile.High || Projectile.Arcing)
? (pos - new float2(0, (VisualDest - Src).Length * height * 4 * at * (1 - at)))
: pos;
world.AddFrameEndTask(w => w.Add(
new Smoke(w, highPos.ToInt2(), Projectile.Trail)));
}
}
const float height = .1f;
@@ -83,14 +98,14 @@ namespace OpenRa.Effects
if (Projectile.High || Projectile.Arcing)
{
if (Projectile.Shadow)
yield return new Renderable(anim.Image, pos, PaletteType.Shadow);
yield return new Renderable(anim.Image, pos - .5f * anim.Image.size, PaletteType.Shadow);
var highPos = pos - new float2(0, (VisualDest - Src).Length * height * 4 * at * (1 - at));
yield return new Renderable(anim.Image, highPos, Owner.Palette);
yield return new Renderable(anim.Image, highPos - .5f * anim.Image.size, Owner.Palette);
}
else
yield return new Renderable(anim.Image, pos, Projectile.UnderWater ? PaletteType.Shadow : Owner.Palette);
yield return new Renderable(anim.Image, pos - .5f * anim.Image.size, Projectile.UnderWater ? PaletteType.Shadow : Owner.Palette);
}
}
}

View File

@@ -77,8 +77,9 @@ namespace OpenRa.Effects
var move = speed * -float2.FromAngle((float)angle);
Pos += move;
if (Projectile.Animates)
world.AddFrameEndTask(w => w.Add(new Smoke(w, (Pos - 1.5f * move - new int2( 0, Altitude )).ToInt2())));
if (Projectile.Trail != null)
world.AddFrameEndTask(w => w.Add(
new Smoke(w, (Pos - 1.5f * move - new int2( 0, Altitude )).ToInt2(), Projectile.Trail)));
// todo: running out of fuel
}

View File

@@ -7,11 +7,12 @@ namespace OpenRa.Effects
class Smoke : IEffect
{
readonly int2 pos;
readonly Animation anim = new Animation("smokey");
readonly Animation anim;
public Smoke(World world, int2 pos)
public Smoke(World world, int2 pos, string trail)
{
this.pos = pos;
anim = new Animation(trail);
anim.PlayThen("idle",
() => world.AddFrameEndTask(w => w.Remove(this)));
}

View File

@@ -6,7 +6,7 @@ namespace OpenRa.GameRules
public readonly bool AA = false;
public readonly bool AG = true;
public readonly bool ASW = false;
public readonly bool Animates = false;
public readonly string Trail = null;
public readonly bool Arcing = false;
public readonly int Arm = 0;
public readonly bool Degenerates = false;