From 942325404ed71e5718332d8215f19388cf196500 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 27 Feb 2015 08:18:32 -0800 Subject: [PATCH] Fix shift-up delete sprite refreshing behavior Party should now refresh when a member is deleted. Thanks Alpha for reporting. --- PKX/f1-Main.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/PKX/f1-Main.cs b/PKX/f1-Main.cs index b78c6a0fb..f97605073 100644 --- a/PKX/f1-Main.cs +++ b/PKX/f1-Main.cs @@ -3554,15 +3554,15 @@ namespace PKHeX byte[] pkxdata = new byte[0x104]; byte[] ekxdata = PKX.encryptArray(pkxdata); + savedited = true; + if (slot >= 30 && slot < 36) // Party - { Array.Copy(ekxdata, 0, savefile, offset, 0x104); setParty(); } + { Array.Copy(ekxdata, 0, savefile, offset, 0x104); setParty(); return; } else if (slot < 30 || (slot >= 36 && slot < 42 && DEV_Ability.Enabled)) { Array.Copy(ekxdata, 0, savefile, offset, 0xE8); } else return; getQuickFiller(getPictureBox(slot), pkxdata); - savedited = true; - getSlotColor(slot, Properties.Resources.slotDel); } private void clickClone(object sender, EventArgs e) @@ -3634,10 +3634,7 @@ namespace PKHeX byte[] decdata = PKX.decryptArray(data); int species = BitConverter.ToInt16(decdata, 8); if ((species != 0) && (species < 722)) - { - Array.Copy(data, 0, savefile, offset + (partymembers) * 0x104, 0x104); - partymembers++; // Copy in our party member - } + Array.Copy(data, 0, savefile, offset + (partymembers++) * 0x104, 0x104); } // Write in the current party count @@ -3658,10 +3655,7 @@ namespace PKHeX byte[] decdata = PKX.decryptArray(data); int species = BitConverter.ToInt16(decdata, 8); if ((species != 0) && (species < 722)) - { - Array.Copy(data, 0, savefile, offset2 + (battlemem) * 0xE8, 0xE8); - battlemem++; // Copy in our party member - } + Array.Copy(data, 0, savefile, offset2 + (battlemem++) * 0xE8, 0xE8); } // Zero out the party slots that are empty. @@ -3672,6 +3666,13 @@ namespace PKHeX if (battlemem == 0) savefile[offset2 + 6 * 0xE8 + savindex * 0x7F000] = 0; + // Refresh slots + for (int i = 0; i < 6; i++) + { + getQuickFiller(getPictureBox(i + 30), PKX.decryptArray(savefile.Skip(SaveGame.Party + 0x7F000 * savindex + 260 * i).Take(232).ToArray())); + getQuickFiller(getPictureBox(i + 36), PKX.decryptArray(savefile.Skip(SaveGame.BattleBox + 0x7F000 * savindex + 232 * i).Take(232).ToArray())); + } + return partymembers; } private int getPKXOffset(int slot)