Custom tilesize support for editor
This commit is contained in:
@@ -19,13 +19,16 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
public Terrain( Stream stream, int size )
|
public Terrain( Stream stream, int size )
|
||||||
{
|
{
|
||||||
|
System.Console.WriteLine("Loading tile with expected size {0}",size);
|
||||||
// Try loading as a cnc .tem
|
// Try loading as a cnc .tem
|
||||||
BinaryReader reader = new BinaryReader( stream );
|
BinaryReader reader = new BinaryReader( stream );
|
||||||
int Width = reader.ReadUInt16();
|
int Width = reader.ReadUInt16();
|
||||||
int Height = reader.ReadUInt16();
|
int Height = reader.ReadUInt16();
|
||||||
|
|
||||||
|
System.Console.WriteLine("Actual size {0}x{1}",Width,Height);
|
||||||
|
|
||||||
if( Width != size || Height != size )
|
if( Width != size || Height != size )
|
||||||
throw new InvalidDataException( string.Format( "Expected tile of size {0}x{1}, got {1}x{2]", size, size, Width, Height ) );
|
throw new InvalidDataException( "Expected tile of size {0}x{0}, got {1}x{2]".F(size, Width, Height ) );
|
||||||
|
|
||||||
/*NumTiles = */reader.ReadUInt16();
|
/*NumTiles = */reader.ReadUInt16();
|
||||||
/*Zero1 = */reader.ReadUInt16();
|
/*Zero1 = */reader.ReadUInt16();
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace OpenRA.FileFormats
|
|||||||
public string Name;
|
public string Name;
|
||||||
public string Id;
|
public string Id;
|
||||||
public string Palette;
|
public string Palette;
|
||||||
public int TileSize = 24;
|
public int TileSize;
|
||||||
public string[] Extensions;
|
public string[] Extensions;
|
||||||
public Dictionary<string, TerrainTypeInfo> Terrain = new Dictionary<string, TerrainTypeInfo>();
|
public Dictionary<string, TerrainTypeInfo> Terrain = new Dictionary<string, TerrainTypeInfo>();
|
||||||
public Dictionary<ushort, Terrain> Tiles = new Dictionary<ushort, Terrain>();
|
public Dictionary<ushort, Terrain> Tiles = new Dictionary<ushort, Terrain>();
|
||||||
@@ -111,13 +111,6 @@ namespace OpenRA.FileFormats
|
|||||||
public void Save(string filepath)
|
public void Save(string filepath)
|
||||||
{
|
{
|
||||||
var root = new List<MiniYamlNode>();
|
var root = new List<MiniYamlNode>();
|
||||||
foreach (var field in fields)
|
|
||||||
{
|
|
||||||
FieldInfo f = this.GetType().GetField(field);
|
|
||||||
if (f.GetValue(this) == null) continue;
|
|
||||||
root.Add( new MiniYamlNode( field, FieldSaver.FormatValue( this, f ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
var gen = new List<MiniYamlNode>();
|
var gen = new List<MiniYamlNode>();
|
||||||
foreach (var field in fields)
|
foreach (var field in fields)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,14 +23,13 @@ namespace OpenRA.TilesetBuilder
|
|||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
string srcfile;
|
string srcfile;
|
||||||
int TileSize;
|
int size;
|
||||||
public Form1( string src, int size )
|
public Form1( string src, int size )
|
||||||
{
|
{
|
||||||
srcfile = src;
|
srcfile = src;
|
||||||
TileSize = size;
|
this.size = size;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
surface1.TileSize = size;
|
||||||
surface1.TileSize = TileSize;
|
|
||||||
surface1.Image = (Bitmap)Image.FromFile(src);
|
surface1.Image = (Bitmap)Image.FromFile(src);
|
||||||
surface1.TerrainTypes = new int[surface1.Image.Width / size, surface1.Image.Height / size]; /* all passable by default */
|
surface1.TerrainTypes = new int[surface1.Image.Width / size, surface1.Image.Height / size]; /* all passable by default */
|
||||||
surface1.Templates = new List<Template>();
|
surface1.Templates = new List<Template>();
|
||||||
@@ -125,7 +124,7 @@ namespace OpenRA.TilesetBuilder
|
|||||||
{
|
{
|
||||||
Name = "Arrakis",
|
Name = "Arrakis",
|
||||||
Id = "ARRAKIS",
|
Id = "ARRAKIS",
|
||||||
TileSize = this.TileSize,
|
TileSize = size,
|
||||||
Palette = "arrakis.pal",
|
Palette = "arrakis.pal",
|
||||||
Extensions = new string[] {".arr", ".shp"}
|
Extensions = new string[] {".arr", ".shp"}
|
||||||
};
|
};
|
||||||
@@ -194,6 +193,7 @@ namespace OpenRA.TilesetBuilder
|
|||||||
|
|
||||||
string ExportTemplate(Template t, int n, string suffix, string dir)
|
string ExportTemplate(Template t, int n, string suffix, string dir)
|
||||||
{
|
{
|
||||||
|
var TileSize = size;
|
||||||
var filename = Path.Combine(dir, "t{0:00}{1}".F(n, suffix));
|
var filename = Path.Combine(dir, "t{0:00}{1}".F(n, suffix));
|
||||||
var totalTiles = t.Width * t.Height;
|
var totalTiles = t.Width * t.Height;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
c7bc5cded5f9b67bc678ca92b9d690fb71ae2ee2
|
29478a3e83e2b63ba694487e5ac8adf2ee6e1be2
|
||||||
@@ -2,21 +2,21 @@ Selectable: True
|
|||||||
|
|
||||||
MapFormat: 3
|
MapFormat: 3
|
||||||
|
|
||||||
Title: Test Map
|
Title: Name your map here
|
||||||
|
|
||||||
Description: Describe your map here
|
Description: Describe your map here
|
||||||
|
|
||||||
Author: Your name here
|
Author: Your name here
|
||||||
|
|
||||||
PlayerCount: 3
|
PlayerCount: 1
|
||||||
|
|
||||||
Tileset: ARRAKIS
|
Tileset: ARRAKIS
|
||||||
|
|
||||||
MapSize: 64,64
|
MapSize: 128,128
|
||||||
|
|
||||||
TopLeft: 2,2
|
TopLeft: 16,16
|
||||||
|
|
||||||
BottomRight: 62,62
|
BottomRight: 112,112
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
PlayerReference@Neutral:
|
PlayerReference@Neutral:
|
||||||
@@ -34,11 +34,12 @@ Players:
|
|||||||
Enemies:
|
Enemies:
|
||||||
|
|
||||||
Actors:
|
Actors:
|
||||||
|
Actor0: mcv
|
||||||
|
Location: 16,17
|
||||||
|
Owner: Neutral
|
||||||
|
|
||||||
Waypoints:
|
Waypoints:
|
||||||
wp0: 21,11
|
wp0: 18,18
|
||||||
wp1: 51,28
|
|
||||||
wp2: 24,52
|
|
||||||
|
|
||||||
Smudges:
|
Smudges:
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user