Allow tilesets to specify their sheet size.

Decreased the default size from 4096 to 512.
This commit is contained in:
Paul Chote
2013-08-15 18:05:34 +12:00
parent f83ad88d2a
commit 7278739e45
3 changed files with 5 additions and 4 deletions

View File

@@ -77,6 +77,7 @@ namespace OpenRA.FileFormats
{ {
public string Name; public string Name;
public string Id; public string Id;
public int SheetSize = 512;
public string Palette; public string Palette;
public string PlayerPalette; public string PlayerPalette;
public string[] Extensions; public string[] Extensions;
@@ -85,7 +86,7 @@ namespace OpenRA.FileFormats
public Dictionary<ushort, TileTemplate> Templates = new Dictionary<ushort, TileTemplate>(); public Dictionary<ushort, TileTemplate> Templates = new Dictionary<ushort, TileTemplate>();
public string[] EditorTemplateOrder; public string[] EditorTemplateOrder;
static readonly string[] fields = {"Name", "TileSize", "Id", "Palette", "Extensions"}; static readonly string[] fields = {"Name", "TileSize", "Id", "SheetSize", "Palette", "Extensions"};
public TileSet() {} public TileSet() {}

View File

@@ -42,11 +42,10 @@ namespace OpenRA.Graphics
Func<Sheet> allocate = () => Func<Sheet> allocate = () =>
{ {
if (allocated) if (allocated)
throw new SheetOverflowException("Terrain sheet overflow"); throw new SheetOverflowException("Terrain sheet overflow. Try increasing the tileset SheetSize parameter.");
allocated = true; allocated = true;
// TODO: Use a fixed sheet size specified in the tileset yaml return new Sheet(new Size(tileset.SheetSize, tileset.SheetSize));
return SheetBuilder.AllocateSheet();
}; };
templates = new Dictionary<ushort, Sprite[]>(); templates = new Dictionary<ushort, Sprite[]>();

View File

@@ -1,6 +1,7 @@
General: General:
Name: Arrakis Name: Arrakis
Id: ARRAKIS Id: ARRAKIS
SheetSize: 1024
Palette: d2k.pal Palette: d2k.pal
Extensions: .bas,.bat,.bgb,.ice,.tre,.was,.ext,.shp Extensions: .bas,.bat,.bgb,.ice,.tre,.was,.ext,.shp