Bugfixes and small additions (#109)

* Add a converter for Player charsets in metadara
* Fixed Sprite position editor not working with new shadow filenames. Also added check for custom shadows
* Fixed pbTrainerBattleCore not working with NPC Trainer argument
* Fixed typo which caused crash with old trainers.txt format
* Fixed reference to non-existent variable which crashed the trainertype editor
This commit is contained in:
Golisopod-User
2021-05-18 23:28:07 +05:30
committed by GitHub
parent 8e64bcc11b
commit 6d7bae913e
9 changed files with 48 additions and 22 deletions

View File

@@ -386,14 +386,14 @@ def pbTrainerTypeEditor
type_hash = {
:id_number => t_data.id_number,
:id => t_data.id,
:name => line[1],
:base_money => line[2],
:battle_BGM => line[3],
:victory_ME => line[4],
:intro_ME => line[5],
:gender => line[6],
:skill_level => line[7],
:skill_code => line[8]
:name => data[1],
:base_money => data[2],
:battle_BGM => data[3],
:victory_ME => data[4],
:intro_ME => data[5],
:gender => data[6],
:skill_level => data[7],
:skill_code => data[8]
}
# Add trainer type's data to records
GameData::TrainerType.register(type_hash)

View File

@@ -166,6 +166,11 @@ class SpritePositioner
pbChangeSpecies(@species)
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))
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
cmdvals = [0]
commands = [_INTL("None")]
@@ -173,7 +178,7 @@ class SpritePositioner
i = 0
loop do
i += 1
fn = sprintf("Graphics/Pictures/Battle/battler_shadow_%d", i)
fn = sprintf("Graphics/Pokemon/Shadow/%d", i)
break if !pbResolveBitmap(fn)
cmdvals.push(i)
commands.push(i.to_s)

View File

@@ -231,6 +231,25 @@ module SpriteRenamer
end
end
def convert_player_metadata_charsets
changed = false
for i in 0...8
metadata = GameData::Metadata.get_player(i)
next if !metadata
if metadata[1][/^trchar(\d{3})$/]
tr_type_number = $~[1].to_i
tr_type_data = GameData::TrainerType.try_get(tr_type_number)
raise _INTL("Trainer type {1} is not defined (trying to rename player metadata filename {2}).", tr_type_number, metadata[1]) if !tr_type_data
metadata[1] = "trainer_" + tr_type_data.id.to_s
changed = true
end
end
return if !changed
# Save changes to metadata and rewrite PBS file
GameData::Metadata.save
Compiler.write_metadata
end
def convert_files
return if !pbConfirmMessage("Check for Pokémon/item/trainer files in their old folders that need renaming and moving?")
any_changed = false
@@ -255,6 +274,8 @@ module SpriteRenamer
pbSetWindowText(nil)
if pbConfirmMessage("Rename all trainer charsets? This will also edit map data to change events' charsets accordingly.")
convert_trainer_sprites("Graphics/Characters/")
convert_player_metadata_charsets
pbSetWindowText(nil)
# Edit all maps to replace used charsets
mapData = Compiler::MapData.new
t = Time.now.to_i