From 6c1edae8633d52e7dff4f22e6823779da93c2406 Mon Sep 17 00:00:00 2001 From: infinitefusion Date: Sat, 1 Jul 2023 17:49:35 -0400 Subject: [PATCH] Fixes crash when missing fusion icons folder (thanks kurayamiblackheart) --- Data/Scripts/013_Items/004_1_PokeradarUI.rb | 2 +- .../003_Pokemon_Sprites.rb | 1 + Data/Scripts/016_UI/017_UI_PokemonStorage.rb | 1 + Data/Scripts/050_AddOns/GeneralUtils.rb | 5 +++++ Data/System.rxdata | Bin 27961 -> 27960 bytes 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Data/Scripts/013_Items/004_1_PokeradarUI.rb b/Data/Scripts/013_Items/004_1_PokeradarUI.rb index 3a25dc9f1..f9721783b 100644 --- a/Data/Scripts/013_Items/004_1_PokeradarUI.rb +++ b/Data/Scripts/013_Items/004_1_PokeradarUI.rb @@ -111,7 +111,7 @@ class PokeRadar_UI bitmap1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke)) bitmap2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke)) - + ensureFusionIconExists() bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", pokemonId) headPokeFileName = GameData::Species.icon_filename(headPoke) bitmapPath = sprintf("%s.png", bitmapFileName) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb index 6c8a97268..da25ddfcf 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb @@ -188,6 +188,7 @@ class PokemonIconSprite < SpriteWrapper icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke)) dexNum = getDexNumberForSpecies(@pokemon.species) + ensureFusionIconExists bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum) headPokeFileName = GameData::Species.icon_filename(headPoke) bitmapPath = sprintf("%s.png", bitmapFileName) diff --git a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb index 669779865..783cf08ee 100644 --- a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb +++ b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb @@ -35,6 +35,7 @@ class PokemonBoxIcon < IconSprite icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke)) dexNum = getDexNumberForSpecies(species) + ensureFusionIconExists bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum) headPokeFileName = GameData::Species.icon_filename(headPoke) bitmapPath = sprintf("%s.png", bitmapFileName) diff --git a/Data/Scripts/050_AddOns/GeneralUtils.rb b/Data/Scripts/050_AddOns/GeneralUtils.rb index 81d5ff810..89b090c8c 100644 --- a/Data/Scripts/050_AddOns/GeneralUtils.rb +++ b/Data/Scripts/050_AddOns/GeneralUtils.rb @@ -48,6 +48,11 @@ def pbAddPokemonID(pokemon_id, level = 1, see_form = true, skip_randomize = fals end +def ensureFusionIconExists + directory_name = "Graphics/Pokemon/FusionIcons" + Dir.mkdir(directory_name) unless File.exists?(directory_name) +end + def addNewTripleFusion(pokemon1,pokemon2,pokemon3,level = 1) return if !pokemon1 return if !pokemon2 diff --git a/Data/System.rxdata b/Data/System.rxdata index 147c3ffdda5954c6cd1fa12c46b2b3303452e962..b20b3942f6f9038df09233b598f5cb061ac2c6e7 100644 GIT binary patch delta 32 ocmdmai*d&-#trW!c$xhcN?P$dq!uS97NkyA%#z$JCaD|(0M<|ofdBvi delta 33 pcmdmSi*e^I#trW!_*fh(m$6v!JERsTCl;hmR>+dvEGnrS0s!Mt3*7(!