Skip to content

Commit

Permalink
Merge branch 'master' of github.com:blind-coder/pz-mapmap
Browse files Browse the repository at this point in the history
  • Loading branch information
blind-coder committed Jan 6, 2021
2 parents 52157b2 + 6ffbf87 commit 6e023fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion MapMap/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Main
private bool bigtree = false;
private static int numThreads = 0;
private int maxThreads = 1;
private int scale = 1;

private MMCellData childMapData;

Expand Down Expand Up @@ -117,7 +118,7 @@ private void parseMapData()
}
MapMap.Main.numThreads++;
Console.WriteLine("Threads: {0}/{1}", MapMap.Main.numThreads, maxThreads);
MMPlotter plotter = new MMPlotter(this.divider, this.tex, this.dolayers, this.bigtree);
MMPlotter plotter = new MMPlotter(this.divider, this.tex, this.dolayers, this.bigtree, this.scale);
//ThreadStart childref = new ThreadStart(this.RunPlotter);
//Thread childThread = new Thread(childref);
Thread childThread = new Thread(() => RunPlotter(plotter, mapdata, this.OutputDir, cellx, celly));
Expand Down Expand Up @@ -227,6 +228,9 @@ private bool parseArgs(string[] args)
case "-maxy":
this.maxY = Convert.ToInt32(args[id + 1]);
break;
case "-scale":
this.scale = Convert.ToInt32(args[id + 1]);
break;
}
}
Console.Clear();
Expand Down
14 changes: 11 additions & 3 deletions MapMapLib/MMPlotter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public class MMPlotter
private Random rand;
private BushInit[] bush;
private PlantInit[] plant;
private Int32 scale;

public MMPlotter(int divider, MMTextures textures, bool dolayers, bool bigtree)
public MMPlotter(int divider, MMTextures textures, bool dolayers, bool bigtree, Int32 scale)
{
Dictionary<String, List<String>> collageCategory;
List<String> collageSprites;
Expand Down Expand Up @@ -353,6 +354,7 @@ public MMPlotter(int divider, MMTextures textures, bool dolayers, bool bigtree)

this.rand = new Random();
this.subDiv = divider;
this.scale = scale;
this.subWH = (300 / this.subDiv);
this.startX = (1280 * 30 / this.subDiv / 2) - 64;
this.dolayers = dolayers;
Expand Down Expand Up @@ -455,13 +457,19 @@ public void PlotData( MMCellData cellData, string outputDir, int cellx, int cell
}
if (this.dolayers == true && drawCnt > 0)
{
this.subCell.Save(outputDir + "cell_" + cellx + "_" + celly + "_subcell_" + subx + "_" + suby + "_layer_" + z + ".png", System.Drawing.Imaging.ImageFormat.Png);
Bitmap resized = new Bitmap(this.subCell,new Size(this.subCell.Width/this.scale,this.subCell.Height/this.scale));
resized.Save(outputDir + "cell_" + cellx + "_" + celly + "_subcell_" + subx + "_" + suby + "_layer_" + z + ".png", System.Drawing.Imaging.ImageFormat.Png);

//this.subCell.Save(outputDir + "cell_" + cellx + "_" + celly + "_subcell_" + subx + "_" + suby + "_layer_" + z + ".png", System.Drawing.Imaging.ImageFormat.Png);
gfx.Clear(Color.Transparent);
}
}
if (this.dolayers == false)
{
this.subCell.Save(outputDir + "cell_" + cellx + "_" + celly + "_subcell_" + subx + "_" + suby + "_full.png", System.Drawing.Imaging.ImageFormat.Png);
Bitmap resized = new Bitmap(this.subCell,new Size(this.subCell.Width/this.scale,this.subCell.Height/this.scale));
resized.Save(outputDir + "cell_" + cellx + "_" + celly + "_subcell_" + subx + "_" + suby + "_full.png", System.Drawing.Imaging.ImageFormat.Png);

//this.subCell.Save(outputDir + "cell_" + cellx + "_" + celly + "_subcell_" + subx + "_" + suby + "_full.png", System.Drawing.Imaging.ImageFormat.Png);
gfx.Clear(Color.Transparent);
}
}
Expand Down

0 comments on commit 6e023fa

Please sign in to comment.