Implement map visualization of entities

This commit is contained in:
Kurt
2015-11-11 18:30:47 -08:00
parent 59bdaa840a
commit e36fe36a9e
10 changed files with 119 additions and 7 deletions

View File

@@ -10451,7 +10451,20 @@ internal class Resources {
}
/// <summary>
/// Looks up a localized string similar to .
/// Looks up a localized string similar to pk3DS - By Kaphotics
///http://projectpokemon.org/
///http://projectpokemon.org/forums/showthread.php?44950
///
///A package of Pokémon X/Y/OR/AS tools by various contributors.
///
///GARCTool (Backbone): Kaphotics
///Text Editing (xytext): Kaphotics
///Wild Editor (**WE): SciresM &amp; Kaphotics
///Trainer Editor (**TE): SciresM, Kaphotics, and KazoWAR
///Personal Editor: SciresM
///Mega Evolution Editor (MEE): SciresM
///Evolutions, Moves, Items, Maison, Title Screen Editors: Kaphotics
///ExeFS Editors: Kaphotics (thanks Drayano and m [rest of string was truncated]&quot;;.
/// </summary>
internal static string changelog {
get {
@@ -10489,6 +10502,16 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap F {
get {
object obj = ResourceManager.GetObject("F", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -14719,6 +14742,16 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap N {
get {
object obj = ResourceManager.GetObject("N", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
@@ -14739,6 +14772,26 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap T1 {
get {
object obj = ResourceManager.GetObject("T1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap T2 {
get {
object obj = ResourceManager.GetObject("T2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -14749,6 +14802,16 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap W {
get {
object obj = ResourceManager.GetObject("W", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>

View File

@@ -4525,4 +4525,19 @@
<data name="changelog" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Misc\changelog.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="F" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\F.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="N" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\N.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="T1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\T1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="T2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\T2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="W" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\W.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

BIN
pk3DS/Resources/img/F.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

BIN
pk3DS/Resources/img/N.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

BIN
pk3DS/Resources/img/T1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

BIN
pk3DS/Resources/img/T2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

BIN
pk3DS/Resources/img/W.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

View File

@@ -2,6 +2,7 @@
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using pk3DS.Properties;
namespace pk3DS.Subforms
{
@@ -20,7 +21,7 @@ public void drawMap(int Map)
DrawMap = Map;
PB_Map.Image = (CHK_AutoDraw.Checked) ? getMapImage() : null;
}
public Image getMapImage(bool crop = false)
public Image getMapImage(bool crop = false, bool entity = true)
{
// Load MM
byte[][] MM = CTR.mini.unpackMini(File.ReadAllBytes(OWSE.MapMatrixes[DrawMap]), "MM");
@@ -34,10 +35,25 @@ public Image getMapImage(bool crop = false)
byte[][] GR = CTR.mini.unpackMini(File.ReadAllBytes(OWSE.MapGRs[mm.EntryList[i]]), "GR");
mm.Entries[i] = new MapMatrix.Entry(GR[0]);
}
Image img = mm.Preview((int)NUD_Scale.Value, (int)NUD_Flavor.Value);
mapScale = (int)NUD_Scale.Value;
Image img = mm.Preview(mapScale, (int)NUD_Flavor.Value);
if (entity && mapScale == 8)
{
// 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 { }
}
if (crop)
img = Util.TrimBitmap((Bitmap)img);
mapScale = (int)NUD_Scale.Value;
OWSE.mm = mm;
return img;
}
@@ -48,6 +64,9 @@ private void hoverMap(object sender, MouseEventArgs e)
if (mapScale < 0)
return;
if (PB_Map.Image == null)
return;
int X = e.X / (mapScale);
int Y = e.Y / (mapScale);

View File

@@ -28,7 +28,7 @@ public OWSE()
private string[] filepaths;
private string[] gameLocations = Main.getText((Main.oras) ? 90 : 72);
private string[] zdLocations;
internal static Random rand = new Random();
internal static uint rnd32()
{
@@ -67,8 +67,9 @@ private void openQuick(string[] encdata)
NUD_WMap.Maximum = zdLocations.Length; // Cap map warp destinations to the amount of maps.
}
internal static Zone CurrentZone;
internal static MapMatrix mm;
private int entry = -1;
private Zone CurrentZone;
private byte[][] locationData;
private string[] rawLocations;
private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e)
@@ -560,7 +561,6 @@ private void B_DumpUnk_Click(object sender, EventArgs e)
CB_LocationID.SelectedIndex = 0;
}
internal static MapMatrix mm;
private void B_DumpMaps_Click(object sender, EventArgs e)
{
if (Util.Prompt(MessageBoxButtons.YesNoCancel, "Export all MapImages?") != DialogResult.Yes)

View File

@@ -4749,6 +4749,21 @@
<ItemGroup>
<None Include="Misc\changelog.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\img\T2.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\img\T1.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\img\N.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\img\W.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\img\F.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.