diff --git a/OpenRA.FileFormats/Map/PlayerReference.cs b/OpenRA.FileFormats/Map/PlayerReference.cs index 3bec03233b..95e64c20e6 100644 --- a/OpenRA.FileFormats/Map/PlayerReference.cs +++ b/OpenRA.FileFormats/Map/PlayerReference.cs @@ -27,8 +27,8 @@ namespace OpenRA.FileFormats public string Race; public bool LockColor = false; - [Obsolete] public Color Color = Color.FromArgb(238,238,238); - [Obsolete] public Color Color2 = Color.FromArgb(44,28,24); + public Color Color = Color.FromArgb(238,238,238); + public Color Color2 = Color.FromArgb(44,28,24); public ColorRamp ColorRamp = new ColorRamp(75, 255, 180, 25); public int InitialCash = 0; diff --git a/OpenRA.Game/Map.cs b/OpenRA.Game/Map.cs index 4598a9934f..16db93569f 100644 --- a/OpenRA.Game/Map.cs +++ b/OpenRA.Game/Map.cs @@ -139,6 +139,7 @@ namespace OpenRA } break; case 3: + case 4: { foreach (var kv in yaml.NodesDict["Players"].NodesDict) { @@ -168,7 +169,16 @@ namespace OpenRA }; Players.Add(p.Name, p); } - } + } + + // Color1/Color2 -> ColorRamp + if (MapFormat == 3) + foreach (var mp in Players) + mp.Value.ColorRamp = new ColorRamp( + (byte)((mp.Value.Color.GetHue() / 360.0f) * 255), + (byte)(mp.Value.Color.GetSaturation() * 255), + (byte)(mp.Value.Color.GetBrightness() * 255), + (byte)(mp.Value.Color2.GetBrightness() * 255)); // Smudges foreach (var kv in yaml.NodesDict["Smudges"].NodesDict) @@ -198,7 +208,7 @@ namespace OpenRA { Console.WriteLine("Saving map to path {0}",toPath); // Todo: save to a zip file in the support dir by default - MapFormat = 3; + MapFormat = 4; var root = new List(); foreach (var field in new string[] {"Selectable", "MapFormat", "Title", "Description", "Author", "PlayerCount", "Tileset", "MapSize", "TopLeft", "BottomRight", "UseAsShellmap", "Type"})