Work around the undesired R8 terrain sprite offsets.
This commit is contained in:
@@ -42,7 +42,13 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
var allFrames = frameCache[t.Value.Image];
|
||||
var frames = t.Value.Frames != null ? t.Value.Frames.Select(f => allFrames[f]).ToArray() : allFrames;
|
||||
templates.Add(t.Value.Id, frames.Select(f => sheetBuilder.Add(f)).ToArray());
|
||||
var sprites = frames.Select(f => sheetBuilder.Add(f));
|
||||
|
||||
// Ignore the offsets baked into R8 sprites
|
||||
if (tileset.IgnoreTileSpriteOffsets)
|
||||
sprites = sprites.Select(s => new Sprite(s.sheet, s.bounds, float2.Zero, s.channel, s.blendMode));
|
||||
|
||||
templates.Add(t.Value.Id, sprites.ToArray());
|
||||
}
|
||||
|
||||
// 1x1px transparent tile
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace OpenRA
|
||||
|
||||
public class TileSet
|
||||
{
|
||||
static readonly string[] Fields = { "Name", "Id", "SheetSize", "Palette", "PlayerPalette", "Extensions", "WaterPaletteRotationBase", "EditorTemplateOrder" };
|
||||
static readonly string[] Fields = { "Name", "Id", "SheetSize", "Palette", "PlayerPalette", "Extensions", "WaterPaletteRotationBase", "EditorTemplateOrder", "IgnoreTileSpriteOffsets" };
|
||||
|
||||
public readonly string Name;
|
||||
public readonly string Id;
|
||||
@@ -159,6 +159,7 @@ namespace OpenRA
|
||||
public readonly int WaterPaletteRotationBase = 0x60;
|
||||
public readonly Dictionary<ushort, TerrainTemplateInfo> Templates = new Dictionary<ushort, TerrainTemplateInfo>();
|
||||
public readonly string[] EditorTemplateOrder;
|
||||
public readonly bool IgnoreTileSpriteOffsets;
|
||||
|
||||
public readonly TerrainTypeInfo[] TerrainInfo;
|
||||
readonly Dictionary<string, byte> terrainIndexByType = new Dictionary<string, byte>();
|
||||
|
||||
@@ -5,6 +5,7 @@ General:
|
||||
Palette: d2k.pal
|
||||
Extensions: .R8, .r8, .shp, .tmp
|
||||
EditorTemplateOrder: Basic, Dune, Sand-Detail, Brick, Sand-Cliff, Sand-Smooth, Cliff-Type-Changer, Rock-Sand-Smooth, Rock-Detail, Rock-Cliff, Rock-Cliff-Rock, Rotten-Base, Dead-Worm, Ice, Ice-Detail, Rock-Cliff-Sand, Sand-Platform, Unidentified
|
||||
IgnoreTileSpriteOffsets: true
|
||||
|
||||
Terrain:
|
||||
TerrainType@Clear: # TODO: workaround for the stupid WinForms editor
|
||||
|
||||
Reference in New Issue
Block a user