mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-01 21:02:32 -05:00
Redo prior g5 roamer commit
switch to list to allow/add unknown value option #1358
This commit is contained in:
parent
866e8fd485
commit
2faf6ae8e5
|
|
@ -78,10 +78,6 @@ private void InitializeComponent()
|
|||
this.CB_PassPower3 = new System.Windows.Forms.ComboBox();
|
||||
this.CB_PassPower2 = new System.Windows.Forms.ComboBox();
|
||||
this.CB_PassPower1 = new System.Windows.Forms.ComboBox();
|
||||
this.CHK_641_0x40 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_642_0x40 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_642_0x80 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_641_0x80 = new System.Windows.Forms.CheckBox();
|
||||
this.TC_Misc.SuspendLayout();
|
||||
this.TAB_Main.SuspendLayout();
|
||||
this.GB_KeySystem.SuspendLayout();
|
||||
|
|
@ -195,17 +191,13 @@ private void InitializeComponent()
|
|||
//
|
||||
// GB_Roamer
|
||||
//
|
||||
this.GB_Roamer.Controls.Add(this.CHK_641_0x80);
|
||||
this.GB_Roamer.Controls.Add(this.CHK_642_0x80);
|
||||
this.GB_Roamer.Controls.Add(this.CHK_642_0x40);
|
||||
this.GB_Roamer.Controls.Add(this.CHK_641_0x40);
|
||||
this.GB_Roamer.Controls.Add(this.L_Roamer642);
|
||||
this.GB_Roamer.Controls.Add(this.L_Roamer641);
|
||||
this.GB_Roamer.Controls.Add(this.CB_Roamer642);
|
||||
this.GB_Roamer.Controls.Add(this.CB_Roamer641);
|
||||
this.GB_Roamer.Location = new System.Drawing.Point(6, 151);
|
||||
this.GB_Roamer.Name = "GB_Roamer";
|
||||
this.GB_Roamer.Size = new System.Drawing.Size(227, 76);
|
||||
this.GB_Roamer.Size = new System.Drawing.Size(212, 76);
|
||||
this.GB_Roamer.TabIndex = 1;
|
||||
this.GB_Roamer.TabStop = false;
|
||||
this.GB_Roamer.Text = "Roamer";
|
||||
|
|
@ -230,18 +222,22 @@ private void InitializeComponent()
|
|||
//
|
||||
// CB_Roamer642
|
||||
//
|
||||
this.CB_Roamer642.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CB_Roamer642.FormattingEnabled = true;
|
||||
this.CB_Roamer642.Location = new System.Drawing.Point(88, 48);
|
||||
this.CB_Roamer642.Name = "CB_Roamer642";
|
||||
this.CB_Roamer642.Size = new System.Drawing.Size(82, 21);
|
||||
this.CB_Roamer642.Size = new System.Drawing.Size(118, 21);
|
||||
this.CB_Roamer642.TabIndex = 1;
|
||||
//
|
||||
// CB_Roamer641
|
||||
//
|
||||
this.CB_Roamer641.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CB_Roamer641.FormattingEnabled = true;
|
||||
this.CB_Roamer641.Location = new System.Drawing.Point(88, 20);
|
||||
this.CB_Roamer641.Name = "CB_Roamer641";
|
||||
this.CB_Roamer641.Size = new System.Drawing.Size(82, 21);
|
||||
this.CB_Roamer641.Size = new System.Drawing.Size(118, 21);
|
||||
this.CB_Roamer641.TabIndex = 0;
|
||||
//
|
||||
// GB_FlyDest
|
||||
|
|
@ -712,42 +708,6 @@ private void InitializeComponent()
|
|||
this.CB_PassPower1.Size = new System.Drawing.Size(125, 21);
|
||||
this.CB_PassPower1.TabIndex = 0;
|
||||
//
|
||||
// CHK_641_0x40
|
||||
//
|
||||
this.CHK_641_0x40.AutoSize = true;
|
||||
this.CHK_641_0x40.Location = new System.Drawing.Point(175, 23);
|
||||
this.CHK_641_0x40.Name = "CHK_641_0x40";
|
||||
this.CHK_641_0x40.Size = new System.Drawing.Size(15, 14);
|
||||
this.CHK_641_0x40.TabIndex = 4;
|
||||
this.CHK_641_0x40.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_642_0x40
|
||||
//
|
||||
this.CHK_642_0x40.AutoSize = true;
|
||||
this.CHK_642_0x40.Location = new System.Drawing.Point(175, 52);
|
||||
this.CHK_642_0x40.Name = "CHK_642_0x40";
|
||||
this.CHK_642_0x40.Size = new System.Drawing.Size(15, 14);
|
||||
this.CHK_642_0x40.TabIndex = 5;
|
||||
this.CHK_642_0x40.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_642_0x80
|
||||
//
|
||||
this.CHK_642_0x80.AutoSize = true;
|
||||
this.CHK_642_0x80.Location = new System.Drawing.Point(192, 52);
|
||||
this.CHK_642_0x80.Name = "CHK_642_0x80";
|
||||
this.CHK_642_0x80.Size = new System.Drawing.Size(15, 14);
|
||||
this.CHK_642_0x80.TabIndex = 6;
|
||||
this.CHK_642_0x80.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_641_0x80
|
||||
//
|
||||
this.CHK_641_0x80.AutoSize = true;
|
||||
this.CHK_641_0x80.Location = new System.Drawing.Point(192, 23);
|
||||
this.CHK_641_0x80.Name = "CHK_641_0x80";
|
||||
this.CHK_641_0x80.Size = new System.Drawing.Size(15, 14);
|
||||
this.CHK_641_0x80.TabIndex = 7;
|
||||
this.CHK_641_0x80.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// SAV_Misc5
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
@ -765,7 +725,6 @@ private void InitializeComponent()
|
|||
this.TAB_Main.PerformLayout();
|
||||
this.GB_KeySystem.ResumeLayout(false);
|
||||
this.GB_Roamer.ResumeLayout(false);
|
||||
this.GB_Roamer.PerformLayout();
|
||||
this.GB_FlyDest.ResumeLayout(false);
|
||||
this.TAB_Entralink.ResumeLayout(false);
|
||||
this.GB_EntreeLevel.ResumeLayout(false);
|
||||
|
|
@ -837,9 +796,5 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.CheckBox CHK_FMNew;
|
||||
private System.Windows.Forms.NumericUpDown NUD_EntreeWhiteEXP;
|
||||
private System.Windows.Forms.NumericUpDown NUD_EntreeBlackEXP;
|
||||
private System.Windows.Forms.CheckBox CHK_641_0x80;
|
||||
private System.Windows.Forms.CheckBox CHK_642_0x80;
|
||||
private System.Windows.Forms.CheckBox CHK_642_0x40;
|
||||
private System.Windows.Forms.CheckBox CHK_641_0x40;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using PKHeX.Core;
|
||||
|
|
@ -32,7 +33,6 @@ private void B_Save_Click(object sender, EventArgs e)
|
|||
}
|
||||
|
||||
private ComboBox[] cbr;
|
||||
private CheckBox[][] chk;
|
||||
private int ofsFly;
|
||||
private int[] FlyDestC;
|
||||
private const int ofsRoamer = 0x21B00;
|
||||
|
|
@ -108,8 +108,7 @@ private void ReadMain()
|
|||
GB_KeySystem.Visible = false;
|
||||
// Roamer
|
||||
cbr = new[] { CB_Roamer642, CB_Roamer641 };
|
||||
chk = new[] {new[] {CHK_642_0x40, CHK_642_0x80}, new[] {CHK_641_0x40, CHK_641_0x80}};
|
||||
ComboItem[] states = {
|
||||
List<ComboItem> getStates() => new List<ComboItem> {
|
||||
new ComboItem { Text = "Not roamed", Value = 0 },
|
||||
new ComboItem { Text = "Roaming", Value = 1 },
|
||||
new ComboItem { Text = "Defeated", Value = 2 },
|
||||
|
|
@ -123,18 +122,16 @@ private void ReadMain()
|
|||
// Top 2 bit acts as flags of some sorts
|
||||
for (int i = 0; i < cbr.Length; i++)
|
||||
{
|
||||
var val = SAV.Data[ofsRoamer + 0x2E + i];
|
||||
int c = val & 0x3F;
|
||||
int c = SAV.Data[ofsRoamer + 0x2E + i];
|
||||
|
||||
var states = getStates();
|
||||
if (states.All(z => z.Value != c))
|
||||
states.Add(new ComboItem {Text = $"Unknown (0x{c:X2})", Value = c});
|
||||
cbr[i].Items.Clear();
|
||||
cbr[i].DisplayMember = "Text";
|
||||
cbr[i].ValueMember = "Value";
|
||||
cbr[i].DataSource = new BindingSource(states.Where(v => v.Value >= 2 || v.Value == c).ToList(), null);
|
||||
cbr[i].SelectedValue = c;
|
||||
|
||||
var ck = chk[i];
|
||||
for (int j = 0; j < ck.Length; j++)
|
||||
ck[j].Checked = (val & 1 << 6 + j) != 0;
|
||||
}
|
||||
|
||||
// LibertyPass
|
||||
|
|
@ -185,11 +182,7 @@ private void SaveMain()
|
|||
for (int i = 0; i < cbr.Length; i++)
|
||||
{
|
||||
int c = SAV.Data[ofsRoamer + 0x2E + i];
|
||||
var ck = chk[i];
|
||||
var d = (int)cbr[i].SelectedValue;
|
||||
for (int j = 0; j < ck.Length; j++)
|
||||
if (ck[j].Checked)
|
||||
d |= 1 << (6 + j);
|
||||
|
||||
if (c == d)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user