mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Misc tweaks
possibly fix UI not-1x scaling screwing up drawn pkm images with items/shiny/illegal. simplify some logic -> speed improvements (wow so noticable /s)
This commit is contained in:
parent
21c1dde3a7
commit
2dbdb35955
6 changed files with 14 additions and 94 deletions
|
@ -666,9 +666,6 @@ namespace PKHeX.Core
|
|||
|
||||
public byte[] GetData(int Offset, int Length)
|
||||
{
|
||||
if (Offset + Length > Data.Length)
|
||||
return null;
|
||||
|
||||
byte[] data = new byte[Length];
|
||||
Buffer.BlockCopy(Data, Offset, data, 0, Length);
|
||||
return data;
|
||||
|
@ -678,6 +675,13 @@ namespace PKHeX.Core
|
|||
input.CopyTo(Data, Offset);
|
||||
Edited = true;
|
||||
}
|
||||
public bool IsRangeEmpty(int Offset, int Length)
|
||||
{
|
||||
for (int i = Offset; i < Offset + Length; i++)
|
||||
if (Data[i] != 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract string GetString(int Offset, int Length);
|
||||
public abstract byte[] SetString(string value, int maxLength, int PadToSize = 0, ushort PadWith = 0);
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BoxEditor));
|
||||
this.PAN_Box = new System.Windows.Forms.Panel();
|
||||
this.bpkx30 = new System.Windows.Forms.PictureBox();
|
||||
this.bpkx29 = new System.Windows.Forms.PictureBox();
|
||||
|
@ -98,7 +97,6 @@
|
|||
//
|
||||
// PAN_Box
|
||||
//
|
||||
this.PAN_Box.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("PAN_Box.BackgroundImage")));
|
||||
this.PAN_Box.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.PAN_Box.Controls.Add(this.bpkx30);
|
||||
this.PAN_Box.Controls.Add(this.bpkx29);
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace PKHeX.WinForms.Controls
|
|||
public int BoxSlotCount { get; }
|
||||
public SlotChangeManager M { get; set; }
|
||||
public bool FlagIllegal { get; set; }
|
||||
private const int SlotCount = 30;
|
||||
|
||||
public BoxEditor()
|
||||
{
|
||||
|
@ -194,7 +195,7 @@ namespace PKHeX.WinForms.Controls
|
|||
}
|
||||
private void GetSlotFiller(int offset, PictureBox pb, int box = -1, int slot = -1)
|
||||
{
|
||||
if (SAV.GetData(offset, SAV.SIZE_STORED).SequenceEqual(new byte[SAV.SIZE_STORED]))
|
||||
if (SAV.IsRangeEmpty(offset, SAV.SIZE_STORED))
|
||||
{
|
||||
// 00s present in slot.
|
||||
pb.Image = null;
|
||||
|
@ -224,12 +225,11 @@ namespace PKHeX.WinForms.Controls
|
|||
if (pb.Image == null)
|
||||
return;
|
||||
int slot = GetSlot(pb);
|
||||
int box = slot >= 30 ? -1 : CurrentBox;
|
||||
if (SAV.IsSlotLocked(box, slot))
|
||||
if (slot >= SlotCount || SAV.IsSlotLocked(CurrentBox, slot))
|
||||
return;
|
||||
|
||||
bool encrypt = ModifierKeys == Keys.Control;
|
||||
M.HandleMovePKM(pb, slot, box, encrypt);
|
||||
M.HandleMovePKM(pb, slot, CurrentBox, encrypt);
|
||||
}
|
||||
private void BoxSlot_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
|
@ -239,8 +239,7 @@ namespace PKHeX.WinForms.Controls
|
|||
// Abort if there is no Pokemon in the given slot.
|
||||
PictureBox pb = (PictureBox)sender;
|
||||
int slot = GetSlot(pb);
|
||||
int box = slot >= 30 ? -1 : CurrentBox;
|
||||
if (SAV.IsSlotLocked(box, slot) || slot >= 36)
|
||||
if (slot >= SlotCount || SAV.IsSlotLocked(CurrentBox, slot))
|
||||
{
|
||||
SystemSounds.Asterisk.Play();
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
|
|
|
@ -117,87 +117,6 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="PAN_Box.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAANwAAADSCAMAAAAWjl7DAAAABGdBTUEAALGPC/xhBQAAAwBQTFRFtays
|
||||
uK+vu7KyvbW1v7a2vb21wrm5w7u7xby8xb29x7+/w8O7x8e/y8O7zcW9z8e/yMDAy8PDzcXFz8fH08vD
|
||||
1s3F18/H0srK08vL1c3N18/P3NPL2tLS3NPT3dXV3NzT3t7W4NfP4NfX5NzT49ra5Nzc5t3d5t7e4ODX
|
||||
4+Pa5OTc5ubd5ube6ODX6eHZ7OTc6ODg6eHh7OTk7ubm6Ojg6enh7Ozk8Ojg9Ozk8Ojo8+vr9Ozs9u7u
|
||||
8PDo+PDo+PDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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24KgJIqtLqjvOan6ki1o5KJVDK1nLSbjYssht2y5GvIqmJBj8muVS2UGUvUykSKHBBdk
|
||||
Ml1fksn1ZETSsWuzcvtJmLynyPZM2uqylLasXU89R4Tig8FoArZuItPCroQ7za61WImh9UqPeKiPcqO0
|
||||
XMe+1ZDJEfmrZ3OvWi5K1cox2c3IRIrcqu1opO2MsR2VIouUZ2if6+JOI38TJCIUVsuBiFEmOJB4holv
|
||||
gguRy7Saf1RnyK03WutFHjx8eOCprdI0N8jDw/8B+j2Ms4z8ap8AAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="bpkx30.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
|
@ -341,7 +341,7 @@ namespace PKHeX.WinForms.Controls
|
|||
}
|
||||
private void GetSlotFiller(int offset, PictureBox pb)
|
||||
{
|
||||
if (SAV.GetData(offset, SAV.SIZE_STORED).SequenceEqual(new byte[SAV.SIZE_STORED]))
|
||||
if (SAV.IsRangeEmpty(offset, SAV.SIZE_STORED))
|
||||
{
|
||||
// 00s present in slot.
|
||||
pb.Image = null;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace PKHeX.WinForms
|
|||
Bitmap img = new Bitmap(baseLayer.Width, baseLayer.Height);
|
||||
using (Graphics gr = Graphics.FromImage(img))
|
||||
{
|
||||
gr.DrawImage(baseLayer, new Point(0, 0));
|
||||
gr.DrawImage(baseLayer, new Rectangle(0, 0, baseLayer.Width, baseLayer.Height));
|
||||
Image o = trans == 1f ? overLayer : ChangeOpacity(overLayer, trans);
|
||||
gr.DrawImage(o, new Rectangle(x, y, overLayer.Width, overLayer.Height));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue