More aligning of code

This commit is contained in:
Maruno17
2021-12-19 12:19:08 +00:00
parent 13a238cc6a
commit 33781493f4
121 changed files with 977 additions and 838 deletions

View File

@@ -349,10 +349,9 @@ module Compiler
end
# Parse move
line = pbGetCsvRecord(line, line_no,
[0, "snssueeuuueiss",
nil, nil, nil, nil, nil, :Type, ["Physical", "Special", "Status"],
nil, nil, nil, :Target, nil, nil, nil]
)
[0, "snssueeuuueiss",
nil, nil, nil, nil, nil, :Type, ["Physical", "Special", "Status"],
nil, nil, nil, :Target, nil, nil, nil])
move_id = line[1].to_sym
if GameData::Move::DATA[move_id]
raise _INTL("Move ID '{1}' is used twice.\r\n{2}", move_id, FileLineData.linereport)
@@ -470,9 +469,8 @@ module Compiler
GameData::Item.register(item_hash) if item_hash
# Parse item
line = pbGetCsvRecord(line, line_no,
[0, "snssvusuuUE", nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, :Move]
)
[0, "snssvusuuUE", nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, :Move])
item_id = line[1].to_sym
if GameData::Item.exists?(item_id)
raise _INTL("Item ID '{1}' is used twice.\r\n{2}", item_id, FileLineData.linereport)
@@ -1213,7 +1211,7 @@ module Compiler
values = line.split(',').collect! { |v| v.strip }
if !values || values.length < 3
raise _INTL("Expected a species entry line for encounter type {1} for map '{2}', got \"{3}\" instead.\r\n{4}",
GameData::EncounterType.get(current_type).real_name, encounter_hash[:map], line, FileLineData.linereport)
GameData::EncounterType.get(current_type).real_name, encounter_hash[:map], line, FileLineData.linereport)
end
values = pbGetCsvRecord(line, line_no, [0, "vevV", nil, :Species])
values[3] = values[2] if !values[3]
@@ -1275,7 +1273,7 @@ module Compiler
encounter_hash[:types][current_type] = []
else
raise _INTL("Undefined encounter type \"{1}\" for map '{2}'.\r\n{3}",
line, encounter_hash[:map], FileLineData.linereport)
line, encounter_hash[:map], FileLineData.linereport)
end
end
}
@@ -1342,13 +1340,12 @@ module Compiler
GameData::TrainerType.register(tr_type_hash) if tr_type_hash
# Parse trainer type
line = pbGetCsvRecord(line, line_no,
[0, "snsUSSSeUS",
nil, nil, nil, nil, nil, nil, nil,
{ "Male" => 0, "M" => 0, "0" => 0,
"Female" => 1, "F" => 1, "1" => 1,
"Mixed" => 2, "X" => 2, "2" => 2, "" => 2 },
nil, nil]
)
[0, "snsUSSSeUS",
nil, nil, nil, nil, nil, nil, nil,
{ "Male" => 0, "M" => 0, "0" => 0,
"Female" => 1, "F" => 1, "1" => 1,
"Mixed" => 2, "X" => 2, "2" => 2, "" => 2 },
nil, nil])
tr_type_id = line[1].to_sym
if GameData::TrainerType.exists?(tr_type_id)
raise _INTL("Trainer Type ID '{1}' is used twice.\r\n{2}", tr_type_id, FileLineData.linereport)

View File

@@ -28,8 +28,8 @@ module Compiler
f.write(sprintf("[%d]\r\n", i))
rname = pbGetMessage(MessageTypes::RegionNames, i)
f.write(sprintf("Name = %s\r\nFilename = %s\r\n",
(rname && rname != "") ? rname : _INTL("Unnamed"),
csvQuote((map[1].is_a?(Array)) ? map[1][0] : map[1])))
(rname && rname != "") ? rname : _INTL("Unnamed"),
csvQuote((map[1].is_a?(Array)) ? map[1][0] : map[1])))
for loc in map[2]
f.write("Point = ")
pbWriteCsvRecord(loc, f, [nil, "uussUUUU"])
@@ -84,12 +84,12 @@ module Compiler
# Skip if map no longer exists
next if !mapinfos[conn[0]] || !mapinfos[conn[3]]
f.write(sprintf("# %s (%d) - %s (%d)\r\n",
(mapinfos[conn[0]]) ? mapinfos[conn[0]].name : "???", conn[0],
(mapinfos[conn[3]]) ? mapinfos[conn[3]].name : "???", conn[3]))
(mapinfos[conn[0]]) ? mapinfos[conn[0]].name : "???", conn[0],
(mapinfos[conn[3]]) ? mapinfos[conn[3]].name : "???", conn[3]))
end
if conn[1].is_a?(String) || conn[4].is_a?(String)
f.write(sprintf("%d,%s,%d,%d,%s,%d", conn[0], conn[1], conn[2],
conn[3], conn[4], conn[5]))
conn[3], conn[4], conn[5]))
else
ret = normalize_connection(conn)
f.write(get_connection_text(ret[0], ret[1], ret[2], ret[3], ret[4], ret[5]))

