mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 13:44:59 +00:00
Renamed trainer charsets and added code to the sprite renamer that will rename them and edit map data accordingly
This commit is contained in:
@@ -34,7 +34,7 @@ module GameData
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.charset_filename(tr_type)
|
def self.charset_filename(tr_type)
|
||||||
return self.check_file(tr_type, "Graphics/Characters/trchar")
|
return self.check_file(tr_type, "Graphics/Characters/trainer_")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.charset_filename_brief(tr_type)
|
def self.charset_filename_brief(tr_type)
|
||||||
|
|||||||
@@ -193,11 +193,25 @@ module SpriteRenamer
|
|||||||
def convert_trainer_sprites(src_dir)
|
def convert_trainer_sprites(src_dir)
|
||||||
return if !FileTest.directory?(src_dir)
|
return if !FileTest.directory?(src_dir)
|
||||||
# generates a list of all graphic files
|
# generates a list of all graphic files
|
||||||
|
if src_dir == "Graphics/Characters/"
|
||||||
|
files = readDirectoryFiles(src_dir, ["trchar*.png"])
|
||||||
|
else
|
||||||
files = readDirectoryFiles(src_dir, ["*.png"])
|
files = readDirectoryFiles(src_dir, ["*.png"])
|
||||||
|
end
|
||||||
# starts automatic renaming
|
# starts automatic renaming
|
||||||
files.each_with_index do |file, i|
|
files.each_with_index do |file, i|
|
||||||
Graphics.update if i % 100 == 0
|
Graphics.update if i % 100 == 0
|
||||||
pbSetWindowText(_INTL("Converting trainer sprites {1}/{2}...", i, files.length)) if i % 50 == 0
|
pbSetWindowText(_INTL("Converting trainer sprites {1}/{2}...", i, files.length)) if i % 50 == 0
|
||||||
|
if src_dir == "Graphics/Characters/"
|
||||||
|
if file[/^trchar(\d{3})\.([^\.]*)$/]
|
||||||
|
tr_type_number = $~[1].to_i
|
||||||
|
extension = $~[2]
|
||||||
|
tr_type_data = GameData::TrainerType.try_get(tr_type_number)
|
||||||
|
raise _INTL("Trainer type {1} is not defined (trying to rename trainer charset {2}).", tr_type_number, file) if !tr_type_data
|
||||||
|
tr_type = tr_type_data.id.to_s
|
||||||
|
File.move(src_dir + file, src_dir + "trainer_" + tr_type + "." + extension)
|
||||||
|
end
|
||||||
|
else
|
||||||
if file[/^trainer(\d{3})\.([^\.]*)$/]
|
if file[/^trainer(\d{3})\.([^\.]*)$/]
|
||||||
tr_type_number = $~[1].to_i
|
tr_type_number = $~[1].to_i
|
||||||
extension = $~[2]
|
extension = $~[2]
|
||||||
@@ -215,9 +229,11 @@ module SpriteRenamer
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def convert_files
|
def convert_files
|
||||||
return if !pbConfirmMessage("Check for Pokémon/item/trainer files in their old folders that need renaming and moving?")
|
return if !pbConfirmMessage("Check for Pokémon/item/trainer files in their old folders that need renaming and moving?")
|
||||||
|
any_changed = false
|
||||||
# Rename and move Pokémon sprites/icons
|
# Rename and move Pokémon sprites/icons
|
||||||
dest_dir = "Graphics/Pokemon/"
|
dest_dir = "Graphics/Pokemon/"
|
||||||
Dir.mkdir(dest_dir) if !FileTest.directory?(dest_dir)
|
Dir.mkdir(dest_dir) if !FileTest.directory?(dest_dir)
|
||||||
@@ -237,6 +253,37 @@ module SpriteRenamer
|
|||||||
# Rename trainer sprites
|
# Rename trainer sprites
|
||||||
convert_trainer_sprites("Graphics/Trainers/")
|
convert_trainer_sprites("Graphics/Trainers/")
|
||||||
pbSetWindowText(nil)
|
pbSetWindowText(nil)
|
||||||
|
if pbConfirmMessage("Rename all trainer charsets? This will also edit map data to change events' charsets accordingly.")
|
||||||
|
convert_trainer_sprites("Graphics/Characters/")
|
||||||
|
# Edit all maps to replace used charsets
|
||||||
|
mapData = Compiler::MapData.new
|
||||||
|
t = Time.now.to_i
|
||||||
|
Graphics.update
|
||||||
|
for id in mapData.mapinfos.keys.sort
|
||||||
|
map = mapData.getMap(id)
|
||||||
|
next if !map || !mapData.mapinfos[id]
|
||||||
|
changed = false
|
||||||
|
for key in map.events.keys
|
||||||
|
if Time.now.to_i - t >= 5
|
||||||
|
Graphics.update
|
||||||
|
t = Time.now.to_i
|
||||||
|
end
|
||||||
|
map.events[key].pages.each do |page|
|
||||||
|
next if nil_or_empty?(page.graphic.character_name)
|
||||||
|
next if !page.graphic.character_name[/^trchar(.+)$/]
|
||||||
|
tr_type = $~[1]
|
||||||
|
tr_type = tr_type.to_i if tr_type[/^\d+$/]
|
||||||
|
tr_type_data = GameData::TrainerType.try_get(tr_type)
|
||||||
|
raise _INTL("Trainer type {1} is not defined (trying to rename event's charset {2}).", tr_type, file) if !tr_type_data
|
||||||
|
page.graphic.character_name = "trainer_" + tr_type_data.id.to_s
|
||||||
|
changed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
mapData.saveMap(id) if changed
|
||||||
|
any_changed = true if changed
|
||||||
|
end
|
||||||
|
end
|
||||||
pbMessage(_INTL("All found sprites and icons were renamed and moved."))
|
pbMessage(_INTL("All found sprites and icons were renamed and moved."))
|
||||||
|
pbMessage(_INTL("Some map data was edited. Close and reopen RPG Maker XP to see the changes.")) if any_changed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ WildVictoryME = Battle victory wild.ogg
|
|||||||
TrainerVictoryME = Battle victory trainer.ogg
|
TrainerVictoryME = Battle victory trainer.ogg
|
||||||
SurfBGM = Surfing.mid
|
SurfBGM = Surfing.mid
|
||||||
BicycleBGM = Bicycle.mid
|
BicycleBGM = Bicycle.mid
|
||||||
PlayerA = POKEMONTRAINER_Red,trchar000,boy_bike,boy_surf,boy_run,boy_surf,boy_fish_offset,boy_fish_offset
|
PlayerA = POKEMONTRAINER_Red,trainer_POKEMONTRAINER_Red,boy_bike,boy_surf,boy_run,boy_surf,boy_fish_offset,boy_fish_offset
|
||||||
PlayerB = POKEMONTRAINER_Leaf,trchar001,girl_bike,girl_surf,girl_run,girl_surf,girl_fish_offset,girl_fish_offset
|
PlayerB = POKEMONTRAINER_Leaf,trainer_POKEMONTRAINER_Leaf,girl_bike,girl_surf,girl_run,girl_surf,girl_fish_offset,girl_fish_offset
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
[001]
|
[001]
|
||||||
# Intro
|
# Intro
|
||||||
|
|||||||
Reference in New Issue
Block a user