Fix D2 shp parsing and make it a proper frame source.

This commit is contained in:
Paul Chote
2013-11-30 15:51:45 +13:00
parent 246c5e4526
commit ed163aea82
6 changed files with 159 additions and 167 deletions

View File

@@ -136,25 +136,6 @@ namespace OpenRA.Utility
Console.WriteLine("Saved {0}-[0..{1}].png", prefix, count - 1);
}
public static void ConvertFormat2ToFormat80(string[] args)
{
var src = args[1];
var dest = args[2];
Dune2ShpReader srcImage = null;
using (var s = File.OpenRead(src))
srcImage = new Dune2ShpReader(s);
var size = srcImage.First().Size;
if (!srcImage.All(im => im.Size == size))
throw new InvalidOperationException("All the frames must be the same size to convert from Dune2 to RA");
using (var destStream = File.Create(dest))
ShpReader.Write(destStream, size.Width, size.Height,
srcImage.Select(im => im.Image));
}
public static void ExtractFiles(string[] args)
{
var mod = args[1];

View File

@@ -23,7 +23,6 @@ namespace OpenRA.Utility
{ "--settings-value", Command.Settings },
{ "--shp", Command.ConvertPngToShp },
{ "--png", Command.ConvertShpToPng },
{ "--fromd2", Command.ConvertFormat2ToFormat80 },
{ "--extract", Command.ExtractFiles },
{ "--remap", Command.RemapShp },
{ "--transpose", Command.TransposeShp },
@@ -58,7 +57,6 @@ namespace OpenRA.Utility
Console.WriteLine(" --settings-value KEY Get value of KEY from settings.yaml");
Console.WriteLine(" --shp PNGFILE [PNGFILE ...] Combine a list of PNG images into a SHP");
Console.WriteLine(" --png SPRITEFILE PALETTE [--noshadow] [--nopadding] Convert a shp/tmp/R8 to a series of PNGs, optionally removing shadow");
Console.WriteLine(" --fromd2 DUNE2SHP C&CSHP Convert a Dune II SHP (C&C mouse cursor) to C&C SHP format.");
Console.WriteLine(" --extract MOD[,MOD]* FILES [--userdir] Extract files from mod packages to the current (or user) directory");
Console.WriteLine(" --remap SRCMOD:PAL DESTMOD:PAL SRCSHP DESTSHP Remap SHPs to another palette");
Console.WriteLine(" --transpose SRCSHP DESTSHP START N M [START N M ...] Transpose the N*M block of frames starting at START.");