mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Pokémon cries no longer change pitch except when fainting, added support for separate fainting cries
This commit is contained in:
@@ -174,23 +174,23 @@ module GameData
|
|||||||
|
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
|
|
||||||
def self.check_cry_file(species, form)
|
def self.check_cry_file(species, form, suffix = "")
|
||||||
species_data = self.get_species_form(species, form)
|
species_data = self.get_species_form(species, form)
|
||||||
return nil if species_data.nil?
|
return nil if species_data.nil?
|
||||||
if form > 0
|
if form > 0
|
||||||
ret = sprintf("Cries/%s_%d", species_data.species, form)
|
ret = sprintf("Cries/%s_%d%s", species_data.species, form, suffix)
|
||||||
return ret if pbResolveAudioSE(ret)
|
return ret if pbResolveAudioSE(ret)
|
||||||
end
|
end
|
||||||
ret = sprintf("Cries/%s", species_data.species)
|
ret = sprintf("Cries/%s%s", species_data.species, suffix)
|
||||||
return (pbResolveAudioSE(ret)) ? ret : nil
|
return (pbResolveAudioSE(ret)) ? ret : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.cry_filename(species, form = 0)
|
def self.cry_filename(species, form = 0, suffix = "")
|
||||||
return self.check_cry_file(species, form)
|
return self.check_cry_file(species, form || 0, suffix)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.cry_filename_from_pokemon(pkmn)
|
def self.cry_filename_from_pokemon(pkmn, suffix = "")
|
||||||
return self.check_cry_file(pkmn.species, pkmn.form)
|
return self.check_cry_file(pkmn.species, pkmn.form, suffix)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.play_cry_from_species(species, form = 0, volume = 90, pitch = 100)
|
def self.play_cry_from_species(species, form = 0, volume = 90, pitch = 100)
|
||||||
@@ -199,37 +199,42 @@ module GameData
|
|||||||
pbSEPlay(RPG::AudioFile.new(filename, volume, pitch)) rescue nil
|
pbSEPlay(RPG::AudioFile.new(filename, volume, pitch)) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.play_cry_from_pokemon(pkmn, volume = 90, pitch = nil)
|
def self.play_cry_from_pokemon(pkmn, volume = 90, pitch = 100)
|
||||||
return if !pkmn || pkmn.egg?
|
return if !pkmn || pkmn.egg?
|
||||||
filename = self.cry_filename_from_pokemon(pkmn)
|
filename = self.cry_filename_from_pokemon(pkmn)
|
||||||
return if !filename
|
return if !filename
|
||||||
pitch ||= 75 + (pkmn.hp * 25 / pkmn.totalhp)
|
pitch ||= 100
|
||||||
pbSEPlay(RPG::AudioFile.new(filename, volume, pitch)) rescue nil
|
pbSEPlay(RPG::AudioFile.new(filename, volume, pitch)) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.play_cry(pkmn, volume = 90, pitch = nil)
|
def self.play_cry(pkmn, volume = 90, pitch = 100)
|
||||||
if pkmn.is_a?(Pokemon)
|
if pkmn.is_a?(Pokemon)
|
||||||
self.play_cry_from_pokemon(pkmn, volume, pitch)
|
self.play_cry_from_pokemon(pkmn, volume, pitch)
|
||||||
else
|
else
|
||||||
self.play_cry_from_species(pkmn, nil, volume, pitch)
|
self.play_cry_from_species(pkmn, 0, volume, pitch)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.cry_length(species, form = 0, pitch = 100)
|
def self.cry_length(species, form = 0, pitch = 100, suffix = "")
|
||||||
|
pitch ||= 100
|
||||||
return 0 if !species || pitch <= 0
|
return 0 if !species || pitch <= 0
|
||||||
pitch = pitch.to_f / 100
|
pitch = pitch.to_f / 100
|
||||||
ret = 0.0
|
ret = 0.0
|
||||||
if species.is_a?(Pokemon)
|
if species.is_a?(Pokemon)
|
||||||
if !species.egg?
|
if !species.egg?
|
||||||
filename = pbResolveAudioSE(GameData::Species.cry_filename_from_pokemon(species))
|
filename = self.cry_filename_from_pokemon(species, suffix)
|
||||||
|
filename = self.cry_filename_from_pokemon(species) if !filename && !nil_or_empty?(suffix)
|
||||||
|
filename = pbResolveAudioSE(filename)
|
||||||
ret = getPlayTime(filename) if filename
|
ret = getPlayTime(filename) if filename
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
filename = pbResolveAudioSE(GameData::Species.cry_filename(species, form))
|
filename = self.cry_filename(species, form, suffix)
|
||||||
|
filename = self.cry_filename(species, form) if !filename && !nil_or_empty?(suffix)
|
||||||
|
filename = pbResolveAudioSE(filename)
|
||||||
ret = getPlayTime(filename) if filename
|
ret = getPlayTime(filename) if filename
|
||||||
end
|
end
|
||||||
ret /= pitch # Sound played at a lower pitch lasts longer
|
ret /= pitch # Sound played at a lower pitch lasts longer
|
||||||
return (ret * Graphics.frame_rate).ceil + 4 # 4 provides a buffer between sounds
|
return ret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -659,11 +659,18 @@ class Battle::Scene::Animation::BattlerFaint < Battle::Scene::Animation
|
|||||||
# Animation
|
# Animation
|
||||||
# Play cry
|
# Play cry
|
||||||
delay = 10
|
delay = 10
|
||||||
|
cry = GameData::Species.cry_filename_from_pokemon(batSprite.pkmn, "_faint")
|
||||||
|
if cry # Play a specific faint cry
|
||||||
|
battler.setSE(0, cry)
|
||||||
|
delay = (GameData::Species.cry_length(batSprite.pkmn, nil, nil, "_faint") * 20).ceil
|
||||||
|
else
|
||||||
cry = GameData::Species.cry_filename_from_pokemon(batSprite.pkmn)
|
cry = GameData::Species.cry_filename_from_pokemon(batSprite.pkmn)
|
||||||
if cry
|
if cry # Play the regular cry at a lower pitch (75)
|
||||||
battler.setSE(0, cry, nil, 75) # 75 is pitch
|
battler.setSE(0, cry, nil, 75)
|
||||||
delay = GameData::Species.cry_length(batSprite.pkmn) * 20 / Graphics.frame_rate
|
delay = (GameData::Species.cry_length(batSprite.pkmn, nil, 75) * 20).ceil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
delay += 2
|
||||||
# Sprite drops down
|
# Sprite drops down
|
||||||
shadow.setVisible(delay,false)
|
shadow.setVisible(delay,false)
|
||||||
battler.setSE(delay,"Pkmn faint")
|
battler.setSE(delay,"Pkmn faint")
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ class PokemonEggHatch_Scene
|
|||||||
@sprites["pokemon"].tone=Tone.new(0,0,0)
|
@sprites["pokemon"].tone=Tone.new(0,0,0)
|
||||||
@sprites["overlay"].opacity=0
|
@sprites["overlay"].opacity=0
|
||||||
# Finish scene
|
# Finish scene
|
||||||
frames = GameData::Species.cry_length(@pokemon)
|
frames = (GameData::Species.cry_length(@pokemon) * Graphics.frame_rate).ceil
|
||||||
@pokemon.play_cry
|
@pokemon.play_cry
|
||||||
updateScene(frames)
|
updateScene(frames + 4)
|
||||||
pbBGMStop()
|
pbBGMStop()
|
||||||
pbMEPlay("Evolution success")
|
pbMEPlay("Evolution success")
|
||||||
@pokemon.name = nil
|
@pokemon.name = nil
|
||||||
|
|||||||
@@ -569,10 +569,10 @@ class PokemonEvolutionScene
|
|||||||
def pbEvolutionSuccess
|
def pbEvolutionSuccess
|
||||||
$stats.evolution_count += 1
|
$stats.evolution_count += 1
|
||||||
# Play cry of evolved species
|
# Play cry of evolved species
|
||||||
frames = GameData::Species.cry_length(@newspecies, @pokemon.form)
|
frames = (GameData::Species.cry_length(@newspecies, @pokemon.form) * Graphics.frame_rate).ceil
|
||||||
pbBGMStop
|
pbBGMStop
|
||||||
Pokemon.play_cry(@newspecies, @pokemon.form)
|
Pokemon.play_cry(@newspecies, @pokemon.form)
|
||||||
frames.times do
|
(frames + 4).times do
|
||||||
Graphics.update
|
Graphics.update
|
||||||
pbUpdate
|
pbUpdate
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user