mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Changed naming convention for various sprites, and added compiler script that renames files for this
This commit is contained in:
@@ -19,24 +19,24 @@ module GameData
|
|||||||
include InstanceMethods
|
include InstanceMethods
|
||||||
|
|
||||||
def self.icon_filename(item)
|
def self.icon_filename(item)
|
||||||
return "Graphics/Icons/itemBack" if item.nil?
|
return "Graphics/Items/back" if item.nil?
|
||||||
item_data = self.try_get(item)
|
item_data = self.try_get(item)
|
||||||
return "Graphics/Icons/item000" if item_data.nil?
|
return "Graphics/Items/000" if item_data.nil?
|
||||||
# Check for files
|
# Check for files
|
||||||
ret = sprintf("Graphics/Icons/item%s", item_data.id)
|
ret = sprintf("Graphics/Items/%s", item_data.id)
|
||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
ret = sprintf("Graphics/Icons/item%03d", item_data.id_number)
|
ret = sprintf("Graphics/Items/%03d", item_data.id_number)
|
||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
# Check for TM/HM type icons
|
# Check for TM/HM type icons
|
||||||
if item_data.is_machine?
|
if item_data.is_machine?
|
||||||
move_type = GameData::Move.get(item_data.move).type
|
move_type = GameData::Move.get(item_data.move).type
|
||||||
type_data = GameData::Type.get(move_type)
|
type_data = GameData::Type.get(move_type)
|
||||||
ret = sprintf("Graphics/Icons/itemMachine%s", type_data.id)
|
ret = sprintf("Graphics/Items/machine_%s", type_data.id)
|
||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
ret = sprintf("Graphics/Icons/itemMachine%03d", type_data.id_number)
|
ret = sprintf("Graphics/Items/machine_%03d", type_data.id_number)
|
||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
end
|
end
|
||||||
return "Graphics/Icons/item000"
|
return "Graphics/Items/000"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.held_icon_filename(item)
|
def self.held_icon_filename(item)
|
||||||
|
|||||||
@@ -17,19 +17,19 @@ module GameData
|
|||||||
extend ClassMethods
|
extend ClassMethods
|
||||||
include InstanceMethods
|
include InstanceMethods
|
||||||
|
|
||||||
def self.check_file(tr_type, path, suffix = "")
|
def self.check_file(tr_type, path, optional_suffix = "", suffix = "")
|
||||||
tr_type_data = self.try_get(tr_type)
|
tr_type_data = self.try_get(tr_type)
|
||||||
return nil if tr_type_data.nil?
|
return nil if tr_type_data.nil?
|
||||||
# Check for files
|
# Check for files
|
||||||
if !suffix.empty?
|
if !optional_suffix.empty?
|
||||||
ret = path + tr_type_data.id.to_s + suffix
|
ret = path + tr_type_data.id.to_s + optional_suffix + suffix
|
||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
ret = path + sprintf("%03d", tr_type_data.id_number) + suffix
|
ret = path + sprintf("%03d", tr_type_data.id_number) + optional_suffix + suffix
|
||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
end
|
end
|
||||||
ret = path + tr_type_data.id.to_s
|
ret = path + tr_type_data.id.to_s + suffix
|
||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
ret = path + sprintf("%03d", tr_type_data.id_number)
|
ret = path + sprintf("%03d", tr_type_data.id_number) + suffix
|
||||||
return (pbResolveBitmap(ret)) ? ret : nil
|
return (pbResolveBitmap(ret)) ? ret : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -44,21 +44,21 @@ module GameData
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.front_sprite_filename(tr_type)
|
def self.front_sprite_filename(tr_type)
|
||||||
return self.check_file(tr_type, "Graphics/Trainers/trainer")
|
return self.check_file(tr_type, "Graphics/Trainers/")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.player_front_sprite_filename(tr_type)
|
def self.player_front_sprite_filename(tr_type)
|
||||||
outfit = ($Trainer) ? $Trainer.outfit : 0
|
outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||||
return self.check_file(tr_type, "Graphics/Trainers/trainer", sprintf("_%d", outfit))
|
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.back_sprite_filename(tr_type)
|
def self.back_sprite_filename(tr_type)
|
||||||
return self.check_file(tr_type, "Graphics/Trainers/trback")
|
return self.check_file(tr_type, "Graphics/Trainers/", nil, "_back")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.player_back_sprite_filename(tr_type)
|
def self.player_back_sprite_filename(tr_type)
|
||||||
outfit = ($Trainer) ? $Trainer.outfit : 0
|
outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||||
return self.check_file(tr_type, "Graphics/Trainers/trback", sprintf("_%d", outfit))
|
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit), "_back")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.map_icon_filename(tr_type)
|
def self.map_icon_filename(tr_type)
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
module GameData
|
module GameData
|
||||||
class Species
|
class Species
|
||||||
def self.check_graphic_file(path, species, form = 0, gender = 0, shiny = false, shadow = false, back = false)
|
def self.check_graphic_file(path, species, form = 0, gender = 0, shiny = false, shadow = false, subfolder = "")
|
||||||
|
try_subfolder = sprintf("%s/", subfolder)
|
||||||
species_data = self.get_species_form(species, form)
|
species_data = self.get_species_form(species, form)
|
||||||
species_id = sprintf("%03d", (species_data) ? self.get(species_data.species).id_number : 0)
|
species_id = sprintf("%03d", (species_data) ? self.get(species_data.species).id_number : 0)
|
||||||
try_species = species
|
try_species = species
|
||||||
try_form = (form > 0) ? sprintf("_%d", form) : ""
|
try_form = (form > 0) ? sprintf("_%d", form) : ""
|
||||||
try_gender = (gender == 1) ? "f" : ""
|
try_gender = (gender == 1) ? "_female" : ""
|
||||||
try_shiny = (shiny) ? "s" : ""
|
|
||||||
try_shadow = (shadow) ? "_shadow" : ""
|
try_shadow = (shadow) ? "_shadow" : ""
|
||||||
try_back = (back) ? "b" : ""
|
|
||||||
factors = []
|
factors = []
|
||||||
factors.push([4, try_shadow, ""]) if shadow
|
factors.push([4, sprintf("%s shiny/", subfolder), try_subfolder]) if shiny
|
||||||
|
factors.push([3, try_shadow, ""]) if shadow
|
||||||
factors.push([2, try_gender, ""]) if gender == 1
|
factors.push([2, try_gender, ""]) if gender == 1
|
||||||
factors.push([3, try_shiny, ""]) if shiny
|
|
||||||
factors.push([1, try_form, ""]) if form > 0
|
factors.push([1, try_form, ""]) if form > 0
|
||||||
factors.push([0, try_species, "000"])
|
factors.push([0, try_species, "000"])
|
||||||
# Go through each combination of parameters in turn to find an existing sprite
|
# Go through each combination of parameters in turn to find an existing sprite
|
||||||
@@ -21,19 +20,19 @@ module GameData
|
|||||||
factors.each_with_index do |factor, index|
|
factors.each_with_index do |factor, index|
|
||||||
value = ((i / (2 ** index)) % 2 == 0) ? factor[1] : factor[2]
|
value = ((i / (2 ** index)) % 2 == 0) ? factor[1] : factor[2]
|
||||||
case factor[0]
|
case factor[0]
|
||||||
when 0 then try_species = value
|
when 0 then try_species = value
|
||||||
when 1 then try_form = value
|
when 1 then try_form = value
|
||||||
when 2 then try_gender = value
|
when 2 then try_gender = value
|
||||||
when 3 then try_shiny = value
|
when 3 then try_shadow = value
|
||||||
when 4 then try_shadow = value
|
when 4 then try_subfolder = value # Shininess
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Look for a graphic matching this combination's parameters
|
# Look for a graphic matching this combination's parameters
|
||||||
for j in 0...2 # Try using the species' ID symbol and then its ID number
|
for j in 0...2 # Try using the species' ID symbol and then its ID number
|
||||||
next if !try_species || (try_species == "000" && j == 1)
|
next if !try_species || (try_species == "000" && j == 1)
|
||||||
try_species_text = (j == 0) ? try_species : species_id
|
try_species_text = (j == 0) ? try_species : species_id
|
||||||
ret = pbResolveBitmap(sprintf("%s%s%s%s%s%s%s", path,
|
ret = pbResolveBitmap(sprintf("%s%s%s%s%s%s", path, try_subfolder,
|
||||||
try_species_text, try_gender, try_shiny, try_back, try_form, try_shadow))
|
try_species_text, try_form, try_gender, try_shadow))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -45,27 +44,27 @@ module GameData
|
|||||||
return nil if species_data.nil?
|
return nil if species_data.nil?
|
||||||
species_id = self.get(species_data.species).id_number
|
species_id = self.get(species_data.species).id_number
|
||||||
if form > 0
|
if form > 0
|
||||||
ret = pbResolveBitmap(sprintf("%s%segg_%d", path, species_data.species, form))
|
ret = pbResolveBitmap(sprintf("%s%s_%d", path, species_data.species, form))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
ret = pbResolveBitmap(sprintf("%s%03degg_%d", path, species_id, form))
|
ret = pbResolveBitmap(sprintf("%s%03d_%d", path, species_id, form))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
end
|
end
|
||||||
ret = pbResolveBitmap(sprintf("%s%segg", path, species_data.species))
|
ret = pbResolveBitmap(sprintf("%s%s", path, species_data.species))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
return pbResolveBitmap(sprintf("%s%03degg", path, species_id))
|
return pbResolveBitmap(sprintf("%s%03d", path, species_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.front_sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false)
|
def self.front_sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false)
|
||||||
return self.check_graphic_file("Graphics/Battlers/", species, form, gender, shiny, shadow)
|
return self.check_graphic_file("Graphics/Pokemon/", species, form, gender, shiny, shadow, "Front")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.back_sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false)
|
def self.back_sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false)
|
||||||
return self.check_graphic_file("Graphics/Battlers/", species, form, gender, shiny, shadow, true)
|
return self.check_graphic_file("Graphics/Pokemon/", species, form, gender, shiny, shadow, "Back")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.egg_sprite_filename(species, form)
|
def self.egg_sprite_filename(species, form)
|
||||||
ret = self.check_egg_graphic_file("Graphics/Battlers/", species, form)
|
ret = self.check_egg_graphic_file("Graphics/Pokemon/Eggs/", species, form)
|
||||||
return (ret) ? ret : pbResolveBitmap("Graphics/Battlers/egg")
|
return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false, back = false, egg = false)
|
def self.sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false, back = false, egg = false)
|
||||||
@@ -117,13 +116,13 @@ module GameData
|
|||||||
#===========================================================================
|
#===========================================================================
|
||||||
|
|
||||||
def self.egg_icon_filename(species, form)
|
def self.egg_icon_filename(species, form)
|
||||||
ret = self.check_egg_graphic_file("Graphics/Icons/icon", species, form)
|
ret = self.check_egg_graphic_file("Graphics/Pokemon/Icons", species, form)
|
||||||
return (ret) ? ret : pbResolveBitmap("Graphics/Icons/iconEgg")
|
return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Icons/000_egg")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.icon_filename(species, form = 0, gender = 0, shiny = false, shadow = false, egg = false)
|
def self.icon_filename(species, form = 0, gender = 0, shiny = false, shadow = false, egg = false)
|
||||||
return self.egg_icon_filename(species, form) if egg
|
return self.egg_icon_filename(species, form) if egg
|
||||||
return self.check_graphic_file("Graphics/Icons/icon", species, form, gender, shiny, shadow)
|
return self.check_graphic_file("Graphics/Pokemon/", species, form, gender, shiny, shadow, "Icons")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.icon_filename_from_pokemon(pkmn)
|
def self.icon_filename_from_pokemon(pkmn)
|
||||||
@@ -151,14 +150,14 @@ module GameData
|
|||||||
return nil if species_data.nil?
|
return nil if species_data.nil?
|
||||||
species_id = self.get(species_data.species).id_number
|
species_id = self.get(species_data.species).id_number
|
||||||
if form > 0
|
if form > 0
|
||||||
ret = pbResolveBitmap(sprintf("Graphics/Icons/Footprints/footprint%s_%d", species_data.species, form))
|
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%s_%d", species_data.species, form))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
ret = pbResolveBitmap(sprintf("Graphics/Icons/Footprints/footprint%03d_%d", species_id, form))
|
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%03d_%d", species_id, form))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
end
|
end
|
||||||
ret = pbResolveBitmap(sprintf("Graphics/Icons/Footprints/footprint%s", species_data.species))
|
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%s", species_data.species))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
return pbResolveBitmap(sprintf("Graphics/Icons/Footprints/footprint%03d", species_id))
|
return pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%03d", species_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
@@ -169,17 +168,17 @@ module GameData
|
|||||||
species_id = self.get(species_data.species).id_number
|
species_id = self.get(species_data.species).id_number
|
||||||
# Look for species-specific shadow graphic
|
# Look for species-specific shadow graphic
|
||||||
if form > 0
|
if form > 0
|
||||||
ret = pbResolveBitmap(sprintf("Graphics/Battlers/%s_%d_battleshadow", species_data.species, form))
|
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", species_data.species, form))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
ret = pbResolveBitmap(sprintf("Graphics/Battlers/%03d_%d_battleshadow", species_id, form))
|
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%03d_%d", species_id, form))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
end
|
end
|
||||||
ret = pbResolveBitmap(sprintf("Graphics/Battlers/%s_battleshadow", species_data.species))
|
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
ret = pbResolveBitmap(sprintf("Graphics/Battlers/%03d_battleshadow", species_id))
|
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%03d", species_id))
|
||||||
return ret if ret
|
return ret if ret
|
||||||
# Use general shadow graphic
|
# Use general shadow graphic
|
||||||
return pbResolveBitmap(sprintf("Graphics/Pictures/Battle/battler_shadow_%d", species_data.shadow_size))
|
return pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%d", species_data.shadow_size))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.shadow_bitmap(species, form = 0)
|
def self.shadow_bitmap(species, form = 0)
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ class PokemonEggHatch_Scene
|
|||||||
@pokemon.form, @pokemon.shiny?,
|
@pokemon.form, @pokemon.shiny?,
|
||||||
false, false, true) # Egg sprite
|
false, false, true) # Egg sprite
|
||||||
# Load egg cracks bitmap
|
# Load egg cracks bitmap
|
||||||
crackfilename = sprintf("Graphics/Battlers/%seggCracks", @pokemon.species)
|
crackfilename = sprintf("Graphics/Pokemon/Eggs/%s_cracks", @pokemon.species)
|
||||||
if !pbResolveBitmap(crackfilename)
|
if !pbResolveBitmap(crackfilename)
|
||||||
crackfilename = sprintf("Graphics/Battlers/%03deggCracks", @pokemon.species_data.id_number)
|
crackfilename = sprintf("Graphics/Pokemon/Eggs/%03d_cracks", @pokemon.species_data.id_number)
|
||||||
crackfilename = sprintf("Graphics/Battlers/eggCracks") if !pbResolveBitmap(crackfilename)
|
crackfilename = sprintf("Graphics/Pokemon/Eggs/000_cracks") if !pbResolveBitmap(crackfilename)
|
||||||
end
|
end
|
||||||
crackfilename=pbResolveBitmap(crackfilename)
|
crackfilename=pbResolveBitmap(crackfilename)
|
||||||
@hatchSheet=AnimatedBitmap.new(crackfilename)
|
@hatchSheet=AnimatedBitmap.new(crackfilename)
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class RpgxpMartAdapter
|
|||||||
def getItemIcon(item)
|
def getItemIcon(item)
|
||||||
return nil if !item
|
return nil if !item
|
||||||
if item == 0
|
if item == 0
|
||||||
return sprintf("Graphics/Icons/itemBack")
|
return sprintf("Graphics/Items/back")
|
||||||
elsif item.respond_to?("icon_index")
|
elsif item.respond_to?("icon_index")
|
||||||
return "Graphics/System/IconSet"
|
return "Graphics/System/IconSet"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -668,6 +668,8 @@ module Compiler
|
|||||||
yield(_INTL("Saving messages"))
|
yield(_INTL("Saving messages"))
|
||||||
pbSetTextMessages
|
pbSetTextMessages
|
||||||
MessageTypes.saveMessages
|
MessageTypes.saveMessages
|
||||||
|
yield(_INTL("Renaming sprites and cries"))
|
||||||
|
convert_files
|
||||||
end
|
end
|
||||||
pbSetWindowText(nil)
|
pbSetWindowText(nil)
|
||||||
end
|
end
|
||||||
|
|||||||
238
Data/Scripts/022_Compiler/005_Compiler_Sprite renamer.rb
Normal file
238
Data/Scripts/022_Compiler/005_Compiler_Sprite renamer.rb
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
class File
|
||||||
|
# Copies the source file to the destination path.
|
||||||
|
def self.copy(source, destination)
|
||||||
|
data = ""
|
||||||
|
t = Time.now
|
||||||
|
File.open(source, 'rb') do |f|
|
||||||
|
while r = f.read(4096)
|
||||||
|
if Time.now - t > 1
|
||||||
|
Graphics.update
|
||||||
|
t = Time.now
|
||||||
|
end
|
||||||
|
data += r
|
||||||
|
end
|
||||||
|
end
|
||||||
|
File.delete(destination) if File.file?(destination)
|
||||||
|
f = File.new(destination, 'wb')
|
||||||
|
f.write data
|
||||||
|
f.close
|
||||||
|
end
|
||||||
|
|
||||||
|
# Copies the source to the destination and deletes the source.
|
||||||
|
def self.move(source, destination)
|
||||||
|
File.copy(source, destination)
|
||||||
|
File.delete(source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
|
module Compiler
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def readDirectoryFiles(directory, formats)
|
||||||
|
files = []
|
||||||
|
Dir.chdir(directory) {
|
||||||
|
for i in 0...formats.length
|
||||||
|
Dir.glob(formats[i]) { |f| files.push(f) }
|
||||||
|
end
|
||||||
|
}
|
||||||
|
return files
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_pokemon_filename(full_name, default_prefix = "")
|
||||||
|
name = full_name
|
||||||
|
extension = nil
|
||||||
|
if full_name[/^(.+)\.([^\.]+)$/] # Of the format something.abc
|
||||||
|
name = $~[1]
|
||||||
|
extension = $~[2]
|
||||||
|
end
|
||||||
|
prefix = default_prefix
|
||||||
|
form = female = shadow = crack = ""
|
||||||
|
if default_prefix == ""
|
||||||
|
if name[/s/] && !name[/shadow/]
|
||||||
|
prefix = (name[/b/]) ? "Back shiny/" : "Front shiny/"
|
||||||
|
else
|
||||||
|
prefix = (name[/b/]) ? "Back/" : "Front/"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if name[/000/]
|
||||||
|
species = "000"
|
||||||
|
else
|
||||||
|
species_number = name[0, 3].to_i
|
||||||
|
species_data = GameData::Species.try_get(species_number)
|
||||||
|
raise _INTL("Species {1} is not defined (trying to rename Pokémon graphic {2}).", species_number, full_name) if !species_data
|
||||||
|
species = species_data.id.to_s
|
||||||
|
form = "_" + $~[1].to_s if name[/_(\d+)/]
|
||||||
|
female = "_female" if name[/f/]
|
||||||
|
shadow = "_shadow" if name[/_shadow/]
|
||||||
|
if name[/egg/]
|
||||||
|
(default_prefix == "") ? prefix = "Eggs/" : crack = "_egg"
|
||||||
|
crack = "_cracks" if name[/eggCracks/]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return prefix + species + form + female + shadow + crack + ((extension) ? "." + extension : ".png")
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_pokemon_sprites(src_dir, dest_dir)
|
||||||
|
return if !FileTest.directory?(src_dir)
|
||||||
|
# generates a list of all graphic files
|
||||||
|
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
|
||||||
|
# starts automatic renaming
|
||||||
|
files.each_with_index do |file, i|
|
||||||
|
Graphics.update if i % 100 == 0
|
||||||
|
pbSetWindowText(_INTL("Converting Pokémon sprites {1}/{2}...", i, files.length)) if i % 50 == 0
|
||||||
|
case file
|
||||||
|
when "battlers.png"
|
||||||
|
File.delete(src_dir + file)
|
||||||
|
when "egg.png"
|
||||||
|
File.move(src_dir + file, dest_dir + "Eggs/000.png")
|
||||||
|
when "eggCracks.png"
|
||||||
|
File.move(src_dir + file, dest_dir + "Eggs/000_cracks.png")
|
||||||
|
else
|
||||||
|
next if !file[/^\d{3}[^\.]*\.[^\.]*$/]
|
||||||
|
new_filename = convert_pokemon_filename(file)
|
||||||
|
# moves the files into their appropriate folders
|
||||||
|
File.move(src_dir + file, dest_dir + new_filename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Dir.delete(src_dir) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_pokemon_icons(src_dir, dest_dir)
|
||||||
|
return if !FileTest.directory?(src_dir)
|
||||||
|
# generates a list of all graphic files
|
||||||
|
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
|
||||||
|
# starts automatic renaming
|
||||||
|
files.each_with_index do |file, i|
|
||||||
|
Graphics.update if i % 100 == 0
|
||||||
|
pbSetWindowText(_INTL("Converting Pokémon icons {1}/{2}...", i, files.length)) if i % 50 == 0
|
||||||
|
case file
|
||||||
|
when "iconEgg.png"
|
||||||
|
File.move(src_dir + file, dest_dir + "Icons/000_egg.png")
|
||||||
|
else
|
||||||
|
next if !file[/^icon\d{3}[^\.]*\.[^\.]*$/]
|
||||||
|
new_filename = convert_pokemon_filename(file.sub(/^icon/, ''), "Icons/")
|
||||||
|
# moves the files into their appropriate folders
|
||||||
|
File.move(src_dir + file, dest_dir + new_filename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_pokemon_footprints(src_dir, dest_dir)
|
||||||
|
return if !FileTest.directory?(src_dir)
|
||||||
|
# generates a list of all graphic files
|
||||||
|
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
|
||||||
|
# starts automatic renaming
|
||||||
|
files.each_with_index do |file, i|
|
||||||
|
Graphics.update if i % 100 == 0
|
||||||
|
pbSetWindowText(_INTL("Converting footprints {1}/{2}...", i, files.length)) if i % 50 == 0
|
||||||
|
next if !file[/^footprint\d{3}[^\.]*\.[^\.]*$/]
|
||||||
|
new_filename = convert_pokemon_filename(file.sub(/^footprint/, ''), "Footprints/")
|
||||||
|
# moves the files into their appropriate folders
|
||||||
|
File.move(src_dir + file, dest_dir + new_filename)
|
||||||
|
end
|
||||||
|
Dir.delete(src_dir) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_item_icons(src_dir, dest_dir)
|
||||||
|
return if !FileTest.directory?(src_dir)
|
||||||
|
# generates a list of all graphic files
|
||||||
|
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
|
||||||
|
# starts automatic renaming
|
||||||
|
files.each_with_index do |file, i|
|
||||||
|
Graphics.update if i % 100 == 0
|
||||||
|
pbSetWindowText(_INTL("Converting item icons {1}/{2}...", i, files.length)) if i % 50 == 0
|
||||||
|
case file
|
||||||
|
when "item000.png"
|
||||||
|
File.move(src_dir + file, dest_dir + "000.png")
|
||||||
|
when "itemBack.png"
|
||||||
|
File.move(src_dir + file, dest_dir + "back.png")
|
||||||
|
else
|
||||||
|
if file[/^itemMachine(.+)\.([^\.]*)$/]
|
||||||
|
type = $~[1]
|
||||||
|
extension = $~[2]
|
||||||
|
File.move(src_dir + file, dest_dir + "machine_" + type + "." + extension)
|
||||||
|
elsif file[/^item(\d{3})[^\.]*\.([^\.]*)$/]
|
||||||
|
item_number = $~[1].to_i
|
||||||
|
extension = $~[2]
|
||||||
|
item_data = GameData::Item.try_get(item_number)
|
||||||
|
raise _INTL("Item {1} is not defined (trying to rename item icon {2}).", item_number, file) if !item_data
|
||||||
|
item = item_data.id.to_s
|
||||||
|
# moves the files into their appropriate folders
|
||||||
|
File.move(src_dir + file, dest_dir + item + "." + extension)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_pokemon_cries(src_dir)
|
||||||
|
return if !FileTest.directory?(src_dir)
|
||||||
|
# generates a list of all audio files
|
||||||
|
files = readDirectoryFiles(src_dir, ["*.wav", "*.mp3", "*.ogg"])
|
||||||
|
# starts automatic renaming
|
||||||
|
files.each_with_index do |file, i|
|
||||||
|
Graphics.update if i % 100 == 0
|
||||||
|
pbSetWindowText(_INTL("Converting Pokémon cries {1}/{2}...", i, files.length)) if i % 50 == 0
|
||||||
|
if file[/^(\d{3})Cry[^\.]*\.([^\.]*)$/]
|
||||||
|
species_number = $~[1].to_i
|
||||||
|
extension = $~[2]
|
||||||
|
form = (file[/Cry_(\d+)\./]) ? sprintf("_%s", $~[1]) : ""
|
||||||
|
species_data = GameData::Species.try_get(species_number)
|
||||||
|
raise _INTL("Species {1} is not defined (trying to rename species cry {2}).", species_number, file) if !species_data
|
||||||
|
species = species_data.id.to_s
|
||||||
|
File.move(src_dir + file, src_dir + species + form + "." + extension)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_trainer_sprites(src_dir)
|
||||||
|
return if !FileTest.directory?(src_dir)
|
||||||
|
# generates a list of all graphic files
|
||||||
|
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
|
||||||
|
# starts automatic renaming
|
||||||
|
files.each_with_index do |file, i|
|
||||||
|
Graphics.update if i % 100 == 0
|
||||||
|
pbSetWindowText(_INTL("Converting trainer sprites {1}/{2}...", i, files.length)) if i % 50 == 0
|
||||||
|
if file[/^trainer(\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 sprite {2}).", tr_type_number, file) if !tr_type_data
|
||||||
|
tr_type = tr_type_data.id.to_s
|
||||||
|
File.move(src_dir + file, src_dir + tr_type + "." + extension)
|
||||||
|
elsif file[/^trback(\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 sprite {2}).", tr_type_number, file) if !tr_type_data
|
||||||
|
tr_type = tr_type_data.id.to_s
|
||||||
|
File.move(src_dir + file, src_dir + tr_type + "_back." + extension)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_files
|
||||||
|
return if !pbConfirmMessage("Do you want to check for Pokémon graphics/cries and item icons that need renaming?")
|
||||||
|
# Rename and move Pokémon sprites/icons
|
||||||
|
dest_dir = "Graphics/Pokemon/"
|
||||||
|
Dir.mkdir(dest_dir) if !FileTest.directory?(dest_dir)
|
||||||
|
for ext in ["Front/", "Back/", "Icons/", "Front shiny/", "Back shiny/", "Icons shiny/",
|
||||||
|
"Eggs/", "Footprints/", "Shadow/"]
|
||||||
|
Dir.mkdir(dest_dir + ext) if !FileTest.directory?(dest_dir + ext)
|
||||||
|
end
|
||||||
|
convert_pokemon_sprites("Graphics/Battlers/", dest_dir)
|
||||||
|
convert_pokemon_icons("Graphics/Icons/", dest_dir)
|
||||||
|
convert_pokemon_footprints("Graphics/Icons/Footprints/", dest_dir)
|
||||||
|
# Rename and move item icons
|
||||||
|
dest_dir = "Graphics/Items/"
|
||||||
|
Dir.mkdir(dest_dir) if !FileTest.directory?(dest_dir)
|
||||||
|
convert_item_icons("Graphics/Icons/", dest_dir)
|
||||||
|
# Rename Pokémon cries
|
||||||
|
convert_pokemon_cries("Audio/SE/Cries/")
|
||||||
|
# Rename trainer sprites
|
||||||
|
convert_trainer_sprites("Graphics/Trainers/")
|
||||||
|
pbSetWindowText(nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
Compiler.main
|
|
||||||
pbSetUpSystem
|
|
||||||
|
|
||||||
class Scene_DebugIntro
|
class Scene_DebugIntro
|
||||||
def main
|
def main
|
||||||
Graphics.transition(0)
|
Graphics.transition(0)
|
||||||
@@ -13,10 +10,9 @@ end
|
|||||||
|
|
||||||
def pbCallTitle
|
def pbCallTitle
|
||||||
return Scene_DebugIntro.new if $DEBUG
|
return Scene_DebugIntro.new if $DEBUG
|
||||||
# First parameter is an array of images in the Titles
|
# First parameter is an array of images in the Titles directory without a file
|
||||||
# directory without a file extension, to show before the
|
# extension, to show before the actual title screen. Second parameter is the
|
||||||
# actual title screen. Second parameter is the actual
|
# actual title screen filename, also in Titles with no extension.
|
||||||
# title screen filename, also in Titles with no extension.
|
|
||||||
return Scene_Intro.new(['intro1'], 'splash')
|
return Scene_Intro.new(['intro1'], 'splash')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -31,9 +27,8 @@ end
|
|||||||
|
|
||||||
def mainFunctionDebug
|
def mainFunctionDebug
|
||||||
begin
|
begin
|
||||||
getCurrentProcess = Win32API.new("kernel32.dll", "GetCurrentProcess", "", "l")
|
Compiler.main
|
||||||
setPriorityClass = Win32API.new("kernel32.dll", "SetPriorityClass", %w(l i), "")
|
pbSetUpSystem
|
||||||
setPriorityClass.call(getCurrentProcess.call(), 32768) # "Above normal" priority class
|
|
||||||
$data_animations = pbLoadRxData("Data/Animations")
|
$data_animations = pbLoadRxData("Data/Animations")
|
||||||
$data_tilesets = pbLoadRxData("Data/Tilesets")
|
$data_tilesets = pbLoadRxData("Data/Tilesets")
|
||||||
$data_common_events = pbLoadRxData("Data/CommonEvents")
|
$data_common_events = pbLoadRxData("Data/CommonEvents")
|
||||||
|
|||||||
Reference in New Issue
Block a user