Update dex form handling for dex4

still not sure if it's entirely right, but at least there's no more
exceptions
https://projectpokemon.org/home/forums/topic/48288-pokedex-error-gen-4/
This commit is contained in:
Kurt 2019-01-05 12:37:41 -08:00
parent 0c9b760470
commit e028214eab
3 changed files with 10 additions and 11 deletions

View file

@ -1133,7 +1133,7 @@ namespace PKHeX.Core
private static uint SetDexFormValues(int[] Forms, int BitsPerForm, int readCt)
{
int n1 = 0xFF >> (8 - BitsPerForm);
uint Value = 0xFFFFFFFF << (Forms.Length*BitsPerForm);
uint Value = 0xFFFFFFFF << (readCt * BitsPerForm);
for (int i = 0; i < Forms.Length; i++)
{
int val = Forms[i];

View file

@ -52,6 +52,7 @@
this.mnuCaughtAll = new System.Windows.Forms.ToolStripMenuItem();
this.mnuComplete = new System.Windows.Forms.ToolStripMenuItem();
this.mnuUpgraded = new System.Windows.Forms.ToolStripMenuItem();
this.CB_DexUpgraded = new System.Windows.Forms.ToolStripComboBox();
this.CHK_Seen = new System.Windows.Forms.CheckBox();
this.LB_Gender = new System.Windows.Forms.ListBox();
this.B_GUp = new System.Windows.Forms.Button();
@ -67,7 +68,6 @@
this.LB_Form = new System.Windows.Forms.ListBox();
this.L_Seen = new System.Windows.Forms.Label();
this.L_NotSeen = new System.Windows.Forms.Label();
this.CB_DexUpgraded = new System.Windows.Forms.ToolStripComboBox();
this.GB_Language.SuspendLayout();
this.modifyMenu.SuspendLayout();
this.SuspendLayout();
@ -185,7 +185,6 @@
this.CB_Species.Name = "CB_Species";
this.CB_Species.Size = new System.Drawing.Size(92, 21);
this.CB_Species.TabIndex = 21;
this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeCBSpecies);
this.CB_Species.SelectedValueChanged += new System.EventHandler(this.ChangeCBSpecies);
//
// B_GiveAll
@ -245,7 +244,7 @@
this.mnuComplete,
this.mnuUpgraded});
this.modifyMenu.Name = "modifyMenu";
this.modifyMenu.Size = new System.Drawing.Size(149, 114);
this.modifyMenu.Size = new System.Drawing.Size(149, 136);
//
// mnuSeenNone
//
@ -290,6 +289,12 @@
this.mnuUpgraded.Size = new System.Drawing.Size(148, 22);
this.mnuUpgraded.Text = "Dex Upgrade";
//
// CB_DexUpgraded
//
this.CB_DexUpgraded.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_DexUpgraded.Name = "CB_DexUpgraded";
this.CB_DexUpgraded.Size = new System.Drawing.Size(112, 23);
//
// CHK_Seen
//
this.CHK_Seen.AutoSize = true;
@ -431,12 +436,6 @@
this.L_NotSeen.TabIndex = 58;
this.L_NotSeen.Text = "Not Seen";
//
// CB_DexUpgraded
//
this.CB_DexUpgraded.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_DexUpgraded.Name = "CB_DexUpgraded";
this.CB_DexUpgraded.Size = new System.Drawing.Size(112, 23);
//
// SAV_Pokedex4
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View file

@ -144,7 +144,7 @@ namespace PKHeX.WinForms
string[] formNames = GetFormNames4Dex(species);
var seen = forms.Where(z => z >= 0 && z < forms.Length).Select((_, i) => formNames[forms[i]]).ToArray();
var seen = forms.Where(z => z >= 0 && z < forms.Length).Distinct().Select((_, i) => formNames[forms[i]]).ToArray();
var not = formNames.Where(z => !seen.Contains(z)).ToArray();
LB_Form.Items.AddRange(seen);