Add gen-sensitive deoxys sprite fetching

Closes #1327
This commit is contained in:
Kurt
2017-07-16 14:05:29 -07:00
parent 2b0cfab31a
commit 249c08b062
2 changed files with 30 additions and 0 deletions

View File

@@ -746,6 +746,7 @@ private void OpenSAV(SaveFile sav, string path)
if (!SanityCheckSAV(ref sav, path))
return;
StoreLegalSaveGameData(sav);
PKMUtil.Initialize(sav); // refresh sprite generator
// clean fields
C_SAV.M.Reset();

View File

@@ -6,6 +6,32 @@ namespace PKHeX.WinForms
{
public static class PKMUtil
{
public static void Initialize(SaveFile sav)
{
if (sav.Generation != 3)
return;
Game = sav.Version;
if (Game == GameVersion.FRLG)
Game = sav.Personal == PersonalTable.FR ? GameVersion.FR : GameVersion.LG;
}
private static GameVersion Game;
private static int GetDeoxysForm()
{
switch (Game)
{
default:
return 0;
case GameVersion.FR: // Attack
return 1;
case GameVersion.LG: // Defense
return 2;
case GameVersion.E: // Speed
return 3;
}
}
public static Image GetBallSprite(int ball)
{
string str = PKX.GetResourceStringBall(ball);
@@ -16,6 +42,9 @@ public static Image GetSprite(int species, int form, int gender, int item, bool
if (species == 0)
return Resources._0;
if (generation == 3 && species == 386) // Deoxys, special consideration for Gen3 save files
form = GetDeoxysForm();
string file = PKX.GetResourceStringSprite(species, form, gender, generation);
// Redrawing logic