Added PBS file pokemon_metrics.txt, for all Pokémon sprite positionings

This commit is contained in:
Maruno17
2021-10-23 20:30:09 +01:00
parent ca680c9feb
commit 10a1fc4430
34 changed files with 16729 additions and 20062 deletions

View File

@@ -1030,14 +1030,7 @@ def pbPokemonEditor
[_INTL("Shape"), GameDataProperty.new(:BodyShape), _INTL("Body shape of this species.")],
[_INTL("Habitat"), GameDataProperty.new(:Habitat), _INTL("The habitat of this species.")],
[_INTL("Generation"), LimitProperty.new(99999), _INTL("The number of the generation the Pokémon debuted in.")],
[_INTL("Flags"), StringListProperty, _INTL("Words/phrases that distinguish this species from others.")],
[_INTL("BattlerPlayerX"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerPlayerY"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerEnemyX"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerEnemyY"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerAltitude"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerShadowX"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("BattlerShadowSize"), ReadOnlyProperty, _INTL("Affects positioning of the Pokémon in battle. This is edited elsewhere.")],
[_INTL("Flags"), StringListProperty, _INTL("Words/phrases that distinguish this species from others.")]
]
pbListScreenBlock(_INTL("Pokémon species"), SpeciesLister.new(0, false)) { |button, species|
if species
@@ -1097,14 +1090,7 @@ def pbPokemonEditor
spec.shape,
spec.habitat,
spec.generation,
spec.flags.clone,
spec.back_sprite_x,
spec.back_sprite_y,
spec.front_sprite_x,
spec.front_sprite_y,
spec.front_sprite_altitude,
spec.shadow_x,
spec.shadow_size
spec.flags.clone
]
# Edit the properties
if pbPropertyList(spec.id.to_s, data, species_properties, true)
@@ -1149,14 +1135,7 @@ def pbPokemonEditor
:shape => data[34],
:habitat => data[35],
:generation => data[36],
:flags => data[37],
:back_sprite_x => data[38],
:back_sprite_y => data[39],
:front_sprite_x => data[40],
:front_sprite_y => data[41],
:front_sprite_altitude => data[42],
:shadow_x => data[43],
:shadow_size => data[44]
:flags => data[37]
}
# Add species' data to records
GameData::Species.register(species_hash)

View File

