diff --git a/OpenRa.Game/Graphics/HardwarePalette.cs b/OpenRa.Game/Graphics/HardwarePalette.cs index eafc17b0c8..3317828581 100644 --- a/OpenRa.Game/Graphics/HardwarePalette.cs +++ b/OpenRa.Game/Graphics/HardwarePalette.cs @@ -28,7 +28,7 @@ namespace OpenRa.Graphics { class HardwarePalette : Sheet { - const int maxEntries = 16; + public const int MaxPalettes = 64; int allocated = 0; // We need to store the Palettes themselves for the remap palettes to work @@ -36,7 +36,7 @@ namespace OpenRa.Graphics static Dictionary palettes; static Dictionary indices; public HardwarePalette(Renderer renderer, Map map) - : base(renderer,new Size(256, maxEntries)) + : base(renderer,new Size(256, MaxPalettes)) { palettes = new Dictionary(); indices = new Dictionary(); diff --git a/OpenRa.Game/Graphics/Util.cs b/OpenRa.Game/Graphics/Util.cs index e8ee19c127..74c340e33a 100644 --- a/OpenRa.Game/Graphics/Util.cs +++ b/OpenRa.Game/Graphics/Util.cs @@ -52,23 +52,11 @@ namespace OpenRa.Graphics return result; } - public static readonly int2[] directions = - new int2[] { - new int2( -1, -1 ), - new int2( -1, 0 ), - new int2( -1, 1 ), - new int2( 0, -1 ), - new int2( 0, 1 ), - new int2( 1, -1 ), - new int2( 1, 0 ), - new int2( 1, 1 ), - }; - static float[] channelSelect = { 0.75f, 0.25f, -0.25f, -0.75f }; public static void FastCreateQuad(Vertex[] vertices, ushort[] indices, float2 o, Sprite r, int palette, int nv, int ni, float2 size) { - float2 attrib = new float2(palette / 16.0f, channelSelect[(int)r.channel]); + var attrib = new float2(palette / (float)HardwarePalette.MaxPalettes, channelSelect[(int)r.channel]); vertices[nv] = new Vertex(o, r.FastMapTextureCoords(0), attrib); diff --git a/OpenRa.Game/PathSearch.cs b/OpenRa.Game/PathSearch.cs index 3a0d8b95f9..7ddb1cfbae 100755 --- a/OpenRa.Game/PathSearch.cs +++ b/OpenRa.Game/PathSearch.cs @@ -67,7 +67,7 @@ namespace OpenRa if (thisCost == float.PositiveInfinity) return p.Location; - foreach( int2 d in Graphics.Util.directions ) + foreach( int2 d in directions ) { int2 newHere = p.Location + d; @@ -113,6 +113,18 @@ namespace OpenRa return p.Location; } + static readonly int2[] directions = + { + new int2( -1, -1 ), + new int2( -1, 0 ), + new int2( -1, 1 ), + new int2( 0, -1 ), + new int2( 0, 1 ), + new int2( 1, -1 ), + new int2( 1, 0 ), + new int2( 1, 1 ), + }; + public void AddInitialCell( World world, int2 location ) { if (!world.Map.IsInMap(location.X, location.Y)) diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index be513ffc77..542854bcb9 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -113,18 +113,18 @@ World: BasePalette: terrain Remap: salmon.rem DisplayColor: 153,76,53 -# PlayerColorPalette@player6: -# Name: player6 -# DisplayName: Green -# BasePalette: terrain -# Remap: green.rem -# DisplayColor: 76,101,60 -# PlayerColorPalette@player7: -# Name: player7 -# DisplayName: Gray -# BasePalette: terrain -# Remap: gray.rem -# DisplayColor: 133,113,101 + PlayerColorPalette@player6: + Name: player6 + DisplayName: Green + BasePalette: terrain + Remap: green.rem + DisplayColor: 76,101,60 + PlayerColorPalette@player7: + Name: player7 + DisplayName: Gray + BasePalette: terrain + Remap: gray.rem + DisplayColor: 133,113,101 PaletteFromFile@chrome: Name: chrome Filename: temperat.pal diff --git a/shaders/chrome-shp.fx b/shaders/chrome-shp.fx index d695ac4047..99d5cdb6b0 100644 --- a/shaders/chrome-shp.fx +++ b/shaders/chrome-shp.fx @@ -47,12 +47,10 @@ VertexOut Simple_vp(VertexIn v) { return o; } -const float2 texelOffset = float2( 0, 1.0f/32.0f ); - float4 Palette_fp(VertexOut f) : COLOR0 { float4 x = tex2D(DiffuseTexture, f.Tex0.xy); float2 p = float2( dot(x, f.ChannelMask), f.Tex0.z ); - return tex2D(Palette, p + texelOffset); + return tex2D(Palette, p); } technique low_quality { diff --git a/shaders/world-shp.fx b/shaders/world-shp.fx index f59685bcfb..14d67decfb 100644 --- a/shaders/world-shp.fx +++ b/shaders/world-shp.fx @@ -47,12 +47,10 @@ VertexOut Simple_vp(VertexIn v) { return o; } -const float2 texelOffset = float2( 0, 1.0f/32.0f ); - float4 Palette_fp(VertexOut f) : COLOR0 { float4 x = tex2D(DiffuseTexture, f.Tex0.xy); float2 p = float2( dot(x, f.ChannelMask), f.Tex0.z ); - return tex2D(Palette, p + texelOffset); + return tex2D(Palette, p); } technique low_quality {