Split highlight and player palettes. Fixes #3799.
This commit is contained in:
@@ -237,6 +237,7 @@
|
|||||||
<Compile Include="Traits\Player\FrozenActorLayer.cs" />
|
<Compile Include="Traits\Player\FrozenActorLayer.cs" />
|
||||||
<Compile Include="Graphics\Theater.cs" />
|
<Compile Include="Graphics\Theater.cs" />
|
||||||
<Compile Include="Traits\Player\PlayerColorPalette.cs" />
|
<Compile Include="Traits\Player\PlayerColorPalette.cs" />
|
||||||
|
<Compile Include="Traits\Player\PlayerHighlightPalette.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
var remap = new PlayerColorRemap(info.RemapIndex, owner.Color, info.Ramp);
|
var remap = new PlayerColorRemap(info.RemapIndex, owner.Color, info.Ramp);
|
||||||
wr.AddPalette(info.BaseName + owner.InternalName, new Palette(wr.Palette(info.BasePalette).Palette, remap), info.AllowModifiers);
|
wr.AddPalette(info.BaseName + owner.InternalName, new Palette(wr.Palette(info.BasePalette).Palette, remap), info.AllowModifiers);
|
||||||
|
|
||||||
var argb = (uint)Color.FromArgb(128, owner.Color.RGB).ToArgb();
|
|
||||||
wr.AddPalette("highlight" + owner.InternalName, new Palette(Exts.MakeArray(256, i => i == 0 ? 0 : argb)), false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
43
OpenRA.Game/Traits/Player/PlayerHighlightPalette.cs
Normal file
43
OpenRA.Game/Traits/Player/PlayerHighlightPalette.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2013 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 System.Drawing;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
|
namespace OpenRA.Traits
|
||||||
|
{
|
||||||
|
[Desc("Add this to the Player actor definition.")]
|
||||||
|
public class PlayerHighlightPaletteInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
[Desc("The prefix for the resulting player palettes")]
|
||||||
|
public readonly string BaseName = "highlight";
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new PlayerHighlightPalette(init.self.Owner, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PlayerHighlightPalette : IPalette
|
||||||
|
{
|
||||||
|
readonly Player owner;
|
||||||
|
readonly PlayerHighlightPaletteInfo info;
|
||||||
|
|
||||||
|
public PlayerHighlightPalette(Player owner, PlayerHighlightPaletteInfo info)
|
||||||
|
{
|
||||||
|
this.owner = owner;
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitPalette(WorldRenderer wr)
|
||||||
|
{
|
||||||
|
var argb = (uint)Color.FromArgb(128, owner.Color.RGB).ToArgb();
|
||||||
|
wr.AddPalette(info.BaseName + owner.InternalName, new Palette(Exts.MakeArray(256, i => i == 0 ? 0 : argb)), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -199,6 +199,7 @@ Player:
|
|||||||
PlayerColorPalette:
|
PlayerColorPalette:
|
||||||
BasePalette: terrain
|
BasePalette: terrain
|
||||||
RemapIndex: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
|
RemapIndex: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
|
||||||
|
PlayerHighlightPalette:
|
||||||
BaseAttackNotifier:
|
BaseAttackNotifier:
|
||||||
Shroud:
|
Shroud:
|
||||||
PlayerStatistics:
|
PlayerStatistics:
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ Player:
|
|||||||
PlayerColorPalette:
|
PlayerColorPalette:
|
||||||
BasePalette: d2k
|
BasePalette: d2k
|
||||||
RemapIndex: 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240
|
RemapIndex: 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240
|
||||||
|
PlayerHighlightPalette:
|
||||||
BaseAttackNotifier:
|
BaseAttackNotifier:
|
||||||
Shroud:
|
Shroud:
|
||||||
FrozenActorLayer:
|
FrozenActorLayer:
|
||||||
|
|||||||
@@ -521,6 +521,7 @@ Player:
|
|||||||
PlayerColorPalette:
|
PlayerColorPalette:
|
||||||
BasePalette: player
|
BasePalette: player
|
||||||
RemapIndex: 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
|
RemapIndex: 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
|
||||||
|
PlayerHighlightPalette:
|
||||||
GpsWatcher:
|
GpsWatcher:
|
||||||
Shroud:
|
Shroud:
|
||||||
FrozenActorLayer:
|
FrozenActorLayer:
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ Player:
|
|||||||
PlayerColorPalette:
|
PlayerColorPalette:
|
||||||
BasePalette: player
|
BasePalette: player
|
||||||
RemapIndex: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
|
RemapIndex: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
|
||||||
|
PlayerHighlightPalette:
|
||||||
GpsWatcher:
|
GpsWatcher:
|
||||||
Shroud:
|
Shroud:
|
||||||
BaseAttackNotifier:
|
BaseAttackNotifier:
|
||||||
|
|||||||
Reference in New Issue
Block a user