@@ -113,7 +113,7 @@ namespace OpenRA.Graphics
|
|||||||
{
|
{
|
||||||
var mapX = x + map.Bounds.Left;
|
var mapX = x + map.Bounds.Left;
|
||||||
var mapY = y + map.Bounds.Top;
|
var mapY = y + map.Bounds.Top;
|
||||||
var custom = map.CustomTerrain[mapX,mapY];
|
var custom = map.CustomTerrain[mapX, mapY];
|
||||||
if (custom == null)
|
if (custom == null)
|
||||||
continue;
|
continue;
|
||||||
*(c + (y * bitmapData.Stride >> 2) + x) = world.TileSet.Terrain[custom].Color.ToArgb();
|
*(c + (y * bitmapData.Stride >> 2) + x) = world.TileSet.Terrain[custom].Color.ToArgb();
|
||||||
@@ -187,7 +187,7 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
public static Bitmap RenderMapPreview(Map map)
|
public static Bitmap RenderMapPreview(Map map)
|
||||||
{
|
{
|
||||||
Bitmap terrain = TerrainBitmap(map);
|
Bitmap terrain = TerrainBitmap(map, true);
|
||||||
return AddStaticResources(map, terrain);
|
return AddStaticResources(map, terrain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,5 +293,24 @@ namespace OpenRA.Utility
|
|||||||
var result = new Map(args[1]).Uid;
|
var result = new Map(args[1]).Uid;
|
||||||
Console.WriteLine(result);
|
Console.WriteLine(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void GenerateMinimap(string[] args)
|
||||||
|
{
|
||||||
|
var map = new Map(args[1]);
|
||||||
|
|
||||||
|
Game.modData = new ModData(map.RequiresMod);
|
||||||
|
|
||||||
|
FileSystem.UnmountAll();
|
||||||
|
foreach (var dir in Game.modData.Manifest.Folders)
|
||||||
|
FileSystem.Mount(dir);
|
||||||
|
|
||||||
|
Rules.LoadRules(Game.modData.Manifest, map);
|
||||||
|
|
||||||
|
var minimap = Minimap.RenderMapPreview(map);
|
||||||
|
|
||||||
|
var dest = Path.GetFileNameWithoutExtension(args[1]) + ".png";
|
||||||
|
minimap.Save(dest);
|
||||||
|
Console.WriteLine(dest + " saved.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace OpenRA.Utility
|
|||||||
{ "--transpose", Command.TransposeShp },
|
{ "--transpose", Command.TransposeShp },
|
||||||
{ "--docs", Command.ExtractTraitDocs },
|
{ "--docs", Command.ExtractTraitDocs },
|
||||||
{ "--map-hash", Command.GetMapHash },
|
{ "--map-hash", Command.GetMapHash },
|
||||||
|
{ "--minimap", Command.GenerateMinimap },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (args.Length == 0) { PrintUsage(); return; }
|
if (args.Length == 0) { PrintUsage(); return; }
|
||||||
@@ -62,6 +63,7 @@ namespace OpenRA.Utility
|
|||||||
Console.WriteLine(" --transpose SRCSHP DESTSHP START N M [START N M ...] Transpose the N*M block of frames starting at START.");
|
Console.WriteLine(" --transpose SRCSHP DESTSHP START N M [START N M ...] Transpose the N*M block of frames starting at START.");
|
||||||
Console.WriteLine(" --docs MOD Generate trait documentation in MarkDown format.");
|
Console.WriteLine(" --docs MOD Generate trait documentation in MarkDown format.");
|
||||||
Console.WriteLine(" --map-hash MAPFILE Generate hash of specified oramap file.");
|
Console.WriteLine(" --map-hash MAPFILE Generate hash of specified oramap file.");
|
||||||
|
Console.WriteLine(" --minimap MAPFILE Render PNG minimap of specified oramap file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetNamedArg(string[] args, string arg)
|
static string GetNamedArg(string[] args, string arg)
|
||||||
|
|||||||
Reference in New Issue
Block a user