mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-10-02 05:46:47 -05:00
Store unaltered image
If I somehow want to reload entities from OWSE without regenerating the map image. Entity images are a little more opaque. 40%->66%
This commit is contained in:
@@ -38,60 +38,67 @@ public Image getMapImage(bool crop = false, bool entity = true)
|
||||
mapScale = (int)NUD_Scale.Value;
|
||||
Image img = mm.Preview(mapScale, (int)NUD_Flavor.Value);
|
||||
|
||||
baseImage = (Image)img.Clone();
|
||||
if (entity && mapScale == 8)
|
||||
{
|
||||
const float opacity = 0.5f;
|
||||
// Overlay every... overworld entity
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Furniture)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.WX; sx++) // Stretch X
|
||||
for (int sy = 0; sy < e.WY; sy++) // Stretch Y
|
||||
try { Util.LayerImage(img, Resources.F, (x+sx)*mapScale, (y+sy)*mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.NPCs)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
try { Util.LayerImage(img, Resources.N, x * mapScale, y * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Warps)
|
||||
{
|
||||
int x = (int)e.pX; // shifted warps look weird
|
||||
int y = (int)e.pY; // shifted warps look weird
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
try { Util.LayerImage(img, Resources.W, ((x+sx)*mapScale), ((y+sy)*mapScale), opacity); }
|
||||
catch { }
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Triggers1)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
try { Util.LayerImage(img, Resources.T1, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Triggers2)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
try { Util.LayerImage(img, Resources.T2, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
img = overlayEntities(img);
|
||||
if (crop)
|
||||
img = Util.TrimBitmap((Bitmap)img);
|
||||
OWSE.mm = mm;
|
||||
return img;
|
||||
}
|
||||
|
||||
internal static Image baseImage;
|
||||
|
||||
private Image overlayEntities(Image img)
|
||||
{
|
||||
const float opacity = 0.66f;
|
||||
// Overlay every... overworld entity
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Furniture)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.WX; sx++) // Stretch X
|
||||
for (int sy = 0; sy < e.WY; sy++) // Stretch Y
|
||||
try { Util.LayerImage(img, Resources.F, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.NPCs)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
try { Util.LayerImage(img, Resources.N, x * mapScale, y * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Warps)
|
||||
{
|
||||
int x = (int)e.pX; // shifted warps look weird
|
||||
int y = (int)e.pY; // shifted warps look weird
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
try { Util.LayerImage(img, Resources.W, ((x + sx) * mapScale), ((y + sy) * mapScale), opacity); }
|
||||
catch { }
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Triggers1)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
try { Util.LayerImage(img, Resources.T1, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Triggers2)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
try { Util.LayerImage(img, Resources.T2, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
// UI
|
||||
private void hoverMap(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user