Merge branch 'master' into mkxp-z

This commit is contained in:
Maruno17
2020-11-09 19:26:44 +00:00
79 changed files with 3367 additions and 3235 deletions

View File

@@ -208,6 +208,8 @@ def pbDebugMenuCommands(showall=true)
_INTL("Fully compile all data."))
commands.add("othermenu","debugconsole",_INTL("Debug Console"),
_INTL("Open the Debug Console."))
commands.add("othermenu","invalidtiles",_INTL("Fix Invalid Tiles"),
_INTL("Scans all maps and erases non-existent tiles."))
return commands
end
@@ -348,7 +350,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
params.setCancelValue(0)
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",PBSpecies.getName(species)),params)
if level>0
pkmn.push(pbNewPkmn(species,level))
pkmn.push(pbGenerateWildPokemon(species,level))
end
end
else # Edit a Pokémon
@@ -366,7 +368,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
battle = pbListScreen(_INTL("SINGLE TRAINER"),TrainerBattleLister.new(0,false))
if battle
trainerdata = battle[1]
pbTrainerBattle(trainerdata[0],trainerdata[1],"...",false,trainerdata[4],true)
pbTrainerBattle(trainerdata[0],trainerdata[1],nil,false,trainerdata[4],true)
end
when "testtrainerbattleadvanced"
trainers = []
@@ -795,6 +797,8 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
pbDisposeMessageWindow(msgwindow)
when "debugconsole"
Console::setup_console
when "invalidtiles"
pbDebugFixInvalidTiles
end
return false
end

View File

@@ -82,9 +82,16 @@ class SpriteWindow_DebugVariables < Window_DrawableCommand
name = $data_system.switches[index+1]
codeswitch = (name[/^s\:/])
val = (codeswitch) ? (eval($~.post_match) rescue nil) : $game_switches[index+1]
if val==nil; status = "[-]"; colors = 0; codeswitch = true
elsif val; status = "[ON]"; colors = 2
else; status = "[OFF]"; colors = 1
if val==nil
status = "[-]"
colors = 0
codeswitch = true
elsif val
status = "[ON]"
colors = 2
else
status = "[OFF]"
colors = 1
end
else
name = $data_system.variables[index+1]
@@ -791,6 +798,76 @@ def pbImportAllAnimations
end
end
#===============================================================================
# Properly erases all non-existent tiles in maps (including event graphics)
#===============================================================================
def pbDebugFixInvalidTiles
num_errors = 0
num_error_maps = 0
@tilesets = pbLoadRxData("Data/Tilesets")
mapData = MapData.new
t = Time.now.to_i
Graphics.update
for id in mapData.mapinfos.keys.sort
if Time.now.to_i - t >= 5
Graphics.update
t = Time.now.to_i
end
changed = false
map = mapData.getMap(id)
next if !map || !mapData.mapinfos[id]
Win32API.SetWindowText(_INTL("Processing map {1} ({2})", id, mapData.mapinfos[id].name))
passages = mapData.getTilesetPassages(map, id)
# Check all tiles in map for non-existent tiles
for x in 0...map.data.xsize
for y in 0...map.data.ysize
for i in 0...map.data.zsize
tile_id = map.data[x, y, i]
next if pbCheckTileValidity(tile_id, map, @tilesets, passages)
map.data[x, y, i] = 0
changed = true
num_errors += 1
end
end
end
# Check all events in map for page graphics using a non-existent tile
for key in map.events.keys
event = map.events[key]
for page in event.pages
next if page.graphic.tile_id <= 0
next if pbCheckTileValidity(page.graphic.tile_id, map, @tilesets, passages)
page.graphic.tile_id = 0
changed = true
num_errors += 1
end
end
next if !changed
# Map was changed; save it
num_error_maps += 1
mapData.saveMap(id)
end
if num_error_maps == 0
pbMessage(_INTL("No invalid tiles were found."))
else
pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", num_errors, num_error_maps))
pbMessage(_INTL("Close RPG Maker XP to ensure the changes are applied properly."))
end
end
def pbCheckTileValidity(tile_id, map, tilesets, passages)
return false if !tile_id
if tile_id > 0 && tile_id < 384
# Check for defined autotile
autotile_id = tile_id / 48 - 1
autotile_name = tilesets[map.tileset_id].autotile_names[autotile_id]
return true if autotile_name && autotile_name != ""
else
# Check for tileset data
return true if passages[tile_id]
end
return false
end
#===============================================================================

View File

@@ -669,13 +669,6 @@ def pbItemEditorNew(defaultname)
itemdata = pbLoadItemsData
# Get the first blank ID for the new item to use.
maxid = PBItems.maxValue+1
for i in 1..PBItems.maxValue
name = itemdata[i][1]
if !name || name=="" || itemdata[i][ITEM_POCKET]==0
maxid = i
break
end
end
index = maxid
itemname = pbMessageFreeText(_INTL("Please enter the item's name."),
(defaultname) ? defaultname.gsub(/_+/," ") : "",false,30)

View File

@@ -550,7 +550,7 @@ def pbSaveTownMap
f.write("\r\n")
for i in 0...mapdata.length
map = mapdata[i]
return if !map
next if !map
f.write("\#-------------------------------\r\n")
f.write(sprintf("[%d]\r\n",i))
rname = pbGetMessage(MessageTypes::RegionNames,i)
@@ -839,11 +839,14 @@ def pbSavePokemonData
pokedata.write(",") if count>0
pokedata.write(sprintf("%s,%s,",cnew_species,evoname))
param_type = PBEvolution.getFunction(method, "parameterType")
if param_type
cparameter = getConstantName(param_type,parameter) rescue ""
pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
has_param = !PBEvolution.hasFunction?(method, "parameterType") || param_type != nil
if has_param
if param_type
cparameter = (getConstantName(param_type, parameter) rescue parameter)
pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
end
end
count += 1
end
@@ -1299,11 +1302,14 @@ def pbSavePokemonFormsData
next if !cnew_species || cnew_species==""
pokedata.write(sprintf("%s,%s,",cnew_species,evoname))
param_type = PBEvolution.getFunction(method, "parameterType")
if param_type
cparameter = getConstantName(param_type,parameter) rescue ""
pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
has_param = !PBEvolution.hasFunction?(method, "parameterType") || param_type != nil
if has_param
if param_type
cparameter = (getConstantName(param_type, parameter) rescue parameter)
pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
end
end
pokedata.write(",") if k<evos.length-1
end

View File

@@ -407,6 +407,7 @@ class ItemLister
@itemdata = pbLoadItemsData
cmds = []
for i in 1..PBItems.maxValue
next if !@itemdata[i]
name = @itemdata[i][ITEM_NAME]
if name && name!="" && @itemdata[i][ITEM_POCKET]!=0
cmds.push([i,name])

View File

@@ -3093,8 +3093,8 @@ class PointPath
return ret
end
step=1.0/frames
t=0.0;
for i in 0..frames+1
t=0.0
(frames+2).times do
point=pointOnPath(t)
if roundValues
ret.addPoint(point[0].round,point[1].round)