From dc9c75911c7c1aa602ea2948aa034e75a41ebd4f Mon Sep 17 00:00:00 2001 From: AdAstra-LD <76622070+AdAstra-LD@users.noreply.github.com> Date: Sun, 1 Aug 2021 03:09:16 +0200 Subject: [PATCH] Fixed Pokemon Icons not disappearing after selecting empty cell [Trainer Editor[ - Also fixed Farfetch'd icon not showing --- DS_Map/Main Window.cs | 39 +++++++++++++++----------------------- DS_Map/ROMToolboxDialog.cs | 3 ++- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index 564b01f..47c5a8e 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -6926,7 +6926,10 @@ namespace DSPRE { string pokeName = txtInfo.ToTitleCase(toFix.ToLower()); pokeName = pokeName.Replace(" ", "_"); pokeName = pokeName.Replace("'", "_"); + pokeName = pokeName.Replace("’", "_"); pokeName = pokeName.Replace(":", "_"); + pokeName = pokeName.Replace("_D", "_d"); //Fix Farfetch'd + pokeName = pokeName.Replace("♀", "F"); pokeName = pokeName.Replace("♂", "M"); return pokeName; @@ -6936,20 +6939,16 @@ namespace DSPRE { currentTrainerFile.party[0].pokeID = (ushort)partyPokemon1ComboBox.SelectedIndex; } ComboBox cb = (ComboBox)sender; - if (cb.SelectedIndex > 0) { - Image pokeIcon = (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])); - partyPokemon1PictureBox.Image = pokeIcon; - } + Image pokeIcon = cb.SelectedIndex > 0 ? (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])) : null; + partyPokemon1PictureBox.Image = pokeIcon; } private void partyPokemon2ComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (!disableHandlers) { currentTrainerFile.party[1].pokeID = (ushort)partyPokemon2ComboBox.SelectedIndex; } ComboBox cb = (ComboBox)sender; - if (cb.SelectedIndex > 0) { - Image pokeIcon = (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])); - partyPokemon2PictureBox.Image = pokeIcon; - } + Image pokeIcon = cb.SelectedIndex > 0 ? (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])) : null; + partyPokemon2PictureBox.Image = pokeIcon; } private void partyPokemon3ComboBox_SelectedIndexChanged(object sender, EventArgs e) { @@ -6957,10 +6956,8 @@ namespace DSPRE { currentTrainerFile.party[2].pokeID = (ushort)partyPokemon3ComboBox.SelectedIndex; } ComboBox cb = (ComboBox)sender; - if (cb.SelectedIndex > 0) { - Image pokeIcon = (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])); - partyPokemon3PictureBox.Image = pokeIcon; - } + Image pokeIcon = cb.SelectedIndex > 0 ? (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])) : null; + partyPokemon3PictureBox.Image = pokeIcon; } private void partyPokemon4ComboBox_SelectedIndexChanged(object sender, EventArgs e) { @@ -6968,10 +6965,8 @@ namespace DSPRE { currentTrainerFile.party[3].pokeID = (ushort)partyPokemon4ComboBox.SelectedIndex; } ComboBox cb = (ComboBox)sender; - if (cb.SelectedIndex > 0) { - Image pokeIcon = (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])); - partyPokemon4PictureBox.Image = pokeIcon; - } + Image pokeIcon = cb.SelectedIndex > 0 ? (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])) : null; + partyPokemon4PictureBox.Image = pokeIcon; } private void partyPokemon5ComboBox_SelectedIndexChanged(object sender, EventArgs e) { @@ -6979,10 +6974,8 @@ namespace DSPRE { currentTrainerFile.party[4].pokeID = (ushort)partyPokemon5ComboBox.SelectedIndex; } ComboBox cb = (ComboBox)sender; - if (cb.SelectedIndex > 0) { - Image pokeIcon = (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])); - partyPokemon5PictureBox.Image = pokeIcon; - } + Image pokeIcon = cb.SelectedIndex > 0 ? (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])) : null; + partyPokemon5PictureBox.Image = pokeIcon; } private void partyPokemon6ComboBox_SelectedIndexChanged(object sender, EventArgs e) { @@ -6990,10 +6983,8 @@ namespace DSPRE { currentTrainerFile.party[5].pokeID = (ushort)partyPokemon6ComboBox.SelectedIndex; } ComboBox cb = (ComboBox)sender; - if (cb.SelectedIndex > 0) { - Image pokeIcon = (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])); - partyPokemon6PictureBox.Image = pokeIcon; - } + Image pokeIcon = cb.SelectedIndex > 0 ? (Image)Properties.PokePics.ResourceManager.GetObject(FixPokenameString(PokeDatabase.System.pokeNames[(ushort)cb.SelectedIndex])) : null; + partyPokemon6PictureBox.Image = pokeIcon; } private void partyCountUpDown_ValueChanged(object sender, EventArgs e) { diff --git a/DS_Map/ROMToolboxDialog.cs b/DS_Map/ROMToolboxDialog.cs index 0a85d0c..7839af8 100644 --- a/DS_Map/ROMToolboxDialog.cs +++ b/DS_Map/ROMToolboxDialog.cs @@ -382,8 +382,9 @@ namespace DSPRE { Parallel.ForEach(RomInfo.pokemonNamesTextNumbers, ID => { TextArchive pokeName = new TextArchive(ID); Parallel.For(1, pokeName.messages.Count, i => { - if (pokeName.messages[i].Length <= 1) + if (pokeName.messages[i].Length <= 1) { i++; + } pokeName.messages[i] = pokeName.messages[i].Replace(PokeDatabase.System.pokeNames[(ushort)i].ToUpper(), PokeDatabase.System.pokeNames[(ushort)i]); });