Retain existing shiny flags on complete dex

Closes #4344
This commit is contained in:
Kurt 2024-08-17 23:04:37 -05:00
parent 9d06a2bc2d
commit 27b552db13
3 changed files with 19 additions and 8 deletions

View file

@ -361,6 +361,8 @@ public sealed class Zukan8b(SAV8BS sav, Memory<byte> dex) : ZukanBase<SAV8BS>(sa
}
}
private bool GetGenderFlagMale(ushort species, bool shiny) => GetBoolean(species - 1, shiny ? OFS_MALESHINY : OFS_MALE);
private bool GetGenderFlagFemale(ushort species, bool shiny) => GetBoolean(species - 1, shiny ? OFS_FEMALESHINY : OFS_FEMALE);
private void SetGenderFlagMale(ushort species, bool shiny) => SetBoolean(species - 1, shiny ? OFS_MALESHINY : OFS_MALE, true);
private void SetGenderFlagFemale(ushort species, bool shiny) => SetBoolean(species - 1, shiny ? OFS_FEMALESHINY : OFS_FEMALE, true);
@ -383,14 +385,16 @@ public sealed class Zukan8b(SAV8BS sav, Memory<byte> dex) : ZukanBase<SAV8BS>(sa
public override void SeenAll(bool shinyToo = false)
{
var pt = Personal;
for (ushort i = 1; i <= Legal.MaxSpeciesID_4; i++)
for (ushort species = 1; species <= Legal.MaxSpeciesID_4; species++)
{
if (!GetSeen(i))
SetState(i, ZukanState8b.Seen);
var pi = pt[i];
if (!GetSeen(species))
SetState(species, ZukanState8b.Seen);
var pi = pt[species];
var m = !pi.OnlyFemale;
var f = !pi.OnlyMale;
SetGenderFlags(i, m, f, m && shinyToo, f && shinyToo);
var ms = m && (shinyToo || GetGenderFlagMale(species, true));
var fs = f && (shinyToo || GetGenderFlagFemale(species, true));
SetGenderFlags(species, m, f, ms, fs);
}
}
@ -426,7 +430,9 @@ public sealed class Zukan8b(SAV8BS sav, Memory<byte> dex) : ZukanBase<SAV8BS>(sa
var pi = pt[species];
var m = !pi.OnlyFemale;
var f = !pi.OnlyMale;
SetGenderFlags(species, m, f, m && shinyToo, f && shinyToo);
var ms = m && (shinyToo || GetGenderFlagMale(species, true));
var fs = f && (shinyToo || GetGenderFlagFemale(species, true));
SetGenderFlags(species, m, f, ms, fs);
}
else
{
@ -443,7 +449,9 @@ public sealed class Zukan8b(SAV8BS sav, Memory<byte> dex) : ZukanBase<SAV8BS>(sa
var pi = pt[species];
var m = !pi.OnlyFemale;
var f = !pi.OnlyMale;
SetGenderFlags(species, m, f, m && shinyToo, f && shinyToo);
var ms = m && (shinyToo || GetGenderFlagMale(species, true));
var fs = f && (shinyToo || GetGenderFlagFemale(species, true));
SetGenderFlags(species, m, f, ms, fs);
var formCount = GetFormCount(species);
if (formCount is not 0)

View file

@ -118,7 +118,9 @@ public sealed class Zukan9Kitakami(SAV9SV sav, SCBlock Block) : ZukanBase<SAV9SV
// Wipe existing gender flags.
var entry = Get(species);
entry.FlagsGenderSeen = 0;
entry.FlagsShinySeen = (byte)(value ? shinyToo ? 3 : 1 : 0);
entry.SetIsModelSeen(false, true); // should always be bit0=1
if (!value || shinyToo)
entry.SetIsModelSeen(true, value);
var pt = SAV.Personal;
for (byte form = 0; form < formCount; form++)

View file

@ -182,6 +182,7 @@ public partial class SAV_PokedexBDSP : Form
Zukan.CompleteDex(ModifierKeys == Keys.Control);
GetEntry();
System.Media.SystemSounds.Asterisk.Play();
}
private void ModifyAllForms(object sender, EventArgs e)