diff --git a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan8.cs b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan8.cs index 8af91af16..a7a831b73 100644 --- a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan8.cs +++ b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan8.cs @@ -141,8 +141,8 @@ namespace PKHeX.Core public override bool GetCaught(int species) => GetCaughtFlagID(species, 0); public void SetCaught(int species, bool value = true) => SetCaughtFlagID(species, 0, value); - public bool GetCaughtUnkFlag(int species) => GetCaughtFlagID(species, 1); - public void SetCaughtUnkFlag(int species, bool value = true) => SetCaughtFlagID(species, 1, value); + public bool GetCaughtGigantamaxed(int species) => GetCaughtFlagID(species, 1); + public void SetCaughtGigantamax(int species, bool value = true) => SetCaughtFlagID(species, 1, value); public bool GetIsLanguageIndexObtained(int species, int langIndex) => GetCaughtFlagID(species, 2 + langIndex); public void SetIsLanguageIndexObtained(int species, int langIndex, bool value = true) => SetCaughtFlagID(species, 2 + langIndex, value); @@ -318,35 +318,43 @@ namespace PKHeX.Core private void SeenAll(int species, int fc, bool shinyToo, bool value = true) { var pt = PersonalTable.SWSH; - for (int i = 0; i < fc; i++) + for (int form = 0; form < fc; form++) { - var pi = pt.GetFormeEntry(species, i); - if (pi.IsDualGender || !value) - { - SetSeenRegion(species, i, 0, value); - SetSeenRegion(species, i, 1, value); - if (!shinyToo && value) - continue; - SetSeenRegion(species, i, 2, value); - SetSeenRegion(species, i, 3, value); - } - else - { - var index = pi.OnlyFemale ? 1 : 0; - SetSeenRegion(species, i, 0 + index); - if (!shinyToo) - continue; - SetSeenRegion(species, i, 2 + index); - } + var pi = pt.GetFormeEntry(species, form); + SeenAll(species, form, value, pi, shinyToo); } if (!value) + ClearGigantamaxFlags(species); + } + + private void SeenAll(int species, int bitIndex, bool value, PersonalInfo pi, bool shinyToo) + { + if (pi.IsDualGender || !value) { - SetSeenRegion(species, 63, 0, false); - SetSeenRegion(species, 63, 1, false); - SetSeenRegion(species, 63, 2, false); - SetSeenRegion(species, 63, 3, false); + SetSeenRegion(species, bitIndex, 0, value); + SetSeenRegion(species, bitIndex, 1, value); + if (!shinyToo && value) + return; + SetSeenRegion(species, bitIndex, 2, value); + SetSeenRegion(species, bitIndex, 3, value); } + else + { + var index = pi.OnlyFemale ? 1 : 0; + SetSeenRegion(species, bitIndex, 0 + index); + if (!shinyToo) + return; + SetSeenRegion(species, bitIndex, 2 + index); + } + } + + private void ClearGigantamaxFlags(int species) + { + SetSeenRegion(species, 63, 0, false); + SetSeenRegion(species, 63, 1, false); + SetSeenRegion(species, 63, 2, false); + SetSeenRegion(species, 63, 3, false); } public override void CompleteDex(bool shinyToo = false) @@ -407,14 +415,14 @@ namespace PKHeX.Core if (species == (int) Species.Alcremie) { // Alcremie forms - SeenAll((int)Species.Alcremie, 7 * 8, shinyToo, value); + for (int i = 0; i < 7 * 8; i++) + SeenAll(species, i, value, pi, shinyToo); } - else if (species == (int) Species.Eternatus) + + if (SpeciesWithGigantamaxData.Contains(species)) { - SetSeenRegion(species, 63, 0, value); - if (!shinyToo && value) - return; - SetSeenRegion(species, 63, 2, value); + SeenAll(species, 63, value, pi, shinyToo); + SetCaughtGigantamax(species); } } @@ -431,6 +439,36 @@ namespace PKHeX.Core return; Array.Clear(Block.Data, ofs, EntrySize); } + + private static readonly HashSet SpeciesWithGigantamaxData = new HashSet + { + (int)Species.Charizard, + (int)Species.Butterfree, + (int)Species.Pikachu, + (int)Species.Meowth, + (int)Species.Machamp, + (int)Species.Gengar, + (int)Species.Kingler, + (int)Species.Lapras, + (int)Species.Eevee, + (int)Species.Snorlax, + (int)Species.Garbodor, + (int)Species.Corviknight, + (int)Species.Orbeetle, + (int)Species.Drednaw, + (int)Species.Coalossal, + (int)Species.Flapple, + (int)Species.Appletun, + (int)Species.Sandaconda, + (int)Species.Toxtricity, + (int)Species.Centiskorch, + (int)Species.Hatterene, + (int)Species.Grimmsnarl, + (int)Species.Alcremie, + (int)Species.Copperajah, + (int)Species.Duraludon, + (int)Species.Eternatus, + }; #endregion } } \ No newline at end of file diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.Designer.cs index c4ca9229e..2a84ed496 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.Designer.cs @@ -63,7 +63,7 @@ this.CB_Gender = new System.Windows.Forms.ComboBox(); this.CHK_S = new System.Windows.Forms.CheckBox(); this.CHK_G = new System.Windows.Forms.CheckBox(); - this.CHK_Unk = new System.Windows.Forms.CheckBox(); + this.CHK_Gigantamaxed = new System.Windows.Forms.CheckBox(); this.NUD_Form = new System.Windows.Forms.NumericUpDown(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.L_Male = new System.Windows.Forms.Label(); @@ -419,16 +419,15 @@ this.CHK_G.Text = "Gigantamax"; this.CHK_G.UseVisualStyleBackColor = true; // - // CHK_Unk + // CHK_Gigantamaxed // - this.CHK_Unk.AutoSize = true; - this.CHK_Unk.Enabled = false; - this.CHK_Unk.Location = new System.Drawing.Point(393, 15); - this.CHK_Unk.Name = "CHK_Unk"; - this.CHK_Unk.Size = new System.Drawing.Size(92, 17); - this.CHK_Unk.TabIndex = 34; - this.CHK_Unk.Text = "UnknownFlag"; - this.CHK_Unk.UseVisualStyleBackColor = true; + this.CHK_Gigantamaxed.AutoSize = true; + this.CHK_Gigantamaxed.Location = new System.Drawing.Point(393, 15); + this.CHK_Gigantamaxed.Name = "CHK_Gigantamaxed"; + this.CHK_Gigantamaxed.Size = new System.Drawing.Size(94, 17); + this.CHK_Gigantamaxed.TabIndex = 34; + this.CHK_Gigantamaxed.Text = "Gigantamaxed"; + this.CHK_Gigantamaxed.UseVisualStyleBackColor = true; // // NUD_Form // @@ -557,7 +556,7 @@ this.ClientSize = new System.Drawing.Size(734, 454); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.NUD_Form); - this.Controls.Add(this.CHK_Unk); + this.Controls.Add(this.CHK_Gigantamaxed); this.Controls.Add(this.GB_Displayed); this.Controls.Add(this.label1); this.Controls.Add(this.L_Battled); @@ -627,7 +626,7 @@ private System.Windows.Forms.GroupBox GB_Displayed; private System.Windows.Forms.CheckBox CHK_S; private System.Windows.Forms.CheckBox CHK_G; - private System.Windows.Forms.CheckBox CHK_Unk; + private System.Windows.Forms.CheckBox CHK_Gigantamaxed; private System.Windows.Forms.NumericUpDown NUD_Form; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Label L_Male; diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.cs index e6fc9861e..879d585eb 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.cs @@ -110,7 +110,7 @@ namespace PKHeX.WinForms NUD_Form.Value = Dex.GetAltFormDisplayed(s); CHK_Caught.Checked = Dex.GetCaught(s); - CHK_Unk.Checked = Dex.GetCaughtUnkFlag(s); + CHK_Gigantamaxed.Checked = Dex.GetCaughtGigantamaxed(s); CHK_G.Checked = Dex.GetDisplayDynamaxInstead(s); CHK_S.Checked = Dex.GetDisplayShiny(s); CB_Gender.SelectedIndex = (int)Dex.GetGenderDisplayed(s); @@ -143,7 +143,7 @@ namespace PKHeX.WinForms Dex.SetAltFormDisplayed(s, (uint)NUD_Form.Value); Dex.SetCaught(s, CHK_Caught.Checked); - Dex.SetCaughtUnkFlag(s, CHK_Unk.Checked); + Dex.SetCaughtGigantamax(s, CHK_Gigantamaxed.Checked); Dex.SetGenderDisplayed(s, (uint)CB_Gender.SelectedIndex); Dex.SetDisplayDynamaxInstead(s, CHK_G.Checked); Dex.SetDisplayShiny(s, CHK_S.Checked);