From 42c3ad37fd3f7fa09d47f6c0d86e5e2c364e10e0 Mon Sep 17 00:00:00 2001 From: Martin Benjamins Date: Mon, 9 Sep 2019 12:21:00 +0200 Subject: [PATCH] Add option for outputting explored maps without unexplored BGs --- WorldMapCompiler/Program.cs | 24 ++++++++++++++++++++++-- WorldMapCompiler/settings.json | 13 +++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/WorldMapCompiler/Program.cs b/WorldMapCompiler/Program.cs index 30b2839..3198c2f 100644 --- a/WorldMapCompiler/Program.cs +++ b/WorldMapCompiler/Program.cs @@ -18,6 +18,7 @@ private static void Main(string[] args) var saveExplored = bool.Parse(config["saveExploredMaps"]); var saveUnexplored = bool.Parse(config["saveUnexploredMaps"]); var saveLayers = bool.Parse(config["saveMapLayers"]); + var saveExploredMapsWithoutUnexplored = bool.Parse(config["saveExploredMapsWithoutUnexplored"]); if (saveExplored && !Directory.Exists("explored")) { @@ -34,6 +35,11 @@ private static void Main(string[] args) Directory.CreateDirectory("layers"); } + if (saveExploredMapsWithoutUnexplored && !Directory.Exists("exploredNoUnexplored")) + { + Directory.CreateDirectory("exploredNoUnexplored"); + } + var locale = CASCLib.LocaleFlags.enUS; if (config["locale"] != string.Empty) @@ -160,9 +166,11 @@ private static void Main(string[] args) } var bmp = new Bitmap((int)res_y, (int)res_x); - var g = Graphics.FromImage(bmp); + var bmp2 = new Bitmap((int)res_y, (int)res_x); + var g2 = Graphics.FromImage(bmp2); + for (var cur_x = 0; cur_x < maxRows + 1; cur_x++) { for (var cur_y = 0; cur_y < maxCols + 1; cur_y++) @@ -273,7 +281,14 @@ private static void Main(string[] args) { layerGraphics.DrawImage(blp.GetBitmap(0), cur_y * 256, cur_x * 256, new Rectangle(0, 0, 256, 256), GraphicsUnit.Pixel); } - g.DrawImage(blp.GetBitmap(0), posY, posX, new Rectangle(0, 0, 256, 256), GraphicsUnit.Pixel); + + var blpBMP = blp.GetBitmap(0); + g.DrawImage(blpBMP, posY, posX, new Rectangle(0, 0, 256, 256), GraphicsUnit.Pixel); + + if (saveExploredMapsWithoutUnexplored) + { + g2.DrawImage(blpBMP, posY, posX, new Rectangle(0, 0, 256, 256), GraphicsUnit.Pixel); + } } catch (Exception e) { @@ -299,6 +314,11 @@ private static void Main(string[] args) { bmp.Save("explored/ " + CleanFileName(mapRow.ID + " - " + mapName + ".png")); } + + if (saveExploredMapsWithoutUnexplored) + { + bmp2.Save("exploredNoUnexplored/ " + CleanFileName(mapRow.ID + " - " + mapName + ".png")); + } } } } diff --git a/WorldMapCompiler/settings.json b/WorldMapCompiler/settings.json index 6ea2ab0..e98e22f 100644 --- a/WorldMapCompiler/settings.json +++ b/WorldMapCompiler/settings.json @@ -1,8 +1,9 @@ { - "installDir": "C:/World of Warcraft/", // Set this to your WoW installation directory, leave empty if you just want to use web - "program": "wow", // Set this to wow for Retail, wowt for PTR or wow_beta for Alpha/Beta - "locale": "enUS", // Set this to deDE, enUS, ruRU, zhCN or zhTW for what language names/map images should be - "saveExploredMaps": true, // Whether or not to save explored versions of maps - "saveUnexploredMaps": false, // Whether or not to save un-explored versions of maps - "saveMapLayers": false // Whether or not to save the individual exploration layers separately + "installDir": "C:/Program Files (x86)/World of Warcraft/", // Set this to your WoW installation directory, leave empty if you just want to use web + "program": "wow_classic", // Set this to wow for Retail, wowt for PTR or wow_beta for Alpha/Beta + "locale": "enUS", // Set this to deDE, enUS, ruRU, zhCN or zhTW for what language names/map images should be + "saveExploredMaps": true, // Whether or not to save explored versions of maps + "saveExploredMapsWithoutUnexplored": true, // Whether or not to save explored maps without unexplored background + "saveUnexploredMaps": false, // Whether or not to save un-explored versions of maps + "saveMapLayers": false // Whether or not to save the individual exploration layers separately }