Split tileset artwork loading out of TileSet.
This simplifies terrain loading and allows for non-square tiles in game. The editor still relies on the old code for now.
This commit is contained in:
@@ -113,7 +113,7 @@ namespace OpenRA.FileFormats
|
||||
foreach (var t in Templates)
|
||||
if (t.Value.Data == null)
|
||||
using (var s = FileSystem.OpenWithExts(t.Value.Image, Extensions))
|
||||
t.Value.Data = new Terrain(s, TileSize);
|
||||
t.Value.Data = new Terrain(s);
|
||||
}
|
||||
|
||||
public void Save(string filepath)
|
||||
@@ -144,23 +144,6 @@ namespace OpenRA.FileFormats
|
||||
root.WriteToFile(filepath);
|
||||
}
|
||||
|
||||
public byte[] GetBytes(TileReference<ushort,byte> r)
|
||||
{
|
||||
TileTemplate tile;
|
||||
if (Templates.TryGetValue(r.type, out tile))
|
||||
{
|
||||
var data = tile.Data.TileBitmapBytes[r.index];
|
||||
if (data != null)
|
||||
return data;
|
||||
}
|
||||
|
||||
byte[] missingTile = new byte[TileSize*TileSize];
|
||||
for (var i = 0; i < missingTile.Length; i++)
|
||||
missingTile[i] = 0x00;
|
||||
|
||||
return missingTile;
|
||||
}
|
||||
|
||||
public string GetTerrainType(TileReference<ushort, byte> r)
|
||||
{
|
||||
var tt = Templates[r.type].Tiles;
|
||||
|
||||
Reference in New Issue
Block a user