diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 8b4e5e8158..200d5e600f 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -285,7 +285,7 @@ namespace OpenRa if (mapPreviewDirty) { - var b = Minimap.RenderTerrainBitmap(currentMap.Map, Game.world.TileSet); // tileset -> hack + var b = Minimap.RenderTerrainBitmapWithSpawnPoints(currentMap.Map, Game.world.TileSet); // tileset -> hack mapChooserSheet.Texture.SetData(b); mapChooserSprite = new Sprite(mapChooserSheet, Minimap.MakeMinimapBounds(currentMap.Map), TextureChannel.Alpha); @@ -392,7 +392,7 @@ namespace OpenRa var minimapRect = new Rectangle(r.Right - 322, r.Top + 45, 300, 240); world.Minimap.Update(); - world.Minimap.Draw(minimapRect, true); + world.Minimap.DrawSpawnPoints(minimapRect); if (Game.world.LocalPlayer.Index == 0) { diff --git a/OpenRa.Game/Graphics/Minimap.cs b/OpenRa.Game/Graphics/Minimap.cs index 4b50efffca..0f52cbeaf5 100644 --- a/OpenRa.Game/Graphics/Minimap.cs +++ b/OpenRa.Game/Graphics/Minimap.cs @@ -11,10 +11,10 @@ namespace OpenRa.Graphics class Minimap { readonly World world; - Sheet sheet, mapOnlySheet; + Sheet sheet, mapOnlySheet, mapSpawnPointSheet; SpriteRenderer rgbaRenderer; - Sprite sprite, mapOnlySprite; - Bitmap terrain, oreLayer; + Sprite sprite, mapOnlySprite, mapSpawnPointSprite; + Bitmap terrain, oreLayer, spawnPointsLayer; const int alpha = 230; public void Tick() { } @@ -24,6 +24,7 @@ namespace OpenRa.Graphics this.world = world; sheet = new Sheet(r, new Size(128, 128)); mapOnlySheet = new Sheet(r, new Size(128, 128)); + mapSpawnPointSheet = new Sheet(r, new Size(128, 128)); rgbaRenderer = new SpriteRenderer(r, true, r.RgbaSpriteShader); var size = Math.Max(world.Map.Width, world.Map.Height); @@ -34,6 +35,7 @@ namespace OpenRa.Graphics sprite = new Sprite(sheet, rect, TextureChannel.Alpha); mapOnlySprite = new Sprite(mapOnlySheet, rect, TextureChannel.Alpha); + mapSpawnPointSprite = new Sprite(mapSpawnPointSheet, rect, TextureChannel.Alpha); shroudColor = Color.FromArgb(alpha, Color.Black); } @@ -70,6 +72,14 @@ namespace OpenRa.Graphics terrain.SetPixel(x, y, map.IsInMap(x, y) ? colors[tileset.GetWalkability(map.MapTiles[x, y])] : shroudColor); + return terrain; + } + + public static Bitmap RenderTerrainBitmapWithSpawnPoints(Map map, TileSet tileset) + { + var terrain = RenderTerrainBitmap(map, tileset); + foreach (var point in map.SpawnPoints) + terrain.SetPixel(point.X, point.Y, Color.White); return terrain; } @@ -90,6 +100,17 @@ namespace OpenRa.Graphics } mapOnlySheet.Texture.SetData(oreLayer); + mapSpawnPointSheet.Texture.SetData(oreLayer); + + if (spawnPointsLayer == null) + { + spawnPointsLayer = new Bitmap(terrain); + foreach (var point in world.Map.SpawnPoints){ + spawnPointsLayer.SetPixel(point.X, point.Y, Color.White); + } + } + + mapSpawnPointSheet.Texture.SetData(spawnPointsLayer); if (!world.Queries.OwnedBy[world.LocalPlayer].WithTrait().Any()) return; @@ -132,5 +153,12 @@ namespace OpenRa.Graphics new float2(rect.X, rect.Y), "chrome", new float2(rect.Width, rect.Height)); rgbaRenderer.Flush(); } + + public void DrawSpawnPoints(RectangleF rect) + { + rgbaRenderer.DrawSprite( mapSpawnPointSprite, + new float2(rect.X, rect.Y), "chrome", new float2(rect.Width, rect.Height)); + rgbaRenderer.Flush(); + } } }