mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-11 13:13:06 +00:00
Add shiny sprite fetch & fallback
pseudo future proofing in the event new species sprites are added and recolored variants are not Closes #1735 , thanks @trainboy2019 ! (reimplemented alterations with GUI-saved settings)
This commit is contained in:
parent
853f5f3ce9
commit
1417a6d576
1 changed files with 9 additions and 3 deletions
|
@ -45,19 +45,25 @@ namespace PKHeX.WinForms
|
||||||
if (generation == 3 && species == 386) // Deoxys, special consideration for Gen3 save files
|
if (generation == 3 && species == 386) // Deoxys, special consideration for Gen3 save files
|
||||||
form = GetDeoxysForm();
|
form = GetDeoxysForm();
|
||||||
|
|
||||||
string file = PKX.GetResourceStringSprite(species, form, gender, generation);
|
string file = PKX.GetResourceStringSprite(species, form, gender, generation, shiny);
|
||||||
|
|
||||||
// Redrawing logic
|
// Redrawing logic
|
||||||
Image baseImage = (Image)Resources.ResourceManager.GetObject(file);
|
Image baseImage = (Image)Resources.ResourceManager.GetObject(file);
|
||||||
if (FormConverter.IsTotemForm(species, form))
|
if (FormConverter.IsTotemForm(species, form))
|
||||||
{
|
{
|
||||||
form = FormConverter.GetTotemBaseForm(species, form);
|
form = FormConverter.GetTotemBaseForm(species, form);
|
||||||
file = PKX.GetResourceStringSprite(species, form, gender, generation);
|
file = PKX.GetResourceStringSprite(species, form, gender, generation, shiny);
|
||||||
baseImage = (Image)Resources.ResourceManager.GetObject(file);
|
baseImage = (Image)Resources.ResourceManager.GetObject(file);
|
||||||
baseImage = ImageUtil.ToGrayscale(baseImage);
|
baseImage = ImageUtil.ToGrayscale(baseImage);
|
||||||
}
|
}
|
||||||
if (baseImage == null)
|
if (baseImage == null)
|
||||||
{
|
{
|
||||||
|
if (shiny) // try again without shiny
|
||||||
|
{
|
||||||
|
file = PKX.GetResourceStringSprite(species, form, gender, generation);
|
||||||
|
baseImage = (Image)Resources.ResourceManager.GetObject(file);
|
||||||
|
}
|
||||||
|
if (baseImage == null)
|
||||||
baseImage = (Image) Resources.ResourceManager.GetObject($"_{species}");
|
baseImage = (Image) Resources.ResourceManager.GetObject($"_{species}");
|
||||||
baseImage = baseImage != null ? ImageUtil.LayerImage(baseImage, Resources.unknown, 0, 0, .5) : Resources.unknown;
|
baseImage = baseImage != null ? ImageUtil.LayerImage(baseImage, Resources.unknown, 0, 0, .5) : Resources.unknown;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue