Removed script/event text collation from compiler (added a debug function to do that instead), removed system cache reloader from compiler

This commit is contained in:
Maruno17
2023-04-06 17:47:42 +01:00
parent 3d9d31621b
commit 1ddf89c2df
5 changed files with 42 additions and 34 deletions

View File

@@ -1180,6 +1180,18 @@ MenuHandlers.add(:debug_menu, :rename_files, {
}
})
MenuHandlers.add(:debug_menu, :rename_files, {
"name" => _INTL("Collate Script/Event Texts For Translation"),
"parent" => :files_menu,
"description" => _INTL("Get translatable text from scripts/map events. Do this before extracting text."),
"effect" => proc {
Translator.gather_script_and_event_texts
MessageTypes.save_default_messages
MessageTypes.load_default_messages if safeExists?("Data/messages_core.dat")
pbMessage(_INTL("Translatable text gathered from scripts and map events and saved in data files."))
}
})
MenuHandlers.add(:debug_menu, :extract_text, {
"name" => _INTL("Extract Text For Translation"),
"parent" => :files_menu,

View File

@@ -1015,14 +1015,6 @@ module Compiler
compile_pbs_files
compile_animations
compile_trainer_events(mustCompile)
Console.echo_li(_INTL("Saving messages..."))
Translator.gather_script_and_event_texts
MessageTypes.save_default_messages
MessageTypes.load_default_messages if safeExists?("Data/messages_core.dat")
Console.echo_done(true)
Console.echo_li(_INTL("Reloading cache..."))
System.reload_cache
Console.echo_done(true)
Console.echoln_li_done(_INTL("Successfully compiled all game data"))
end

View File

@@ -20,8 +20,8 @@ module Compiler
# the keys are the XXX and the values are the YYY (as unprocessed strings).
idx = 0
pbEachFileSection(f, schema) do |contents, section_name|
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
data_hash = {
:id => section_name.to_sym,
@@ -390,8 +390,8 @@ module Compiler
# the keys are the XXX and the values are the YYY (as unprocessed strings).
idx = 0
pbEachFileSection(f, schema) do |contents, section_name|
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
data_hash = {
:id => section_name.to_sym,
@@ -639,9 +639,9 @@ module Compiler
current_type = nil
idx = 0
pbCompilerEachPreppedLine(path) do |line, line_no|
echo "." if idx % 50 == 0
echo "." if idx % 100 == 0
idx += 1
Graphics.update if idx % 250 == 0
Graphics.update if idx % 500 == 0
next if line.length == 0
if current_type && line[/^\d+,/] # Species line
values = line.split(",").collect! { |v| v.strip }
@@ -777,9 +777,9 @@ module Compiler
section_line = nil
# Read each line of trainers.txt at a time and compile it as a trainer property
pbCompilerEachPreppedLine(path) do |line, line_no|
echo "." if idx % 50 == 0
echo "." if idx % 100 == 0
idx += 1
Graphics.update if idx % 250 == 0
Graphics.update if idx % 500 == 0
FileLineData.setSection(section_name, nil, section_line)
if line[/^\s*\[\s*(.+)\s*\]\s*$/]
# New section [trainer_type, name] or [trainer_type, name, version]
@@ -1061,8 +1061,8 @@ module Compiler
# the keys are the XXX and the values are the YYY (as unprocessed strings).
idx = 0
pbEachFileSection(f) do |contents, section_name|
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
schema = (section_name.to_i == 0) ? global_schema : player_schema
data_hash = {
@@ -1270,7 +1270,11 @@ module Compiler
# end
# pbanims[anim.id] = pbConvertRPGAnimation(anim) if !found
# end
idx = 0
pbanims.length.times do |i|
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
next if !pbanims[i]
if pbanims[i].name[/^OppMove\:\s*(.*)$/]
if GameData::Move.exists?($~[1])

View File

@@ -31,8 +31,8 @@ module Compiler
# Write each element in turn
game_data.each do |element|
next if element.pbs_file_suffix != path[1]
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
f.write("\#-------------------------------\r\n")
if schema["SectionName"]
@@ -189,8 +189,8 @@ module Compiler
# Write each element in turn
GameData::Species.each_species do |element|
next if element.pbs_file_suffix != path[1]
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
f.write("\#-------------------------------\r\n")
if schema["SectionName"]
@@ -249,8 +249,8 @@ module Compiler
GameData::Species.each do |element|
next if element.form == 0
next if element.pbs_file_suffix != path[1]
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
f.write("\#-------------------------------\r\n")
if schema["SectionName"]
@@ -317,8 +317,8 @@ module Compiler
element.shadow_x == base_element.shadow_x &&
element.shadow_size == base_element.shadow_size
end
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
f.write("\#-------------------------------\r\n")
if schema["SectionName"]
@@ -410,8 +410,8 @@ module Compiler
add_PBS_header_to_file(f)
GameData::Encounter.each do |element|
next if element.pbs_file_suffix != path[1]
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
f.write("\#-------------------------------\r\n")
map_name = (map_infos[element.map]) ? " # #{map_infos[element.map].name}" : ""
@@ -463,8 +463,8 @@ module Compiler
# Write each element in turn
GameData::Trainer.each do |element|
next if element.pbs_file_suffix != path[1]
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
f.write("\#-------------------------------\r\n")
if schema["SectionName"]
@@ -696,8 +696,8 @@ module Compiler
add_PBS_header_to_file(f)
GameData::MapMetadata.each do |element|
next if element.pbs_file_suffix != path[1]
echo "." if idx % 50 == 0
Graphics.update if idx % 250 == 0
echo "." if idx % 100 == 0
Graphics.update if idx % 500 == 0
idx += 1
f.write("\#-------------------------------\r\n")
map_name = (map_infos && map_infos[element.id]) ? map_infos[element.id].name : nil

View File

@@ -1681,9 +1681,9 @@ module Compiler
Console.echo_li(_INTL("Processing {1} maps...", mapData.mapinfos.keys.length))
idx = 0
mapData.mapinfos.keys.sort.each do |id|
echo "." if idx % 20 == 0
echo "." if idx % 100 == 0
idx += 1
Graphics.update if idx % 250 == 0
Graphics.update if idx % 500 == 0
changed = false
map = mapData.getMap(id)
next if !map || !mapData.mapinfos[id]