Merge pull request #5155 from Mailaender/ts-tiberium

Added Tiberium crystals and refinery to Tiberian Sun
This commit is contained in:
Paul Chote
2014-05-07 18:30:27 +12:00
13 changed files with 236 additions and 19 deletions

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Graphics
for (var i = 15; i > 0; i--)
remapRamp = ramp.Select(r => r - ramp[15]).ToArray();
}
remapColors = remapRamp.Select((x, i) => Pair.New(baseIndex + i, Exts.ColorLerp(x / 16f, c1, c2)))
.ToDictionary(u => u.First, u => u.Second);
}

View File

@@ -244,6 +244,7 @@
<Compile Include="Scripting\ScriptMemberWrapper.cs" />
<Compile Include="Scripting\ScriptMemberExts.cs" />
<Compile Include="Scripting\ScriptPlayerInterface.cs" />
<Compile Include="Traits\Player\FixedColorPalette.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="FileSystem\D2kSoundResources.cs" />

View File

@@ -0,0 +1,50 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using OpenRA.FileFormats;
using OpenRA.Graphics;
namespace OpenRA.Traits
{
[Desc("Add this to the World actor definition.")]
public class FixedColorPaletteInfo : ITraitInfo
{
[Desc("The name of the palette to base off.")]
public readonly string Base = "terrain";
[Desc("The name of the resulting palette")]
public readonly string Name = "resources";
[Desc("Remap these indices to pre-defined colors.")]
public readonly int[] RemapIndex = { };
[Desc("The fixed color to remap.")]
public readonly HSLColor Color;
[Desc("Luminosity range to span.")]
public readonly float Ramp = 0.05f;
[Desc("Allow palette modifiers to change the palette.")]
public readonly bool AllowModifiers = true;
public object Create(ActorInitializer init) { return new FixedColorPalette(this); }
}
public class FixedColorPalette : IPalette
{
readonly FixedColorPaletteInfo info;
public FixedColorPalette(FixedColorPaletteInfo info)
{
this.info = info;
}
public void InitPalette(WorldRenderer wr)
{
var remap = new PlayerColorRemap(info.RemapIndex, info.Color, info.Ramp);
wr.AddPalette(info.Name, new Palette(wr.Palette(info.Base).Palette, remap), info.AllowModifiers);
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -16,7 +16,7 @@ namespace OpenRA.Traits
{
public class ResourceTypeInfo : ITraitInfo
{
// Hack: The editor is getting really unmaintanable...
// HACK: The editor is getting really unmaintanable...
public readonly string EditorSprite;
public readonly string[] Variants = { };
public readonly string Palette = "terrain";