Fix shift-up delete sprite refreshing behavior

Party should now refresh when a member is deleted.

Thanks Alpha for reporting.
This commit is contained in:
Kurt 2015-02-27 08:18:32 -08:00
parent f773c95a16
commit 942325404e

View file

@ -3554,15 +3554,15 @@ namespace PKHeX
byte[] pkxdata = new byte[0x104]; byte[] pkxdata = new byte[0x104];
byte[] ekxdata = PKX.encryptArray(pkxdata); byte[] ekxdata = PKX.encryptArray(pkxdata);
savedited = true;
if (slot >= 30 && slot < 36) // Party 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)) else if (slot < 30 || (slot >= 36 && slot < 42 && DEV_Ability.Enabled))
{ Array.Copy(ekxdata, 0, savefile, offset, 0xE8); } { Array.Copy(ekxdata, 0, savefile, offset, 0xE8); }
else return; else return;
getQuickFiller(getPictureBox(slot), pkxdata); getQuickFiller(getPictureBox(slot), pkxdata);
savedited = true;
getSlotColor(slot, Properties.Resources.slotDel); getSlotColor(slot, Properties.Resources.slotDel);
} }
private void clickClone(object sender, EventArgs e) private void clickClone(object sender, EventArgs e)
@ -3634,10 +3634,7 @@ namespace PKHeX
byte[] decdata = PKX.decryptArray(data); byte[] decdata = PKX.decryptArray(data);
int species = BitConverter.ToInt16(decdata, 8); int species = BitConverter.ToInt16(decdata, 8);
if ((species != 0) && (species < 722)) if ((species != 0) && (species < 722))
{ Array.Copy(data, 0, savefile, offset + (partymembers++) * 0x104, 0x104);
Array.Copy(data, 0, savefile, offset + (partymembers) * 0x104, 0x104);
partymembers++; // Copy in our party member
}
} }
// Write in the current party count // Write in the current party count
@ -3658,10 +3655,7 @@ namespace PKHeX
byte[] decdata = PKX.decryptArray(data); byte[] decdata = PKX.decryptArray(data);
int species = BitConverter.ToInt16(decdata, 8); int species = BitConverter.ToInt16(decdata, 8);
if ((species != 0) && (species < 722)) if ((species != 0) && (species < 722))
{ Array.Copy(data, 0, savefile, offset2 + (battlemem++) * 0xE8, 0xE8);
Array.Copy(data, 0, savefile, offset2 + (battlemem) * 0xE8, 0xE8);
battlemem++; // Copy in our party member
}
} }
// Zero out the party slots that are empty. // Zero out the party slots that are empty.
@ -3672,6 +3666,13 @@ namespace PKHeX
if (battlemem == 0) if (battlemem == 0)
savefile[offset2 + 6 * 0xE8 + savindex * 0x7F000] = 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; return partymembers;
} }
private int getPKXOffset(int slot) private int getPKXOffset(int slot)