Further map visualization improvements

now stretching furniture/warps/triggers; warps are no longer using their
absolute coordinates (0.5 -> 0.0) for visual appeal.
This commit is contained in:
Kurt
2015-11-11 19:16:17 -08:00
parent 68c486ea81
commit fd41cd3e5e
3 changed files with 50 additions and 15 deletions

View File

@@ -1316,8 +1316,8 @@ public class EntityTrigger1
public int X { get { return BitConverter.ToUInt16(Raw, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x0C); } }
public int Y { get { return BitConverter.ToUInt16(Raw, 0x0E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x0E); } }
public int U10 { get { return BitConverter.ToInt16(Raw, 0x10); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x10); } }
public int U12 { get { return BitConverter.ToInt16(Raw, 0x12); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x12); } }
public int Width { get { return BitConverter.ToInt16(Raw, 0x10); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x10); } }
public int Height { get { return BitConverter.ToInt16(Raw, 0x12); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x12); } }
public int U14 { get { return BitConverter.ToInt16(Raw, 0x14); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x14); } }
public int U16 { get { return BitConverter.ToInt16(Raw, 0x16); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x16); } }
@@ -1349,8 +1349,8 @@ public class EntityTrigger2
public int X { get { return BitConverter.ToUInt16(Raw, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x0C); } }
public int Y { get { return BitConverter.ToUInt16(Raw, 0x0E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x0E); } }
public int U10 { get { return BitConverter.ToInt16(Raw, 0x10); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x10); } }
public int U12 { get { return BitConverter.ToInt16(Raw, 0x12); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x12); } }
public int Width { get { return BitConverter.ToInt16(Raw, 0x10); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x10); } }
public int Height { get { return BitConverter.ToInt16(Raw, 0x12); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x12); } }
public int U14 { get { return BitConverter.ToInt16(Raw, 0x14); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x14); } }
public int U16 { get { return BitConverter.ToInt16(Raw, 0x16); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x16); } }

View File

@@ -162,9 +162,10 @@ private void InitializeComponent()
this.Controls.Add(this.NUD_Scale);
this.Controls.Add(this.L_Flavor);
this.Controls.Add(this.NUD_Flavor);
this.MinimumSize = new System.Drawing.Size(505, 505);
this.Name = "MapPermView";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "MapPermView";
this.Text = "Map Viewer";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MapPermView_FormClosing);
this.PAN_MAP.ResumeLayout(false);
this.PAN_MAP.PerformLayout();

View File

@@ -40,17 +40,51 @@ public Image getMapImage(bool crop = false, bool entity = true)
if (entity && mapScale == 8)
{
const float opacity = 0.5f;
// Overlay every... overworld entity
foreach (var f in OWSE.CurrentZone.Entities.Furniture)
try { Util.LayerImage(img, Resources.F, f.X * mapScale, f.Y * mapScale, 0.8); } catch {}
foreach (var f in OWSE.CurrentZone.Entities.NPCs)
try { Util.LayerImage(img, Resources.N, f.X * mapScale, f.Y * mapScale, 0.8); } catch {}
foreach (var f in OWSE.CurrentZone.Entities.Warps)
try { Util.LayerImage(img, Resources.W, (int)(f.pX * mapScale), (int)(f.pY * mapScale), 0.8); } catch {}
foreach (var f in OWSE.CurrentZone.Entities.Triggers1)
try { Util.LayerImage(img, Resources.T1, f.X * mapScale, f.Y * mapScale, 0.8); } catch {}
foreach (var f in OWSE.CurrentZone.Entities.Triggers2)
try { Util.LayerImage(img, Resources.T2, f.X * mapScale, f.Y * mapScale, 0.8); } catch { }
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 { }
}
}
if (crop)
img = Util.TrimBitmap((Bitmap)img);