added spawn points (as white dots for now)
This commit is contained in:
@@ -285,7 +285,7 @@ namespace OpenRa
|
|||||||
|
|
||||||
if (mapPreviewDirty)
|
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);
|
mapChooserSheet.Texture.SetData(b);
|
||||||
mapChooserSprite = new Sprite(mapChooserSheet,
|
mapChooserSprite = new Sprite(mapChooserSheet,
|
||||||
Minimap.MakeMinimapBounds(currentMap.Map), TextureChannel.Alpha);
|
Minimap.MakeMinimapBounds(currentMap.Map), TextureChannel.Alpha);
|
||||||
@@ -392,7 +392,7 @@ namespace OpenRa
|
|||||||
var minimapRect = new Rectangle(r.Right - 322, r.Top + 45, 300, 240);
|
var minimapRect = new Rectangle(r.Right - 322, r.Top + 45, 300, 240);
|
||||||
|
|
||||||
world.Minimap.Update();
|
world.Minimap.Update();
|
||||||
world.Minimap.Draw(minimapRect, true);
|
world.Minimap.DrawSpawnPoints(minimapRect);
|
||||||
|
|
||||||
if (Game.world.LocalPlayer.Index == 0)
|
if (Game.world.LocalPlayer.Index == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ namespace OpenRa.Graphics
|
|||||||
class Minimap
|
class Minimap
|
||||||
{
|
{
|
||||||
readonly World world;
|
readonly World world;
|
||||||
Sheet sheet, mapOnlySheet;
|
Sheet sheet, mapOnlySheet, mapSpawnPointSheet;
|
||||||
SpriteRenderer rgbaRenderer;
|
SpriteRenderer rgbaRenderer;
|
||||||
Sprite sprite, mapOnlySprite;
|
Sprite sprite, mapOnlySprite, mapSpawnPointSprite;
|
||||||
Bitmap terrain, oreLayer;
|
Bitmap terrain, oreLayer, spawnPointsLayer;
|
||||||
const int alpha = 230;
|
const int alpha = 230;
|
||||||
|
|
||||||
public void Tick() { }
|
public void Tick() { }
|
||||||
@@ -24,6 +24,7 @@ namespace OpenRa.Graphics
|
|||||||
this.world = world;
|
this.world = world;
|
||||||
sheet = new Sheet(r, new Size(128, 128));
|
sheet = new Sheet(r, new Size(128, 128));
|
||||||
mapOnlySheet = 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);
|
rgbaRenderer = new SpriteRenderer(r, true, r.RgbaSpriteShader);
|
||||||
var size = Math.Max(world.Map.Width, world.Map.Height);
|
var size = Math.Max(world.Map.Width, world.Map.Height);
|
||||||
@@ -34,6 +35,7 @@ namespace OpenRa.Graphics
|
|||||||
|
|
||||||
sprite = new Sprite(sheet, rect, TextureChannel.Alpha);
|
sprite = new Sprite(sheet, rect, TextureChannel.Alpha);
|
||||||
mapOnlySprite = new Sprite(mapOnlySheet, rect, TextureChannel.Alpha);
|
mapOnlySprite = new Sprite(mapOnlySheet, rect, TextureChannel.Alpha);
|
||||||
|
mapSpawnPointSprite = new Sprite(mapSpawnPointSheet, rect, TextureChannel.Alpha);
|
||||||
|
|
||||||
shroudColor = Color.FromArgb(alpha, Color.Black);
|
shroudColor = Color.FromArgb(alpha, Color.Black);
|
||||||
}
|
}
|
||||||
@@ -70,6 +72,14 @@ namespace OpenRa.Graphics
|
|||||||
terrain.SetPixel(x, y, map.IsInMap(x, y)
|
terrain.SetPixel(x, y, map.IsInMap(x, y)
|
||||||
? colors[tileset.GetWalkability(map.MapTiles[x, y])]
|
? colors[tileset.GetWalkability(map.MapTiles[x, y])]
|
||||||
: shroudColor);
|
: 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;
|
return terrain;
|
||||||
}
|
}
|
||||||
@@ -90,6 +100,17 @@ namespace OpenRa.Graphics
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapOnlySheet.Texture.SetData(oreLayer);
|
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<ProvidesRadar>().Any())
|
if (!world.Queries.OwnedBy[world.LocalPlayer].WithTrait<ProvidesRadar>().Any())
|
||||||
return;
|
return;
|
||||||
@@ -132,5 +153,12 @@ namespace OpenRa.Graphics
|
|||||||
new float2(rect.X, rect.Y), "chrome", new float2(rect.Width, rect.Height));
|
new float2(rect.X, rect.Y), "chrome", new float2(rect.Width, rect.Height));
|
||||||
rgbaRenderer.Flush();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user