Replace IOrderGenerator.RenderBeforeWorld with world-sorted .Render.
Range circles have been moved to RenderAfterWorld for now.
This commit is contained in:
@@ -77,8 +77,11 @@ namespace OpenRA.Graphics
|
||||
bounds.TopLeftAsCPos(),
|
||||
bounds.BottomRightAsCPos());
|
||||
|
||||
var worldRenderables = actors.SelectMany(a => a.Render(this))
|
||||
.OrderBy(r => r, comparer);
|
||||
var worldRenderables = actors.SelectMany(a => a.Render(this));
|
||||
if (world.OrderGenerator != null)
|
||||
worldRenderables = worldRenderables.Concat(world.OrderGenerator.Render(this, world));
|
||||
|
||||
worldRenderables = worldRenderables.OrderBy(r => r, comparer);
|
||||
|
||||
// Effects are drawn on top of all actors
|
||||
// TODO: Allow effects to be interleaved with actors
|
||||
@@ -112,16 +115,8 @@ namespace OpenRA.Graphics
|
||||
foreach (var r in a.Trait.RenderAsTerrain(this, a.Actor))
|
||||
r.Render(this);
|
||||
|
||||
foreach (var a in world.Selection.Actors)
|
||||
if (!a.Destroyed)
|
||||
foreach (var t in a.TraitsImplementing<IPreRenderSelection>())
|
||||
t.RenderBeforeWorld(this, a);
|
||||
|
||||
Game.Renderer.Flush();
|
||||
|
||||
if (world.OrderGenerator != null)
|
||||
world.OrderGenerator.RenderBeforeWorld(this, world);
|
||||
|
||||
for (var i = 0; i < renderables.Count; i++)
|
||||
renderables[i].Render(this);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region Copyright & License Information
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Orders
|
||||
}
|
||||
|
||||
public virtual void Tick(World world) { }
|
||||
public void RenderBeforeWorld(WorldRenderer wr, World world) { }
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, World world) { yield break; }
|
||||
public void RenderAfterWorld(WorldRenderer wr, World world) { }
|
||||
public string GetCursor(World world, CPos xy, MouseInput mi) { return world.Map.IsInMap(xy) ? cursor : "generic-blocked"; }
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA
|
||||
{
|
||||
IEnumerable<Order> Order(World world, CPos xy, MouseInput mi);
|
||||
void Tick(World world);
|
||||
void RenderBeforeWorld(WorldRenderer wr, World world);
|
||||
IEnumerable<IRenderable> Render(WorldRenderer wr, World world);
|
||||
void RenderAfterWorld(WorldRenderer wr, World world);
|
||||
string GetCursor(World world, CPos xy, MouseInput mi);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Orders
|
||||
}
|
||||
|
||||
public void Tick(World world) { }
|
||||
public void RenderBeforeWorld(WorldRenderer wr, World world) { }
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, World world) { yield break; }
|
||||
public void RenderAfterWorld(WorldRenderer wr, World world) { }
|
||||
|
||||
public string GetCursor(World world, CPos xy, MouseInput mi)
|
||||
|
||||
@@ -187,7 +187,6 @@ namespace OpenRA.Traits
|
||||
public interface IPostRender { void RenderAfterWorld(WorldRenderer wr, Actor self); }
|
||||
|
||||
public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr); }
|
||||
public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); }
|
||||
public interface IRenderAsTerrain { IEnumerable<IRenderable> RenderAsTerrain(WorldRenderer wr, Actor self); }
|
||||
public interface IBodyOrientation
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user