Made projectile shadows heightmap-aware.

This commit is contained in:
reaperrr
2015-08-03 23:36:16 +02:00
parent d1375a224f
commit efc7915f4f
3 changed files with 12 additions and 6 deletions

View File

@@ -177,11 +177,13 @@ namespace OpenRA.Mods.Common.Effects
if (anim == null || ticks >= length) if (anim == null || ticks >= length)
yield break; yield break;
if (!args.SourceActor.World.FogObscures(pos)) var world = args.SourceActor.World;
if (!world.FogObscures(pos))
{ {
if (info.Shadow) if (info.Shadow)
{ {
var shadowPos = pos - new WVec(0, 0, pos.Z); var dat = world.Map.DistanceAboveTerrain(pos);
var shadowPos = pos - new WVec(0, 0, dat.Length);
foreach (var r in anim.Render(shadowPos, wr.Palette(info.ShadowPalette))) foreach (var r in anim.Render(shadowPos, wr.Palette(info.ShadowPalette)))
yield return r; yield return r;
} }

View File

@@ -84,11 +84,13 @@ namespace OpenRA.Mods.Common.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr) public IEnumerable<IRenderable> Render(WorldRenderer wr)
{ {
if (!args.SourceActor.World.FogObscures(pos)) var world = args.SourceActor.World;
if (!world.FogObscures(pos))
{ {
if (info.Shadow) if (info.Shadow)
{ {
var shadowPos = pos - new WVec(0, 0, pos.Z); var dat = world.Map.DistanceAboveTerrain(pos);
var shadowPos = pos - new WVec(0, 0, dat.Length);
foreach (var r in anim.Render(shadowPos, wr.Palette("shadow"))) foreach (var r in anim.Render(shadowPos, wr.Palette("shadow")))
yield return r; yield return r;
} }

View File

@@ -227,11 +227,13 @@ namespace OpenRA.Mods.Common.Effects
if (info.ContrailLength > 0) if (info.ContrailLength > 0)
yield return contrail; yield return contrail;
if (!args.SourceActor.World.FogObscures(pos)) var world = args.SourceActor.World;
if (!world.FogObscures(pos))
{ {
if (info.Shadow) if (info.Shadow)
{ {
var shadowPos = new WPos(pos.X, pos.Y, 0); var dat = world.Map.DistanceAboveTerrain(pos);
var shadowPos = new WPos(pos.X, pos.Y, dat.Length);
foreach (var r in anim.Render(shadowPos, wr.Palette("shadow"))) foreach (var r in anim.Render(shadowPos, wr.Palette("shadow")))
yield return r; yield return r;
} }