Guess the correct sprite offset from building foundations.
This commit is contained in:
@@ -27,6 +27,7 @@ namespace OpenRA.Mods.TS.UtilityCommands
|
|||||||
public string Name { get { return "--sequence-import"; } }
|
public string Name { get { return "--sequence-import"; } }
|
||||||
|
|
||||||
IniFile file;
|
IniFile file;
|
||||||
|
MapGrid grid;
|
||||||
|
|
||||||
[Desc("FILENAME", "Convert ART.INI to the OpenRA sequence definition format.")]
|
[Desc("FILENAME", "Convert ART.INI to the OpenRA sequence definition format.")]
|
||||||
public void Run(ModData modData, string[] args)
|
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.
|
// HACK: The engine code assumes that Game.modData is set.
|
||||||
Game.ModData = modData;
|
Game.ModData = modData;
|
||||||
|
|
||||||
|
grid = Game.ModData.Manifest.Get<MapGrid>();
|
||||||
|
|
||||||
file = new IniFile(File.Open(args[1], FileMode.Open));
|
file = new IniFile(File.Open(args[1], FileMode.Open));
|
||||||
|
|
||||||
foreach (var section in file.Sections)
|
foreach (var section in file.Sections)
|
||||||
@@ -54,6 +57,21 @@ namespace OpenRA.Mods.TS.UtilityCommands
|
|||||||
|
|
||||||
Console.WriteLine("\tDefaults:");
|
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);
|
var theater = section.GetValue("Theater", string.Empty);
|
||||||
if (!string.IsNullOrEmpty(theater) && theater == "yes")
|
if (!string.IsNullOrEmpty(theater) && theater == "yes")
|
||||||
Console.WriteLine("\t\tUseTilesetExtension: true");
|
Console.WriteLine("\t\tUseTilesetExtension: true");
|
||||||
|
|||||||
Reference in New Issue
Block a user