diff --git a/OpenRA.Server/Server.cs b/OpenRA.Server/Server.cs index a2f7b1661e..3423c4ac93 100644 --- a/OpenRA.Server/Server.cs +++ b/OpenRA.Server/Server.cs @@ -302,7 +302,7 @@ namespace OpenRA.Server } int pali; - if (!int.TryParse(s, out pali) || pali < 0 || pali > 7) + if (!int.TryParse(s, out pali)) { Console.WriteLine("Invalid palette: {0}", s); return false; diff --git a/OpenRa.sln b/OpenRa.sln index 3b35fb71cd..31dd838bcd 100644 --- a/OpenRa.sln +++ b/OpenRa.sln @@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Mods.Cnc", "OpenRa.M EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Gl", "OpenRa.Gl\OpenRa.Gl.csproj", "{67CF1A10-C5F6-48FA-B1A7-FE83BE4CE2CC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mkremap", "mkremap\mkremap.csproj", "{3A2C18E7-0379-4D72-8A56-B850CB765197}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -54,6 +56,10 @@ Global {67CF1A10-C5F6-48FA-B1A7-FE83BE4CE2CC}.Debug|Any CPU.Build.0 = Debug|Any CPU {67CF1A10-C5F6-48FA-B1A7-FE83BE4CE2CC}.Release|Any CPU.ActiveCfg = Release|Any CPU {67CF1A10-C5F6-48FA-B1A7-FE83BE4CE2CC}.Release|Any CPU.Build.0 = Release|Any CPU + {3A2C18E7-0379-4D72-8A56-B850CB765197}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A2C18E7-0379-4D72-8A56-B850CB765197}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A2C18E7-0379-4D72-8A56-B850CB765197}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A2C18E7-0379-4D72-8A56-B850CB765197}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/mkremap/Program.cs b/mkremap/Program.cs new file mode 100644 index 0000000000..c41e312563 --- /dev/null +++ b/mkremap/Program.cs @@ -0,0 +1,60 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + +using System; +using System.Drawing; +using System.IO; +using System.Linq; + +namespace mkremap +{ + class Program + { + static void Main(string[] args) + { + if (args.Length != 8) + { + Console.WriteLine("Usage: mkremap cnc|ra dest c1.r c1.g c1.b c2.r c2.g c2.b"); + return; + } + + var c1 = Color.FromArgb(255, int.Parse(args[2]), int.Parse(args[3]), int.Parse(args[4])); + var c2 = Color.FromArgb(255, int.Parse(args[5]), int.Parse(args[6]), int.Parse(args[7])); + + var baseIndex = args[0] == "ra" ? 80 : 0xb0; + var fracs = args[0] == "ra" + ? new[] { 0, 1 / 16f, 2 / 16f, 3 / 16f, 4 / 16f, 5 / 16f, 6 / 16f, 7 / 16f, 8 / 16f, 9 / 16f, 10 / 16f, 11 / 16f, 12 / 16f, 13 / 16f, 14 / 16f, 15 / 16f } + : new[] { 0, 2 / 16f, 4 / 16f, 6 / 16f, 8 / 16f, 10 / 16f, 13 / 16f, 15 / 16f, 1 / 16f, 3 / 16f, 5 / 16f, 7 / 16f, 9 / 16f, 11 / 16f, 12 / 16f, 14 / 16f }; + + File.WriteAllLines( args[1], + fracs.Select(x => ColorLerp(x, c1, c2)) + .Select((x, i) => string.Format("{0}: 255,{1},{2},{3}", baseIndex + i, x.R, x.G, x.B)) + .ToArray()); + } + + static Color ColorLerp(float t, Color c1, Color c2) + { + return Color.FromArgb(255, + (int)(t * c2.R + (1 - t) * c1.R), + (int)(t * c2.G + (1 - t) * c1.G), + (int)(t * c2.B + (1 - t) * c1.B)); + } + } +} diff --git a/mkremap/Properties/AssemblyInfo.cs b/mkremap/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..064db31417 --- /dev/null +++ b/mkremap/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("mkremap")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("mkremap")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4a15844e-bfdf-4da6-91f4-2ca6fe949fcb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/mkremap/mkremap.csproj b/mkremap/mkremap.csproj new file mode 100644 index 0000000000..49f444475e --- /dev/null +++ b/mkremap/mkremap.csproj @@ -0,0 +1,54 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {3A2C18E7-0379-4D72-8A56-B850CB765197} + Exe + Properties + mkremap + mkremap + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + + + + + + + + + + \ No newline at end of file diff --git a/mkremap/mkremap.sln b/mkremap/mkremap.sln new file mode 100644 index 0000000000..b615320e82 --- /dev/null +++ b/mkremap/mkremap.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mkremap", "mkremap.csproj", "{3A2C18E7-0379-4D72-8A56-B850CB765197}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3A2C18E7-0379-4D72-8A56-B850CB765197}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A2C18E7-0379-4D72-8A56-B850CB765197}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A2C18E7-0379-4D72-8A56-B850CB765197}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A2C18E7-0379-4D72-8A56-B850CB765197}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index 5e4cbb2745..5a08dbe415 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -125,6 +125,12 @@ World: BasePalette: terrain Remap: gray.rem DisplayColor: 133,113,101 + PlayerColorPalette@player8: + Name: neutral + DisplayName: White + BasePalette: terrain + Remap: white.rem + DisplayColor: 255,255,255 PaletteFromFile@chrome: Name: chrome Filename: temperat.pal diff --git a/mods/ra/white.rem b/mods/ra/white.rem new file mode 100644 index 0000000000..e623093c3f --- /dev/null +++ b/mods/ra/white.rem @@ -0,0 +1,16 @@ +80: 255,255,255,255 +81: 255,247,247,247 +82: 255,239,239,239 +83: 255,231,231,231 +84: 255,223,223,223 +85: 255,215,215,215 +86: 255,207,207,207 +87: 255,199,199,199 +88: 255,191,191,191 +89: 255,183,183,183 +90: 255,175,175,175 +91: 255,167,167,167 +92: 255,159,159,159 +93: 255,151,151,151 +94: 255,143,143,143 +95: 255,135,135,135