From a7fa5e9fe1c502d38520c8897c7155b41ce0a6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 31 May 2016 22:14:23 +0200 Subject: [PATCH] Guess the correct sprite offset from building foundations. --- .../UtilityCommands/LegacySequenceImporter.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/OpenRA.Mods.TS/UtilityCommands/LegacySequenceImporter.cs b/OpenRA.Mods.TS/UtilityCommands/LegacySequenceImporter.cs index aab43e75f1..29018ef6ab 100644 --- a/OpenRA.Mods.TS/UtilityCommands/LegacySequenceImporter.cs +++ b/OpenRA.Mods.TS/UtilityCommands/LegacySequenceImporter.cs @@ -27,6 +27,7 @@ namespace OpenRA.Mods.TS.UtilityCommands public string Name { get { return "--sequence-import"; } } IniFile file; + MapGrid grid; [Desc("FILENAME", "Convert ART.INI to the OpenRA sequence definition format.")] public void Run(ModData modData, string[] args) @@ -34,6 +35,8 @@ namespace OpenRA.Mods.TS.UtilityCommands // HACK: The engine code assumes that Game.modData is set. Game.ModData = modData; + grid = Game.ModData.Manifest.Get(); + file = new IniFile(File.Open(args[1], FileMode.Open)); foreach (var section in file.Sections) @@ -54,6 +57,21 @@ namespace OpenRA.Mods.TS.UtilityCommands Console.WriteLine("\tDefaults:"); + var foundation = section.GetValue("Foundation", string.Empty); + if (!string.IsNullOrEmpty(foundation)) + { + var size = foundation.Split('x'); + if (size.Length == 2) + { + var x = int.Parse(size[0]); + var y = int.Parse(size[1]); + + var xOffset = (x - y) * grid.TileSize.Width / 4; + var yOffset = (x + y) * grid.TileSize.Height / 4; + Console.WriteLine("\t\tOffset: {0},{1}", -xOffset, -yOffset); + } + } + var theater = section.GetValue("Theater", string.Empty); if (!string.IsNullOrEmpty(theater) && theater == "yes") Console.WriteLine("\t\tUseTilesetExtension: true");