@@ -18,26 +18,26 @@ def pbAutoPositionAll
t = Time.now.to_i
Graphics.update
end
metrics = GameData::SpeciesMetrics.get_species_form(sp.species, sp.form)
bitmap1 = GameData::Species.sprite_bitmap(sp.species, sp.form, nil, nil, nil, true)
bitmap2 = GameData::Species.sprite_bitmap(sp.species, sp.form)
if bitmap1 && bitmap1.bitmap # Player's y
sp.back_sprite_x = 0
sp.back_sprite_y = (bitmap1.height - (findBottom(bitmap1.bitmap) + 1)) / 2
metrics.back_sprite[0] = 0
metrics.back_sprite[1] = (bitmap1.height - (findBottom(bitmap1.bitmap) + 1)) / 2
end
if bitmap2 && bitmap2.bitmap # Foe's y
sp.front_sprite_x = 0
sp.front_sprite_y = (bitmap2.height - (findBottom(bitmap2.bitmap) + 1)) / 2
sp.front_sprite_y += 4 # Just because
metrics.front_sprite[0] = 0
metrics.front_sprite[1] = (bitmap2.height - (findBottom(bitmap2.bitmap) + 1)) / 2
metrics.front_sprite[1] += 4 # Just because
end
sp.front_sprite_altitude = 0 # Shouldn't be used
sp.shadow_x = 0
sp.shadow_size = 2
metrics.front_sprite_altitude = 0 # Shouldn't be used
metrics.shadow_x = 0
metrics.shadow_size = 2
bitmap1.dispose if bitmap1
bitmap2.dispose if bitmap2
end
GameData::Species.save
Compiler.write_pokemon
Compiler.write_pokemon_forms
GameData::SpeciesMetrics.save
Compiler.write_pokemon_metrics
end
#===============================================================================
@@ -81,7 +81,8 @@ class SpritePositioner
@sprites["info"].viewport = @viewport
@sprites["info"].visible = false
@oldSpeciesIndex = 0
@species = nil # This can be a species_form
@species = nil # This cannot be a species_form
@form = 0
@metricsChanged = false
refresh
@starting = true
@@ -92,7 +93,7 @@ class SpritePositioner
pbSaveMetrics
@metricsChanged = false
else
GameData::Species.load # Clear all changes to metrics
GameData::SpeciesMetrics.load # Clear all changes to metrics
end
pbFadeOutAndHide(@sprites) { update }
pbDisposeSpriteHash(@sprites)
@@ -100,9 +101,8 @@ class SpritePositioner
end
def pbSaveMetrics
GameData::Species.save
Compiler.write_pokemon
Compiler.write_pokemon_forms
GameData::SpeciesMetrics.save
Compiler.write_pokemon_metrics
end
def update
@@ -116,12 +116,12 @@ class SpritePositioner
@sprites["shadow_1"].visible = false
return
end
species_data = GameData::Species.get(@species)
metrics_data = GameData::SpeciesMetrics.get_species_form(@species, @form)
for i in 0...2
pos = PokeBattle_SceneConstants.pbBattlerPosition(i, 1)
@sprites["pokemon_#{i}"].x = pos[0]
@sprites["pokemon_#{i}"].y = pos[1]
species_data.apply_metrics_to_sprite(@sprites["pokemon_#{i}"], i)
metrics_data.apply_metrics_to_sprite(@sprites["pokemon_#{i}"], i)
@sprites["pokemon_#{i}"].visible = true
if i == 1
@sprites["shadow_1"].x = pos[0]
@@ -130,52 +130,51 @@ class SpritePositioner
@sprites["shadow_1"].x -= @sprites["shadow_1"].bitmap.width / 2
@sprites["shadow_1"].y -= @sprites["shadow_1"].bitmap.height / 2
end
species_data.apply_metrics_to_sprite(@sprites["shadow_1"], i, true)
metrics_data.apply_metrics_to_sprite(@sprites["shadow_1"], i, true)
@sprites["shadow_1"].visible = true
end
end
end
def pbAutoPosition
species_data = GameData::Species.get(@species)
old_back_y = species_data.back_sprite_y
old_front_y = species_data.front_sprite_y
old_front_altitude = species_data.front_sprite_altitude
metrics_data = GameData::SpeciesMetrics.get_species_form(@species, @form)
old_back_y = metrics_data.back_sprite[1]
old_front_y = metrics_data.front_sprite[1]
old_front_altitude = metrics_data.front_sprite_altitude
bitmap1 = @sprites["pokemon_0"].bitmap
bitmap2 = @sprites["pokemon_1"].bitmap
new_back_y = (bitmap1.height - (findBottom(bitmap1) + 1)) / 2
new_front_y = (bitmap2.height - (findBottom(bitmap2) + 1)) / 2
new_front_y += 4 # Just because
if new_back_y != old_back_y || new_front_y != old_front_y || old_front_altitude != 0
species_data.back_sprite_y = new_back_y
species_data.front_sprite_y = new_front_y
species_data.front_sprite_altitude = 0
metrics_data.back_sprite[1] = new_back_y
metrics_data.front_sprite[1] = new_front_y
metrics_data.front_sprite_altitude = 0
@metricsChanged = true
refresh
end
end
def pbChangeSpecies(species)
def pbChangeSpecies(species, form)
@species = species
species_data = GameData::Species.try_get(@species)
@form = form
species_data = GameData::Species.get_species_form(@species, @form)
return if !species_data
spe = species_data.species
frm = species_data.form
@sprites["pokemon_0"].setSpeciesBitmap(spe, 0, frm, false, false, true)
@sprites["pokemon_1"].setSpeciesBitmap(spe, 0, frm)
@sprites["shadow_1"].setBitmap(GameData::Species.shadow_filename(spe, frm))
@sprites["pokemon_0"].setSpeciesBitmap(@species, 0, @form, false, false, true)
@sprites["pokemon_1"].setSpeciesBitmap(@species, 0, @form)
@sprites["shadow_1"].setBitmap(GameData::Species.shadow_filename(@species, @form))
end
def pbShadowSize
pbChangeSpecies(@species)
pbChangeSpecies(@species, @form)
refresh
species_data = GameData::Species.get(@species)
if pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", species_data.species, species_data.form)) ||
pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
metrics_data = GameData::SpeciesMetrics.get_species_form(@species, @form)
if pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", metrics_data.species, metrics_data.form)) ||
pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", metrics_data.species))
pbMessage("This species has its own shadow sprite in Graphics/Pokemon/Shadow/. The shadow size metric cannot be edited.")
return false
end
oldval = species_data.shadow_size
oldval = metrics_data.shadow_size
cmdvals = [0]
commands = [_INTL("None")]
defindex = 0
@@ -200,17 +199,17 @@ class SpritePositioner
self.update
if cw.index != oldindex
oldindex = cw.index
species_data.shadow_size = cmdvals[cw.index]
pbChangeSpecies(@species)
metrics_data.shadow_size = cmdvals[cw.index]
pbChangeSpecies(@species, @form)
refresh
end
if Input.trigger?(Input::ACTION) # Cycle to next option
pbPlayDecisionSE
@metricsChanged = true if species_data.shadow_size != oldval
@metricsChanged = true if metrics_data.shadow_size != oldval
ret = true
break
elsif Input.trigger?(Input::BACK)
species_data.shadow_size = oldval
metrics_data.shadow_size = oldval
pbPlayCancelSE
break
elsif Input.trigger?(Input::USE)
@@ -229,19 +228,19 @@ class SpritePositioner
pbAutoPosition
return false
end
species_data = GameData::Species.get(@species)
metrics_data = GameData::SpeciesMetrics.get_species_form(@species, @form)
case param
when 0
sprite = @sprites["pokemon_0"]
xpos = species_data.back_sprite_x
ypos = species_data.back_sprite_y
xpos = metrics_data.back_sprite[0]
ypos = metrics_data.back_sprite[1]
when 1
sprite = @sprites["pokemon_1"]
xpos = species_data.front_sprite_x
ypos = species_data.front_sprite_y
xpos = metrics_data.front_sprite[0]
ypos = metrics_data.front_sprite[1]
when 3
sprite = @sprites["shadow_1"]
xpos = species_data.shadow_x
xpos = metrics_data.shadow_x
ypos = 0
end
oldxpos = xpos
@@ -261,17 +260,17 @@ class SpritePositioner
if (Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)) && param != 3
ypos += (Input.repeat?(Input::DOWN)) ? 1 : -1
case param
when 0 then species_data.back_sprite_y = ypos
when 1 then species_data.front_sprite_y = ypos
when 0 then metrics_data.back_sprite[1] = ypos
when 1 then metrics_data.front_sprite[1] = ypos
end
refresh
end
if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
xpos += (Input.repeat?(Input::RIGHT)) ? 1 : -1
case param
when 0 then species_data.back_sprite_x = xpos
when 1 then species_data.front_sprite_x = xpos
when 3 then species_data.shadow_x = xpos
when 0 then metrics_data.back_sprite[0] = xpos
when 1 then metrics_data.front_sprite[0] = xpos
when 3 then metrics_data.shadow_x = xpos
end
refresh
end
@@ -283,13 +282,13 @@ class SpritePositioner
elsif Input.repeat?(Input::BACK)
case param
when 0
species_data.back_sprite_x = oldxpos
species_data.back_sprite_y = oldypos
metrics_data.back_sprite[0] = oldxpos
metrics_data.back_sprite[1] = oldypos
when 1
species_data.front_sprite_x = oldxpos
species_data.front_sprite_y = oldypos
metrics_data.front_sprite[0] = oldxpos
metrics_data.front_sprite[1] = oldypos
when 3
species_data.shadow_x = oldxpos
metrics_data.shadow_x = oldxpos
end
pbPlayCancelSE
refresh
@@ -305,8 +304,7 @@ class SpritePositioner
return ret
end
def pbMenu(species)
pbChangeSpecies(species)
def pbMenu
refresh
cw = Window_CommandPokemon.new([
_INTL("Set Ally Position"),
@@ -350,14 +348,14 @@ class SpritePositioner
allspecies = []
GameData::Species.each do |sp|
name = (sp.form == 0) ? sp.name : _INTL("{1} (form {2})", sp.real_name, sp.form)
allspecies.push([sp.id, sp.species, name]) if name && !name.empty?
allspecies.push([sp.id, sp.species, sp.form, name]) if name && !name.empty?
end
allspecies.sort! { |a, b| a[2] <=> b[2] }
allspecies.sort! { |a, b| a[3] <=> b[3] }
commands = []
allspecies.each { |sp| commands.push(sp[2]) }
allspecies.each { |sp| commands.push(sp[3]) }
cw.commands = commands
cw.index = @oldSpeciesIndex
ret = nil
ret = false
oldindex = -1
loop do
Graphics.update
@@ -365,17 +363,17 @@ class SpritePositioner
cw.update
if cw.index != oldindex
oldindex = cw.index
pbChangeSpecies(allspecies[cw.index][0])
pbChangeSpecies(allspecies[cw.index][1], allspecies[cw.index][2])
refresh
end
self.update
if Input.trigger?(Input::BACK)
pbChangeSpecies(nil)
pbChangeSpecies(nil, nil)
refresh
break
elsif Input.trigger?(Input::USE)
pbChangeSpecies(allspecies[cw.index][0])
ret = allspecies[cw.index][0]
pbChangeSpecies(allspecies[cw.index][1], allspecies[cw.index][2])
ret = true
break
end
end
@@ -399,7 +397,7 @@ class SpritePositionerScreen
species = @scene.pbChooseSpecies
break if !species
loop do
command = @scene.pbMenu(species)
command = @scene.pbMenu
break if command < 0
loop do
par = @scene.pbSetParameter(command)

View File

@@ -1137,6 +1137,7 @@ DebugMenuCommands.register("createpbs", {
"phone.txt",
"pokemon.txt",
"pokemon_forms.txt",
"pokemon_metrics.txt",
"regional_dexes.txt",
"ribbons.txt",
"shadow_movesets.txt",
@@ -1161,13 +1162,14 @@ DebugMenuCommands.register("createpbs", {
when 10 then Compiler.write_phone
when 11 then Compiler.write_pokemon
when 12 then Compiler.write_pokemon_forms
when 13 then Compiler.write_regional_dexes
when 14 then Compiler.write_ribbons
when 15 then Compiler.write_shadow_movesets
when 16 then Compiler.write_town_map
when 17 then Compiler.write_trainer_types
when 18 then Compiler.write_trainers
when 19 then Compiler.write_types
when 13 then Compiler.write_pokemon_metrics
when 14 then Compiler.write_regional_dexes
when 15 then Compiler.write_ribbons
when 16 then Compiler.write_shadow_movesets
when 17 then Compiler.write_town_map
when 18 then Compiler.write_trainer_types
when 19 then Compiler.write_trainers
when 20 then Compiler.write_types
else break
end
pbMessage(_INTL("File written."))