Make terrain tiles ISpriteSources.

This commit is contained in:
Paul Chote
2013-11-30 09:28:03 +13:00
parent f92ce8bf51
commit e4fe2b49f4
7 changed files with 161 additions and 87 deletions

View File

@@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
namespace OpenRA.FileFormats
@@ -33,7 +34,22 @@ namespace OpenRA.FileFormats
}
using (var s = FileSystem.OpenWithExts(filename, exts))
return new Terrain(s).TileBitmapBytes;
{
var type = SpriteSource.DetectSpriteType(s);
ISpriteSource source;
switch (type)
{
case SpriteType.TmpTD:
source = new TmpTDReader(s);
break;
case SpriteType.TmpRA:
source = new TmpRAReader(s);
break;
default:
throw new InvalidDataException(filename + " is not a valid terrain tile");
}
return source.Frames.Select(f => f.Data).ToList();
}
}
public TileSetRenderer(TileSet tileset, Size tileSize)