Fixes sprites not being downloaded before form change

This commit is contained in:
infinitefusion
2023-11-19 10:27:40 -05:00
parent 6e5f7bbce2
commit 48327a61ff
7 changed files with 15 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -595,10 +595,16 @@ class PokeBattle_Battler
end
end
def ensure_form_has_sprite(pokemon,spriteform_body,spriteform_head)
GameData::Species.sprite_filename(pokemon.dexNum, spriteform_body,spriteform_head)
end
def changeForm(newForm, formChangingSpecies, animation = "UltraBurst2")
spriteform_body = newForm if @pokemon.hasBodyOf?(formChangingSpecies)
spriteform_head = newForm if @pokemon.hasHeadOf?(formChangingSpecies)
ensure_form_has_sprite(@pokemon,spriteform_body,spriteform_head)
if self.isFusion?
current_form_has_custom = customSpriteExists(@pokemon.species)
new_form_has_custom = customSpriteExistsForm(@pokemon.species, spriteform_head, spriteform_body)
@@ -607,7 +613,6 @@ class PokeBattle_Battler
should_change_sprite=true
end
if should_change_sprite
@pokemon.spriteform_body = spriteform_body
@pokemon.spriteform_head = spriteform_head

View File

@@ -298,7 +298,7 @@ def get_fusion_sprite_path(head_id, body_id, spriteform_body = nil, spriteform_h
return local_generated_path if pbResolveBitmap(local_generated_path)
#Download generated sprite if nothing else found
autogen_path = download_autogen_sprite(head_id, body_id)
autogen_path = download_autogen_sprite(head_id, body_id,spriteform_body,spriteform_head)
return autogen_path if pbResolveBitmap(autogen_path)
return Settings::DEFAULT_SPRITE_PATH

View File

@@ -480,7 +480,6 @@ def customSpriteExistsForm(species,form_id_head=nil, form_id_body=nil)
spritename += "_" + form_id_body.to_s if form_id_body
pathCustom = _INTL("Graphics/CustomBattlers/indexed/{1}/{2}.png", folder, spritename)
return true if pbResolveBitmap(pathCustom) != nil
return download_custom_sprite(head, body,form_id_head,form_id_body) != nil
end

View File

@@ -81,11 +81,16 @@ def download_sprite(base_path, head_id, body_id, saveLocation = "Graphics/temp",
end
end
def download_autogen_sprite(head_id, body_id)
def download_autogen_sprite(head_id, body_id,spriteformBody_suffix=nil,spriteformHead_suffix=nil)
return nil if $PokemonSystem.download_sprites != 0
url = Settings::AUTOGEN_SPRITES_REPO_URL + "{1}/{1}.{2}.png"
template_url = Settings::AUTOGEN_SPRITES_REPO_URL + "{1}/{1}.{2}.png"
head_id = (head_id.to_s) + "_" + spriteformHead_suffix.to_s if spriteformHead_suffix
body_id = (body_id.to_s) + "_" + spriteformBody_suffix.to_s if spriteformBody_suffix
destPath = _INTL("{1}{2}", Settings::BATTLERS_FOLDER, head_id)
sprite = download_sprite(_INTL(url, head_id, body_id), head_id, body_id, destPath)
url = _INTL(template_url, head_id, body_id)
sprite = download_sprite(url, head_id, body_id, destPath)
return sprite if sprite
return nil
end

Binary file not shown.