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