mirror of
https://github.com/kwsch/pkNX.git
synced 2026-08-23 19:04:42 -05:00
Fix evo editor (#249)
* Rename to Species * Use Graphics to resize image * Fix evo editor Not the best/fastest method, but at least its functional now
This commit is contained in:
@@ -23,7 +23,7 @@ public class EvolutionTable8 : IFlatBufferArchive<EvolutionSet8a>
|
||||
[FlatBufferTable, TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class EvolutionSet8a
|
||||
{
|
||||
[FlatBufferItem(0)] public ushort Index { get; set; }
|
||||
[FlatBufferItem(0)] public ushort Species { get; set; }
|
||||
[FlatBufferItem(1)] public ushort Form { get; set; }
|
||||
[FlatBufferItem(2)] public EvolutionEntry8a[]? Table { get; set; } = Array.Empty<EvolutionEntry8a>();
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ public void DumpEvolutionBinary()
|
||||
var e = obj.Table[i];
|
||||
if (e.Table?.Length is not > 0)
|
||||
continue;
|
||||
var index = pt.GetFormIndex(e.Index, (byte)e.Form);
|
||||
var index = pt.GetFormIndex(e.Species, (byte)e.Form);
|
||||
var entry = (IPersonalInfoPLA)pt[index];
|
||||
if (!entry.IsPresentInGame)
|
||||
continue;
|
||||
|
||||
@@ -188,7 +188,7 @@ private void AddLearnsets(List<string> lines, string specCode, int species, int
|
||||
|
||||
private void AddEvolutions(List<string> lines, int species, int form)
|
||||
{
|
||||
var evo = Array.Find(Evos, z => z.Index == species && z.Form == form);
|
||||
var evo = Array.Find(Evos, z => z.Species == species && z.Form == form);
|
||||
if (evo?.Table is null)
|
||||
return;
|
||||
var evo2 = evo.Table.Where(z => z.Species != 0).ToArray();
|
||||
|
||||
@@ -426,7 +426,7 @@ public void EditEvolutions()
|
||||
{
|
||||
var names = ROM.GetStrings(TextName.SpeciesNames);
|
||||
PopFlat<EvolutionTable8, EvolutionSet8a>(GameFile.Evolutions, "Evolution Editor",
|
||||
z => $"{names[z.Index]}{(z.Form != 0 ? $"-{z.Form}" : "")}");
|
||||
z => $"{names[z.Species]}{(z.Form != 0 ? $"-{z.Form}" : "")}");
|
||||
}
|
||||
|
||||
public void EditOutbreakDetail()
|
||||
|
||||
@@ -194,24 +194,25 @@ private void LoadIndex(int index)
|
||||
var form = formVal[index];
|
||||
LoadPersonal((IPersonalInfoPLA)Data.PersonalData[index]);
|
||||
LoadLearnset(Editor.Learn[index]);
|
||||
LoadEvolutions(Editor.Evolve[index]);
|
||||
var evoTable = Editor.Evolve.Root.Table;
|
||||
LoadEvolutions(evoTable.FirstOrDefault(x => x.Species == spec && x.Form == form));
|
||||
|
||||
Bitmap rawImg = (Bitmap)SpriteUtil.GetSprite(spec, form, 0, 0, false, false, false);
|
||||
Bitmap bigImg = new(rawImg.Width * 2, rawImg.Height * 2);
|
||||
for (int x = 0; x < rawImg.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < rawImg.Height; y++)
|
||||
{
|
||||
Color c = rawImg.GetPixel(x, y);
|
||||
bigImg.SetPixel(2 * x, 2 * y, c);
|
||||
bigImg.SetPixel((2 * x) + 1, 2 * y, c);
|
||||
bigImg.SetPixel(2 * x, (2 * y) + 1, c);
|
||||
bigImg.SetPixel((2 * x) + 1, (2 * y) + 1, c);
|
||||
}
|
||||
}
|
||||
Bitmap bigImg = ResizeBitmap(rawImg, rawImg.Width * 2, rawImg.Height * 2);
|
||||
PB_MonSprite.Image = bigImg;
|
||||
}
|
||||
|
||||
private Bitmap ResizeBitmap(Bitmap sourceBMP, int width, int height)
|
||||
{
|
||||
Bitmap result = new(width, height);
|
||||
using (Graphics g = Graphics.FromImage(result))
|
||||
{
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
g.DrawImage(sourceBMP, 0, 0, width, height);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void SaveCurrent()
|
||||
{
|
||||
SavePersonal();
|
||||
|
||||
Reference in New Issue
Block a user