Convert Smoke to world coordinates.
This commit is contained in:
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
if (Info.Trail != null && --ticksToNextSmoke < 0)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(
|
||||
new Smoke(w, (PPos) highPos.ToInt2(), Info.Trail)));
|
||||
new Smoke(w, ((PPos)highPos.ToInt2()).ToWPos(0), Info.Trail)));
|
||||
ticksToNextSmoke = Info.TrailInterval;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
|
||||
if (--ticksToNextSmoke < 0)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, sp, Info.Trail)));
|
||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, sp.ToWPos(0), Info.Trail)));
|
||||
ticksToNextSmoke = Info.TrailInterval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,26 +17,25 @@ namespace OpenRA.Mods.RA.Effects
|
||||
{
|
||||
public class Smoke : IEffect
|
||||
{
|
||||
readonly PPos pos;
|
||||
readonly Animation anim;
|
||||
readonly WPos Pos;
|
||||
readonly Animation Anim;
|
||||
|
||||
public Smoke(World world, PPos pos, string trail)
|
||||
public Smoke(World world, WPos pos, string trail)
|
||||
{
|
||||
this.pos = pos;
|
||||
anim = new Animation(trail);
|
||||
anim.PlayThen("idle",
|
||||
Pos = pos;
|
||||
Anim = new Animation(trail);
|
||||
Anim.PlayThen("idle",
|
||||
() => world.AddFrameEndTask(w => w.Remove(this)));
|
||||
}
|
||||
|
||||
public void Tick( World world )
|
||||
{
|
||||
anim.Tick();
|
||||
Anim.Tick();
|
||||
}
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||
{
|
||||
yield return new SpriteRenderable(anim.Image, pos.ToFloat2(),
|
||||
wr.Palette("effect"), (int)pos.Y);
|
||||
yield return new SpriteRenderable(Anim.Image, Pos, 0, wr.Palette("effect"), 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
if (allies1.WinState != WinState.Undefined) return;
|
||||
|
||||
if (world.FrameNumber % 50 == 1 && chinookHusk.IsInWorld)
|
||||
world.Add(new Smoke(world, chinookHusk.CenterLocation, "smoke_m"));
|
||||
world.Add(new Smoke(world, chinookHusk.CenterPosition, "smoke_m"));
|
||||
|
||||
if (world.FrameNumber == 1)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA
|
||||
!self.World.FogObscures(new CPos(position)))
|
||||
{
|
||||
var offset = info.Offset.Rotate(coords.QuantizeOrientation(self, self.Orientation));
|
||||
var pos = PPos.FromWPosHackZ(position + coords.LocalToWorld(offset));
|
||||
var pos = position + coords.LocalToWorld(offset);
|
||||
self.World.AddFrameEndTask(w => w.Add(new Smoke(w, pos, info.Sprite)));
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA
|
||||
public void AddSmudge(CPos loc)
|
||||
{
|
||||
if (Game.CosmeticRandom.Next(0,100) <= Info.SmokePercentage)
|
||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, Traits.Util.CenterOfCell(loc), Info.SmokeType)));
|
||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, loc.CenterPosition, Info.SmokeType)));
|
||||
|
||||
// No smudge; create a new one
|
||||
if (!tiles.ContainsKey(loc))
|
||||
|
||||
Reference in New Issue
Block a user