Support custom map previews.
Add map.png to the map archive.
This commit is contained in:
@@ -70,6 +70,7 @@ namespace OpenRA
|
|||||||
public string Author;
|
public string Author;
|
||||||
public string Tileset;
|
public string Tileset;
|
||||||
public bool AllowStartUnitConfig = true;
|
public bool AllowStartUnitConfig = true;
|
||||||
|
public Bitmap CustomPreview;
|
||||||
|
|
||||||
[FieldLoader.LoadUsing("LoadOptions")]
|
[FieldLoader.LoadUsing("LoadOptions")]
|
||||||
public MapOptions Options;
|
public MapOptions Options;
|
||||||
@@ -226,6 +227,9 @@ namespace OpenRA
|
|||||||
Save(path);
|
Save(path);
|
||||||
|
|
||||||
Uid = ComputeHash();
|
Uid = ComputeHash();
|
||||||
|
|
||||||
|
if (Container.Exists("map.png"))
|
||||||
|
CustomPreview = new Bitmap(Container.GetContent("map.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPos[] GetSpawnPoints()
|
public CPos[] GetSpawnPoints()
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace OpenRA
|
|||||||
// the next render cycle.
|
// the next render cycle.
|
||||||
// (d) Any partially written bytes from the next minimap is in an
|
// (d) Any partially written bytes from the next minimap is in an
|
||||||
// unallocated area, and will be committed in the next cycle.
|
// unallocated area, and will be committed in the next cycle.
|
||||||
var bitmap = Minimap.RenderMapPreview(p.Map, true);
|
var bitmap = p.CustomPreview ?? Minimap.RenderMapPreview(p.Map, true);
|
||||||
p.Minimap = sheetBuilder.Add(bitmap);
|
p.Minimap = sheetBuilder.Add(bitmap);
|
||||||
|
|
||||||
lock (syncRoot)
|
lock (syncRoot)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ namespace OpenRA
|
|||||||
public int PlayerCount { get; private set; }
|
public int PlayerCount { get; private set; }
|
||||||
public List<CPos> SpawnPoints { get; private set; }
|
public List<CPos> SpawnPoints { get; private set; }
|
||||||
public Rectangle Bounds { get; private set; }
|
public Rectangle Bounds { get; private set; }
|
||||||
|
public Bitmap CustomPreview { get; private set; }
|
||||||
public Map Map { get; private set; }
|
public Map Map { get; private set; }
|
||||||
public MapStatus Status { get; private set; }
|
public MapStatus Status { get; private set; }
|
||||||
|
|
||||||
@@ -85,6 +86,7 @@ namespace OpenRA
|
|||||||
PlayerCount = m.Players.Count(x => x.Value.Playable);
|
PlayerCount = m.Players.Count(x => x.Value.Playable);
|
||||||
Bounds = m.Bounds;
|
Bounds = m.Bounds;
|
||||||
SpawnPoints = m.GetSpawnPoints().ToList();
|
SpawnPoints = m.GetSpawnPoints().ToList();
|
||||||
|
CustomPreview = m.CustomPreview;
|
||||||
Status = MapStatus.Available;
|
Status = MapStatus.Available;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user