diff --git a/OpenRA.Game/Graphics/Theater.cs b/OpenRA.Game/Graphics/Theater.cs index 7e3e614c60..02589fb638 100644 --- a/OpenRA.Game/Graphics/Theater.cs +++ b/OpenRA.Game/Graphics/Theater.cs @@ -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 diff --git a/OpenRA.Game/Map/TileSet.cs b/OpenRA.Game/Map/TileSet.cs index b9a10ef656..f26da12774 100644 --- a/OpenRA.Game/Map/TileSet.cs +++ b/OpenRA.Game/Map/TileSet.cs @@ -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 Templates = new Dictionary(); public readonly string[] EditorTemplateOrder; + public readonly bool IgnoreTileSpriteOffsets; public readonly TerrainTypeInfo[] TerrainInfo; readonly Dictionary terrainIndexByType = new Dictionary(); diff --git a/mods/d2k/tilesets/arrakis.yaml b/mods/d2k/tilesets/arrakis.yaml index 24d85e4a7f..3e61c5504f 100644 --- a/mods/d2k/tilesets/arrakis.yaml +++ b/mods/d2k/tilesets/arrakis.yaml @@ -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