Merge pull request #8474 from pchote/remove-shroud-tests
Remove region assumptions from fast shroud tests
This commit is contained in:
@@ -30,7 +30,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
readonly bool startsRevealed;
|
||||
readonly MPos[] footprint;
|
||||
readonly CellRegion footprintRegion;
|
||||
|
||||
readonly Lazy<IToolTip> tooltip;
|
||||
readonly Lazy<Health> health;
|
||||
@@ -46,7 +45,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
startsRevealed = info.StartsRevealed && !init.Contains<ParentActorInit>();
|
||||
var footprintCells = FootprintUtils.Tiles(init.Self).ToList();
|
||||
footprint = footprintCells.Select(cell => cell.ToMPos(init.World.Map)).ToArray();
|
||||
footprintRegion = CellRegion.BoundingRegion(init.World.Map.TileShape, footprintCells);
|
||||
tooltip = Exts.Lazy(() => init.Self.TraitsImplementing<IToolTip>().FirstOrDefault());
|
||||
health = Exts.Lazy(() => init.Self.TraitOrDefault<Health>());
|
||||
|
||||
@@ -71,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
FrozenActor frozenActor;
|
||||
if (!initialized)
|
||||
{
|
||||
frozen[player] = frozenActor = new FrozenActor(self, footprint, footprintRegion, player.Shroud);
|
||||
frozen[player] = frozenActor = new FrozenActor(self, footprint, player.Shroud);
|
||||
frozen[player].NeedRenderables = frozenActor.NeedRenderables = startsRevealed;
|
||||
player.PlayerActor.Trait<FrozenActorLayer>().Add(frozenActor);
|
||||
isVisible = visible[player] |= startsRevealed;
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
Dirty.Clear();
|
||||
|
||||
foreach (var uv in wr.Viewport.VisibleCells.MapCoords)
|
||||
foreach (var uv in wr.Viewport.AllVisibleCells.MapCoords)
|
||||
{
|
||||
var t = Tiles[uv];
|
||||
if (t.Sprite != null)
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var layer = pair.Value;
|
||||
|
||||
// Only render quads in viewing range:
|
||||
foreach (var cell in wr.Viewport.VisibleCells)
|
||||
foreach (var cell in wr.Viewport.VisibleCellsInsideBounds)
|
||||
{
|
||||
if (layer[cell] <= 0)
|
||||
continue;
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void Render(WorldRenderer wr)
|
||||
{
|
||||
var shroudObscured = world.ShroudObscuresTest(wr.Viewport.VisibleCells);
|
||||
foreach (var uv in wr.Viewport.VisibleCells.MapCoords)
|
||||
var shroudObscured = world.ShroudObscuresTest;
|
||||
foreach (var uv in wr.Viewport.VisibleCellsInsideBounds.MapCoords)
|
||||
{
|
||||
if (shroudObscured(uv))
|
||||
continue;
|
||||
|
||||
@@ -189,8 +189,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (fogSprites.Any(s => s.BlendMode != fogBlend))
|
||||
throw new InvalidDataException("Fog sprites must all use the same blend mode.");
|
||||
|
||||
shroudLayer = new TerrainSpriteLayer(w, wr, shroudSheet, shroudBlend, wr.Palette(info.ShroudPalette));
|
||||
fogLayer = new TerrainSpriteLayer(w, wr, fogSheet, fogBlend, wr.Palette(info.FogPalette));
|
||||
shroudLayer = new TerrainSpriteLayer(w, wr, shroudSheet, shroudBlend, wr.Palette(info.ShroudPalette), false);
|
||||
fogLayer = new TerrainSpriteLayer(w, wr, fogSheet, fogBlend, wr.Palette(info.FogPalette), false);
|
||||
}
|
||||
|
||||
Edges GetEdges(MPos uv, Func<MPos, bool> isVisible)
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var kv in tiles)
|
||||
{
|
||||
if (!wr.Viewport.VisibleCells.Contains(kv.Key))
|
||||
if (!wr.Viewport.VisibleCellsInsideBounds.Contains(kv.Key))
|
||||
continue;
|
||||
|
||||
if (world.ShroudObscures(kv.Key))
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var colors = wr.World.TileSet.HeightDebugColors;
|
||||
var mouseCell = wr.Viewport.ViewToWorld(Viewport.LastMousePos).ToMPos(wr.World.Map);
|
||||
|
||||
foreach (var uv in wr.Viewport.VisibleCells.MapCoords)
|
||||
foreach (var uv in wr.Viewport.VisibleCellsInsideBounds.MapCoords)
|
||||
{
|
||||
var height = (int)map.MapHeight.Value[uv];
|
||||
var tile = map.MapTiles.Value[uv];
|
||||
|
||||
@@ -122,6 +122,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
void UpdateShroudCell(CPos cell)
|
||||
{
|
||||
if (!world.Map.Contains(cell))
|
||||
return;
|
||||
|
||||
var stride = radarSheet.Size.Width;
|
||||
var uv = cell.ToMPos(world.Map);
|
||||
var dx = shroudSprite.Bounds.Left - world.Map.Bounds.Left;
|
||||
|
||||
Reference in New Issue
Block a user