diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index a048d8a00d..ab813ad194 100644 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; @@ -387,26 +387,12 @@ namespace OpenRA.Editor { var map = new Map(); - map.MapSize = new int2(1, 1); - map.MapResources = new TileReference[1, 1]; - map.MapTiles = new TileReference[1, 1] - { { new TileReference { - type = currentMod == "cnc" ? (ushort)0xffu : (ushort)0xffffu, - image = (byte)0xffu, - index = (byte)0xffu } } }; - map.Resize((int)nmd.width.Value, (int)nmd.height.Value); - map.PlayerCount = 8; - map.TopLeft = new int2((int)nmd.cordonLeft.Value, (int)nmd.cordonTop.Value); map.BottomRight = new int2((int)nmd.cordonRight.Value, (int)nmd.cordonBottom.Value); - map.Tileset = nmd.theater.SelectedItem as string; - map.Title = "Name your map here"; - map.Description = "Describe your map here"; - map.Author = "Your name here"; NewMap(map); } diff --git a/OpenRA.FileFormats/Map/Map.cs b/OpenRA.FileFormats/Map/Map.cs index 6b91d99a0f..367c77f24a 100644 --- a/OpenRA.FileFormats/Map/Map.cs +++ b/OpenRA.FileFormats/Map/Map.cs @@ -79,7 +79,27 @@ namespace OpenRA.FileFormats "Selectable", "MapFormat", "Title", "Description", "Author", "PlayerCount", "Tileset", "MapSize", "TopLeft", "BottomRight" }; - public Map() { } + public Map() + { + MapSize = new int2(1, 1); + MapResources = new TileReference[1, 1]; + MapTiles = new TileReference[1, 1] + { { new TileReference { + type = (ushort)0xffffu, + image = (byte)0xffu, + index = (byte)0xffu } } }; + + PlayerCount = 0; + TopLeft = new int2(0,0); + BottomRight = new int2(0,0); + + Tileset = "TEMPERAT"; + Players.Add("Neutral", new PlayerReference("Neutral", "neutral", "allies", true, true)); + + Title = "Name your map here"; + Description = "Describe your map here"; + Author = "Your name here"; + } public Map(IFolder package) { @@ -94,23 +114,43 @@ namespace OpenRA.FileFormats { string[] loc = wp.Value.Value.Split(','); Waypoints.Add(wp.Key, new int2(int.Parse(loc[0]), int.Parse(loc[1]))); - } + } - // Players - foreach (var kv in yaml["Players"].Nodes) + // Players + if (MapFormat < 2) { - var player = new PlayerReference(kv.Value); - Players.Add(player.Name, player); + Players.Add("Neutral", new PlayerReference("Neutral", "neutral", "allies", true, true)); + } + else + { + foreach (var kv in yaml["Players"].Nodes) + { + var player = new PlayerReference(kv.Value); + Players.Add(player.Name, player); + } } // Actors - foreach (var kv in yaml["Actors"].Nodes) - { - string[] vals = kv.Value.Value.Split(' '); - string[] loc = vals[2].Split(','); - var a = new ActorReference(vals[0], new int2(int.Parse(loc[0]), int.Parse(loc[1])), vals[1]); - Actors.Add(kv.Key, a); - } + if (MapFormat == 1 ) + { + foreach (var kv in yaml["Actors"].Nodes) + { + string[] vals = kv.Value.Value.Split(' '); + string[] loc = vals[2].Split(','); + var a = new ActorReference(vals[0], new int2(int.Parse(loc[0]), int.Parse(loc[1])), "Neutral"); + Actors.Add(kv.Key, a); + } + } + else + { + foreach (var kv in yaml["Actors"].Nodes) + { + string[] vals = kv.Value.Value.Split(' '); + string[] loc = vals[2].Split(','); + var a = new ActorReference(vals[0], new int2(int.Parse(loc[0]), int.Parse(loc[1])), vals[1]); + Actors.Add(kv.Key, a); + } + } // Smudges foreach (var kv in yaml["Smudges"].Nodes) @@ -129,6 +169,8 @@ namespace OpenRA.FileFormats public void Save(string filepath) { + MapFormat = 2; + Dictionary root = new Dictionary(); foreach (var field in SimpleFields) { diff --git a/OpenRA.FileFormats/Map/PlayerReference.cs b/OpenRA.FileFormats/Map/PlayerReference.cs index 53ff1d5911..dde221c2df 100644 --- a/OpenRA.FileFormats/Map/PlayerReference.cs +++ b/OpenRA.FileFormats/Map/PlayerReference.cs @@ -32,5 +32,14 @@ namespace OpenRA.FileFormats { FieldLoader.Load(this, my); } + + public PlayerReference(string name, string palette, string race, bool ownsworld, bool noncombatant) + { + Name = name; + Palette = palette; + Race = race; + OwnsWorld = ownsworld; + NonCombatant = noncombatant; + } } } diff --git a/mods/cnc/tileSet.til b/mods/cnc/tileSet.til index 6ae974d4ad..322814807b 100644 --- a/mods/cnc/tileSet.til +++ b/mods/cnc/tileSet.til @@ -1,7 +1,13 @@ ; clear ground DTW 1 -ff +00ff +clear1 + +; clear ground +DTW +1 +ffff clear1 ; clear ground