added white remap

This commit is contained in:
Chris Forbes
2010-02-27 12:40:01 +13:00
parent 4ad43da17a
commit fb0936a5d6
8 changed files with 199 additions and 1 deletions

View File

@@ -302,7 +302,7 @@ namespace OpenRA.Server
} }
int pali; int pali;
if (!int.TryParse(s, out pali) || pali < 0 || pali > 7) if (!int.TryParse(s, out pali))
{ {
Console.WriteLine("Invalid palette: {0}", s); Console.WriteLine("Invalid palette: {0}", s);
return false; return false;

View File

@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Mods.Cnc", "OpenRa.M
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Gl", "OpenRa.Gl\OpenRa.Gl.csproj", "{67CF1A10-C5F6-48FA-B1A7-FE83BE4CE2CC}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Gl", "OpenRa.Gl\OpenRa.Gl.csproj", "{67CF1A10-C5F6-48FA-B1A7-FE83BE4CE2CC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mkremap", "mkremap\mkremap.csproj", "{3A2C18E7-0379-4D72-8A56-B850CB765197}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{67CF1A10-C5F6-48FA-B1A7-FE83BE4CE2CC}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

60
mkremap/Program.cs Normal file
View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
#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));
}
}
}

View File

@@ -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")]

54
mkremap/mkremap.csproj Normal file
View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3A2C18E7-0379-4D72-8A56-B850CB765197}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>mkremap</RootNamespace>
<AssemblyName>mkremap</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

20
mkremap/mkremap.sln Normal file
View File

@@ -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

View File

@@ -125,6 +125,12 @@ World:
BasePalette: terrain BasePalette: terrain
Remap: gray.rem Remap: gray.rem
DisplayColor: 133,113,101 DisplayColor: 133,113,101
PlayerColorPalette@player8:
Name: neutral
DisplayName: White
BasePalette: terrain
Remap: white.rem
DisplayColor: 255,255,255
PaletteFromFile@chrome: PaletteFromFile@chrome:
Name: chrome Name: chrome
Filename: temperat.pal Filename: temperat.pal

16
mods/ra/white.rem Normal file
View File

@@ -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