fixed false-color minimap

This commit is contained in:
Chris Forbes
2010-01-05 14:32:18 +13:00
parent 46d5f642a0
commit a8e49556ca

View File

@@ -1,6 +1,7 @@
using System.Drawing;
using System.Linq;
using OpenRa.Game.Traits;
using OpenRa.FileFormats;
namespace OpenRa.Game.Graphics
{
@@ -21,20 +22,25 @@ namespace OpenRa.Game.Graphics
}
// todo: extract these from the palette
static readonly Color[] terrainTypeColors = {
Color.Green,
Color.Red,
Color.Blue,
Color.Yellow,
Color.Purple,
Color.Turquoise,
Color.Violet,
Color.Tomato,
Color.Teal,
};
Color[] terrainTypeColors;
public void Update()
{
if (terrainTypeColors == null)
{
var pal = new Palette(FileSystem.Open(Rules.Map.Theater + ".pal"));
terrainTypeColors = new[] {
pal.GetColor(0x1a),
pal.GetColor(0x63),
pal.GetColor(0x2f),
pal.GetColor(0x1f),
pal.GetColor(0x14),
pal.GetColor(0x64),
pal.GetColor(0x1f),
pal.GetColor(0x68),
pal.GetColor(0x6b),
};
}
if (terrain == null)
{
terrain = new Bitmap(128, 128);
@@ -52,7 +58,7 @@ namespace OpenRa.Game.Graphics
{
var b = Game.BuildingInfluence.GetBuildingAt(new int2(x, y));
if (b != null)
bitmap.SetPixel(x, y, b.Owner != null ? Chat.paletteColors[(int)b.Owner.Palette] : Color.Gray);
bitmap.SetPixel(x, y, b.Owner != null ? Chat.paletteColors[(int)b.Owner.Palette] : terrainTypeColors[4]);
}
foreach (var a in Game.world.Actors.Where(a => a.traits.Contains<Unit>()))