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:
Kurt 2018-01-02 17:17:30 -08:00
parent 853f5f3ce9
commit 1417a6d576

View file

@ -45,20 +45,26 @@ 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)
{ {
baseImage = (Image) Resources.ResourceManager.GetObject($"_{species}"); 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 = 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;
} }
if (isegg) if (isegg)