Include additional preview to prevent cutoff.

Fun fact: The original TS sidestepped this issue
by rendering everything outside the cordon, which
looks much worse than what we do here.
This commit is contained in:
Paul Chote
2015-07-28 22:55:16 +01:00
parent af69370c17
commit 54a80ed035

View File

@@ -22,8 +22,12 @@ namespace OpenRA.Graphics
{ {
var isDiamond = map.TileShape == TileShape.Diamond; var isDiamond = map.TileShape == TileShape.Diamond;
var b = map.Bounds; var b = map.Bounds;
// Fudge the heightmap offset by adding as much extra as we need / can.
// This tries to correct for our incorrect assumption that MPos == PPos
var heightOffset = Math.Min(map.MaximumTerrainHeight, map.MapSize.Y - b.Bottom);
var width = b.Width; var width = b.Width;
var height = b.Height; var height = b.Height + heightOffset;
var bitmapWidth = width; var bitmapWidth = width;
if (isDiamond) if (isDiamond)
@@ -59,7 +63,8 @@ namespace OpenRA.Graphics
if (x + dx > 0) if (x + dx > 0)
colors[y * stride + 2 * x + dx - 1] = leftColor.ToArgb(); colors[y * stride + 2 * x + dx - 1] = leftColor.ToArgb();
colors[y * stride + 2 * x + dx] = rightColor.ToArgb(); if (2 * x + dx < stride)
colors[y * stride + 2 * x + dx] = rightColor.ToArgb();
} }
else else
colors[y * stride + x] = leftColor.ToArgb(); colors[y * stride + x] = leftColor.ToArgb();
@@ -78,8 +83,12 @@ namespace OpenRA.Graphics
var terrain = new Bitmap(terrainBitmap); var terrain = new Bitmap(terrainBitmap);
var isDiamond = map.TileShape == TileShape.Diamond; var isDiamond = map.TileShape == TileShape.Diamond;
var b = map.Bounds; var b = map.Bounds;
// Fudge the heightmap offset by adding as much extra as we need / can
// This tries to correct for our incorrect assumption that MPos == PPos
var heightOffset = Math.Min(map.MaximumTerrainHeight, map.MapSize.Y - b.Bottom);
var width = b.Width; var width = b.Width;
var height = b.Height; var height = b.Height + heightOffset;
var resources = resourceRules.Actors["world"].Traits.WithInterface<ResourceTypeInfo>() var resources = resourceRules.Actors["world"].Traits.WithInterface<ResourceTypeInfo>()
.ToDictionary(r => r.ResourceType, r => r.TerrainType); .ToDictionary(r => r.ResourceType, r => r.TerrainType);
@@ -111,7 +120,8 @@ namespace OpenRA.Graphics
if (x + dx > 0) if (x + dx > 0)
colors[y * stride + 2 * x + dx - 1] = color; colors[y * stride + 2 * x + dx - 1] = color;
colors[y * stride + 2 * x + dx] = color; if (2 * x + dx < stride)
colors[y * stride + 2 * x + dx] = color;
} }
else else
colors[y * stride + x] = color; colors[y * stride + x] = color;