View File

@@ -119,7 +119,8 @@ module Compiler
for i in 0...route.list.length
list.push(RPG::EventCommand.new(
(i == 0) ? 209 : 509, indent,
(i == 0) ? [character, route] : [route.list[i - 1]]))
(i == 0) ? [character, route] : [route.list[i - 1]]
))
end
end
@@ -582,8 +583,8 @@ module Compiler
push_branch(firstpage.list, battleString)
if battles.length > 1 # Has rematches
push_script(firstpage.list,
sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_self,%s,%d)",
regspeech, safetrcombo, battles.length), 1)
sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_self,%s,%d)",
regspeech, safetrcombo, battles.length), 1)
end
push_self_switch(firstpage.list, "A", true, 1)
push_branch_end(firstpage.list, 1)
@@ -640,8 +641,8 @@ module Compiler
push_text(lastpage.list, ebattle, 1)
end
push_script(lastpage.list,
sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_self,%s,%d)",
regspeech, safetrcombo, battles.length), 1)
sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_self,%s,%d)",
regspeech, safetrcombo, battles.length), 1)
push_exit(lastpage.list, 1) # Exit Event Processing
push_branch_end(lastpage.list, 1)
end
@@ -652,8 +653,8 @@ module Compiler
push_text(lastpage.list, ebattle)
if battles.length > 1
push_script(lastpage.list,
sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_self,%s,%d)",
regspeech, safetrcombo, battles.length))
sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_self,%s,%d)",
regspeech, safetrcombo, battles.length))
end
push_end(lastpage.list)
# Add pages to the new event
@@ -946,20 +947,20 @@ module Compiler
list.delete_at(i)
end
list.insert(i,
RPG::EventCommand.new(314, list[i].indent, [0]) # Recover All
)
RPG::EventCommand.new(314, list[i].indent, [0])) # Recover All
changed = true
when "pbFadeOutIn(99999){foriin$player.partyi.healend}"
oldIndent = list[i].indent
for j in i..lastScript
list.delete_at(i)
end
list.insert(i,
RPG::EventCommand.new(223, oldIndent, [Tone.new(-255, -255, -255), 6]), # Fade to black
RPG::EventCommand.new(106, oldIndent, [6]), # Wait
RPG::EventCommand.new(314, oldIndent, [0]), # Recover All
RPG::EventCommand.new(223, oldIndent, [Tone.new(0, 0, 0), 6]), # Fade to normal
RPG::EventCommand.new(106, oldIndent, [6]) # Wait
list.insert(
i,
RPG::EventCommand.new(223, oldIndent, [Tone.new(-255, -255, -255), 6]), # Fade to black
RPG::EventCommand.new(106, oldIndent, [6]), # Wait
RPG::EventCommand.new(314, oldIndent, [0]), # Recover All
RPG::EventCommand.new(223, oldIndent, [Tone.new(0, 0, 0), 6]), # Fade to normal
RPG::EventCommand.new(106, oldIndent, [6]) # Wait
)
changed = true
end
@@ -1175,12 +1176,13 @@ module Compiler
fullTransfer = list[i]
indent = list[i].indent
(list.length - 1).times { list.delete_at(0) }
list.insert(0,
RPG::EventCommand.new(250, indent, [RPG::AudioFile.new("Exit Door", 80, 100)]), # Play SE
RPG::EventCommand.new(223, indent, [Tone.new(-255, -255, -255), 6]), # Fade to black
RPG::EventCommand.new(106, indent, [8]), # Wait
fullTransfer, # Transfer event
RPG::EventCommand.new(223, indent, [Tone.new(0, 0, 0), 6]) # Fade to normal
list.insert(
0,
RPG::EventCommand.new(250, indent, [RPG::AudioFile.new("Exit Door", 80, 100)]), # Play SE
RPG::EventCommand.new(223, indent, [Tone.new(-255, -255, -255), 6]), # Fade to black
RPG::EventCommand.new(106, indent, [8]), # Wait
fullTransfer, # Transfer event
RPG::EventCommand.new(223, indent, [Tone.new(0, 0, 0), 6]) # Fade to normal
)
changed = true
end
@@ -1324,14 +1326,16 @@ module Compiler
end
if isempty
if elseIndex >= 0
list.insert(elseIndex + 1,
RPG::EventCommand.new(115, list[i].indent + 1, []) # Exit Event Processing
list.insert(
elseIndex + 1,
RPG::EventCommand.new(115, list[i].indent + 1, []) # Exit Event Processing
)
else
list.insert(i + 1,
RPG::EventCommand.new(0, list[i].indent + 1, []), # Empty Event
RPG::EventCommand.new(411, list[i].indent, []), # Else
RPG::EventCommand.new(115, list[i].indent + 1, []) # Exit Event Processing
list.insert(
i + 1,
RPG::EventCommand.new(0, list[i].indent + 1, []), # Empty Event
RPG::EventCommand.new(411, list[i].indent, []), # Else
RPG::EventCommand.new(115, list[i].indent + 1, []) # Exit Event Processing
)
end
changed = true