Cleaned up evolution method definitions, rewrote the "Fill Bag" Debug feature to make it much faster, removed all instances of changing the game window's title

This commit is contained in:
Maruno17
2021-07-22 22:46:43 +01:00
parent d21d3cb1fd
commit cb0220b751
15 changed files with 89 additions and 98 deletions

View File

@@ -123,7 +123,6 @@ module Compiler
end
lineno += 1
Graphics.update if lineno%1000==0
pbSetWindowText(_INTL("Processing {1} line {2}",FileLineData.file,lineno)) if lineno%200==0
}
yield lastsection,sectionname if havesection
end
@@ -726,7 +725,7 @@ module Compiler
compile_metadata # Depends on TrainerType
yield(_INTL("Compiling animations"))
compile_animations
yield(_INTL("Converting events"))
yield("")
compile_trainer_events(mustCompile)
yield(_INTL("Saving messages"))
pbSetTextMessages
@@ -736,7 +735,6 @@ module Compiler
echoln ""
echoln _INTL("*** Finished full compile ***")
echoln ""
pbSetWindowText(nil)
end
def main
@@ -828,7 +826,7 @@ module Compiler
end
end
# Recompile all data
compile_all(mustCompile) { |msg| pbSetWindowText(msg); echoln(msg) }
compile_all(mustCompile) { |msg| echoln msg }
rescue Exception
e = $!
raise e if "#{e.class}"=="Reset" || e.is_a?(Reset) || e.is_a?(SystemExit)

View File

@@ -908,7 +908,6 @@ module Compiler
raise _INTL("Dex list number {1} is defined at least twice.\r\n{2}", section, FileLineData.linereport)
end
dex_lists[section] = []
pbSetWindowText(_INTL("Processing {1} section [{2}]", FileLineData.file, section))
else
raise _INTL("Expected a section at the beginning of the file.\r\n{1}", FileLineData.linereport) if !section
species_list = line.split(",")
@@ -1031,7 +1030,7 @@ module Compiler
raise _INTL("Minimum level is greater than maximum level: {1}\r\n{2}", line, FileLineData.linereport)
end
encounter_hash[:types][current_type].push(values)
elsif line[/^\[\s*(.+)\s*\]$/] # Map ID line (new format)
elsif line[/^\[\s*(.+)\s*\]$/] # Map ID line
values = $~[1].split(',').collect! { |v| v.strip.to_i }
values[1] = 0 if !values[1]
map_number = values[0]

View File

@@ -248,12 +248,13 @@ module Compiler
# Save Pokémon data to PBS file
#=============================================================================
def write_pokemon
echo _INTL("Writing species")
File.open("PBS/pokemon.txt", "wb") { |f|
idx = 0
add_PBS_header_to_file(f)
GameData::Species.each_species do |species|
echo "." if idx % 50 == 0
idx += 1
pbSetWindowText(_INTL("Writing species {1}...", idx))
Graphics.update if idx % 100 == 0
f.write("\#-------------------------------\r\n")
f.write(sprintf("[%s]\r\n", species.id))
@@ -335,7 +336,7 @@ module Compiler
f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense
end
}
pbSetWindowText(nil)
echoln _INTL("done")
Graphics.update
end
@@ -350,7 +351,6 @@ module Compiler
next if species.form == 0
base_species = GameData::Species.get(species.species)
idx += 1
pbSetWindowText(_INTL("Writing form {1}...", idx))
Graphics.update if idx % 100 == 0
f.write("\#-------------------------------\r\n")
f.write(sprintf("[%s,%d]\r\n", species.species, species.form))
@@ -441,7 +441,6 @@ module Compiler
end
end
}
pbSetWindowText(nil)
Graphics.update
end
@@ -573,12 +572,13 @@ module Compiler
# Save individual trainer data to PBS file
#=============================================================================
def write_trainers
echo _INTL("Writing trainers")
File.open("PBS/trainers.txt", "wb") { |f|
idx = 0
add_PBS_header_to_file(f)
GameData::Trainer.each do |trainer|
echo "." if idx % 50 == 0
idx += 1
pbSetWindowText(_INTL("Writing trainer {1}...", idx))
Graphics.update if idx % 50 == 0
f.write("\#-------------------------------\r\n")
if trainer.version > 0
@@ -617,7 +617,7 @@ module Compiler
end
end
}
pbSetWindowText(nil)
echoln _INTL("done")
Graphics.update
end

View File

@@ -1380,11 +1380,11 @@ module Compiler
t = Time.now.to_i
Graphics.update
trainerChecker = TrainerChecker.new
echo _INTL("Processing {1} maps...", mapData.mapinfos.keys.length)
for id in mapData.mapinfos.keys.sort
changed = false
map = mapData.getMap(id)
next if !map || !mapData.mapinfos[id]
pbSetWindowText(_INTL("Processing map {1} ({2})",id,mapData.mapinfos[id].name))
for key in map.events.keys
if Time.now.to_i-t>=5
Graphics.update
@@ -1415,12 +1415,15 @@ module Compiler
if changed
mapData.saveMap(id)
mapData.saveTilesets
echoln ""
echo _INTL("Map {1}: '{2}' modified and saved.", id, mapData.mapinfos[id].name)
end
end
echoln ""
changed = false
Graphics.update
commonEvents = load_data("Data/CommonEvents.rxdata")
pbSetWindowText(_INTL("Processing common events"))
echoln _INTL("Processing common events")
for key in 0...commonEvents.length
newevent = fix_event_use(commonEvents[key],0,mapData)
if newevent