mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-11-03 08:15:47 +00:00
Release 6.9.0
This commit is contained in:
@@ -91,7 +91,7 @@ class BattleSpriteLoader
|
||||
def obtain_fusion_pif_sprite(head_id,body_id)
|
||||
substitution_id = get_sprite_substitution_id_for_fusion(head_id, body_id)
|
||||
pif_sprite = $PokemonSystem.alt_sprite_substitutions[substitution_id] if $PokemonGlobal
|
||||
#pif_sprite.dump_info if pif_sprite
|
||||
|
||||
if !pif_sprite || $PokemonSystem.random_sprites
|
||||
pif_sprite = select_new_pif_fusion_sprite(head_id, body_id)
|
||||
local_path = check_for_local_sprite(pif_sprite)
|
||||
@@ -124,6 +124,11 @@ class BattleSpriteLoader
|
||||
pif_sprite = $PokemonSystem.alt_sprite_substitutions[substitution_id] if $PokemonGlobal
|
||||
if !pif_sprite || $PokemonSystem.random_sprites
|
||||
pif_sprite = select_new_pif_base_sprite(dex_number)
|
||||
local_path = check_for_local_sprite(pif_sprite)
|
||||
if local_path
|
||||
pif_sprite.local_path = local_path
|
||||
end
|
||||
|
||||
$PokemonSystem.alt_sprite_substitutions[substitution_id] = pif_sprite if $PokemonGlobal && !$PokemonSystem.random_sprites
|
||||
end
|
||||
if pif_sprite.local_path
|
||||
@@ -181,6 +186,7 @@ class BattleSpriteLoader
|
||||
return pif_sprite.local_path if pif_sprite.local_path
|
||||
if pif_sprite.type == :BASE
|
||||
sprite_path = "#{Settings::CUSTOM_BASE_SPRITES_FOLDER}#{pif_sprite.head_id}#{pif_sprite.alt_letter}.png"
|
||||
echoln sprite_path
|
||||
else
|
||||
sprite_path = "#{Settings::CUSTOM_BATTLERS_FOLDER_INDEXED}#{pif_sprite.head_id}/#{pif_sprite.head_id}.#{pif_sprite.body_id}#{pif_sprite.alt_letter}.png"
|
||||
end
|
||||
@@ -228,13 +234,46 @@ class BattleSpriteLoader
|
||||
if $PokemonTemp.forced_alt_sprites && $PokemonTemp.forced_alt_sprites.include?(spritename)
|
||||
alt_letter = $PokemonTemp.forced_alt_sprites[spritename]
|
||||
end
|
||||
if $game_switches && $game_switches[SWITCH_RANDOM_REFERENCE_SPRITES]
|
||||
unless $PokemonTemp.selected_reference_sprites
|
||||
$PokemonTemp.selected_reference_sprites = getSelectedReferenceSprites()
|
||||
end
|
||||
unless $PokemonTemp.reference_sprite_index
|
||||
$PokemonTemp.reference_sprite_index = build_reference_sprite_index($PokemonTemp.selected_reference_sprites)
|
||||
end
|
||||
|
||||
matching_alts = $PokemonTemp.reference_sprite_index[spritename]
|
||||
if matching_alts && !matching_alts.empty?
|
||||
alt_letter = matching_alts.sample
|
||||
type = :CUSTOM
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return PIFSprite.new(type, head_id, body_id, alt_letter)
|
||||
end
|
||||
|
||||
def build_reference_sprite_index(list)
|
||||
index = Hash.new { |h, k| h[k] = [] }
|
||||
list.each do |entry|
|
||||
# spritename portion is digits/dots only; alt suffix is trailing lowercase letters
|
||||
if entry =~ /\A([\d.]+)([a-z]*)\z/
|
||||
index[$1] << $2
|
||||
end
|
||||
end
|
||||
index
|
||||
end
|
||||
|
||||
def select_new_pif_base_sprite(dex_number)
|
||||
random_alt = get_random_alt_letter_for_unfused(dex_number, true) #nil if no main
|
||||
random_alt = "" if !random_alt
|
||||
return PIFSprite.new(:BASE, dex_number, nil, random_alt)
|
||||
pif_sprite = PIFSprite.new(:BASE, dex_number, nil, random_alt)
|
||||
local_path = check_for_local_sprite(pif_sprite)
|
||||
if local_path
|
||||
pif_sprite.local_path = local_path
|
||||
pif_sprite.type = :CUSTOM
|
||||
end
|
||||
return pif_sprite
|
||||
end
|
||||
|
||||
#todo refactor by using get_triple_fusion_components()
|
||||
|
||||
Reference in New Issue
Block a user