- Dec 6, 2013
- 816
- 51
- 90
is there an option to take a full map screenshot in the map editor, the scale of the map in game?
real scale not zoomed out
is it easy to implement? if it doesn't exist
real scale not zoomed out
is it easy to implement? if it doesn't exist
Code:
public void createMiniMap()
{
Bitmap miniBitmap = new Bitmap(mapWidth * 12, mapHeight * 8, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
//backimage
for (int y = 0; y <= mapHeight - 1; y++)
{
for (int x = 0; x <= mapWidth - 1; x++)
{
if ((M2CellInfo[x, y].BackImage & 0x1FFFFFFF) != 0)
{
try
{
Libraries.MapLibs[M2CellInfo[x, y].BackIndex].CheckImage((M2CellInfo[x, y].BackImage & 0x1FFFFFFF) - 1);
var mi = Libraries.MapLibs[M2CellInfo[x, y].BackIndex].Images[(M2CellInfo[x, y].BackImage & 0x1FFFFFFF) - 1];
if (mi.Image != null || mi.ImageTexture != null)
{
using (Graphics g = Graphics.FromImage(miniBitmap))
{
Rectangle temprect = new Rectangle((x * 12), (y * 8), 24, 16);
g.DrawImage(mi.Image, temprect);
}
}
}
catch
{
}
}
x++;
}
y++;
}
//MiddleImage
for (int y = 0; y <= mapHeight - 1; y++)
{
for (int x = 0; x <= mapWidth - 1; x++)
{
if ((M2CellInfo[x, y].MiddleImage) != 0)
{
try
{
Libraries.MapLibs[M2CellInfo[x, y].MiddleIndex].CheckImage((M2CellInfo[x, y].MiddleImage) - 1);
var mi = Libraries.MapLibs[M2CellInfo[x, y].MiddleIndex].Images[(M2CellInfo[x, y].MiddleImage) - 1];
if (mi.Image != null || mi.ImageTexture != null)
{
using (Graphics g = Graphics.FromImage(miniBitmap))
{
Rectangle temprect = new Rectangle((x * 12), (y * 8) - (mi.Image.Height / 4) + 8, mi.Image.Width / 4, mi.Image.Height / 4);
g.DrawImage(mi.Image, temprect);
}
}
}
catch
{
}
}
}
}
//FrontImage
for (int y = 0; y <= mapHeight - 1; y++)
{
for (int x = 0; x <= mapWidth - 1; x++)
{
if ((M2CellInfo[x, y].FrontImage & 0x7FFF) != 0 && (M2CellInfo[x, y].FrontAnimationFrame & 0x80) < 1) //skips drawing if image is animated <<will this cause missing spots for waterfalls and such?
{
try
{
Libraries.MapLibs[M2CellInfo[x, y].FrontIndex].CheckImage((M2CellInfo[x, y].FrontImage & 0x7FFF) - 1);
var mi = Libraries.MapLibs[M2CellInfo[x, y].FrontIndex].Images[(M2CellInfo[x, y].FrontImage & 0x7FFF) - 1];
if (mi.Image != null || mi.ImageTexture != null)
{
using (Graphics g = Graphics.FromImage(miniBitmap))
{
Rectangle temprect = new Rectangle((x * 12), (y * 8) - (mi.Image.Height / 4) + 8, mi.Image.Width / 4, mi.Image.Height / 4);
g.DrawImage(mi.Image, temprect);
}
}
}
catch
{
}
}
}
}
miniBitmap = new Bitmap(miniBitmap, (miniBitmap.Width), (miniBitmap.Height));
string SimpleFileName = Path.GetDirectoryName(mapFileName) + @"\" + Path.GetFileNameWithoutExtension(mapFileName);
//MessageBox.Show(SimpleFileName);
miniBitmap.Save(SimpleFileName + "_MiniMap.png", ImageFormat.Png);
MessageBox.Show("Saved... " + SimpleFileName + "_MiniMap.png"); //TODO: this shows even if failed to save
Last edited: