Allow mods to customise the default rendering scale.

This commit is contained in:
Paul Chote
2022-12-22 08:40:59 +13:00
committed by Matthias Mailänder
parent e21f94f36a
commit 6d438a9d61
8 changed files with 59 additions and 50 deletions

View File

@@ -177,10 +177,10 @@ namespace OpenRA.Mods.Common.Traits
var sprite = tileCache.TileSprite(tile, 0);
var u = gridType == MapGridType.Rectangular ? x : (x - y) / 2f;
var v = gridType == MapGridType.Rectangular ? y : (x + y) / 2f;
var offset = (new float2(u * ts.Width, (v - 0.5f * tileInfo.Height) * ts.Height) - 0.5f * sprite.Size.XY).ToInt2();
var offset = scale * (new float2(u * ts.Width, (v - 0.5f * tileInfo.Height) * ts.Height) - 0.5f * sprite.Size.XY);
var palette = template.Palette ?? terrainInfo.Palette;
yield return new UISpriteRenderable(sprite, WPos.Zero, origin + offset, 0, wr.Palette(palette), scale);
yield return new UISpriteRenderable(sprite, WPos.Zero, origin + offset.ToInt2(), 0, wr.Palette(palette), scale);
}
}
}