Update 6.8

This commit is contained in:
chardub
2026-07-10 15:42:06 -04:00
parent 5b85e72cb2
commit 6a6f126a18
7871 changed files with 493193 additions and 224825 deletions
@@ -33,7 +33,10 @@ module SwitchFinder
# Iterate over each map
mapinfos.each_key do |map_id|
map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
map_path = $RPGVX ? sprintf("Data/Map%03d.rvdata", map_id) : sprintf("Data/Map%03d.rxdata", map_id)
next unless File.exist?(map_path)
map = load_data(map_path)
mapinfo = mapinfos[map_id]
# Iterate over each event in the map
map.events.each_value do |event|
@@ -112,6 +115,69 @@ module SwitchFinder
echoln "#{unused_switches.length} unused switches found. Exported to unused_switches.txt."
end
def self.search_var_anyUse(variable_id)
results = []
mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
mapinfos.each_key do |map_id|
map_filename = sprintf("Data/Map%03d.rxdata", map_id)
next unless File.exist?(map_filename)
map = load_data(map_filename)
mapinfo = mapinfos[map_id]
map.events.each_value do |event|
event.pages.each_with_index do |page, page_index|
# Check page condition — variable condition uses variable_id and a value threshold
if page.condition.variable_valid && page.condition.variable_id == variable_id
results.push("Map #{map_id}: #{mapinfo.name}, Event #{event.id} (#{event.x},#{event.y}), Trigger for page #{page_index + 1} (variable condition)")
end
page.list.each_with_index do |command, command_index|
# Command 122: Control Variables
if command.code == 122
range_start = command.parameters[0]
range_end = command.parameters[1]
if range_start <= variable_id && variable_id <= range_end
results.push("Map #{map_id}: #{mapinfo.name}, Event #{event.id} (#{event.x},#{event.y}), Command #{command_index + 1}: Control Variables (write)")
end
# Command 111: Conditional Branch — can reference a variable
elsif command.code == 111
# parameters[0] == 1 means "variable comparison" condition type
if command.parameters[0] == 1 && command.parameters[1] == variable_id
results.push("Map #{map_id}: #{mapinfo.name}, Event #{event.id} (#{event.x},#{event.y}), Command #{command_index + 1}: Conditional Branch (variable check)")
end
# Commands 355/655: Script calls
elsif command.code == 355
script_text = command.parameters[0]
next_index = command_index + 1
while page.list[next_index]&.code == 655
script_text += page.list[next_index].parameters[0]
next_index += 1
end
if script_text.match?(/\$game_variables\[\s*#{variable_id}\s*\]/)
results.push("Map #{map_id}: #{mapinfo.name}, Event #{event.id} (#{event.x},#{event.y}), Command #{command_index + 1}: Script Manipulation")
end
end
end
end
end
end
output = "Variable #{variable_id} found:\n" + results.join("\n")
echoln output
return output
end
end
# Example usage: Replace 100 with the switch ID you want to search
@@ -189,3 +255,135 @@ def print_map_tiles
end
SWITCH_LITTLEROOT_FINISHED_MOVING = 2005
SWITCH_LITTLEROOT_TRUCK = 2001
SWITCH_LITTLEROOT_DAD_ON_TV = 2006
SWITCH_LITTLEROOT_MOM_INTRO_OVER = 2007
SWITCH_HOENN_RIVAL_APPEARANCE_SET = 1998
SWITCH_HOENN_MET_RIVAL = 2010
SWITCH_HOENN_CHOOSING_STARTER = 2013
SWITCH_HOENN_SAVED_BIRCH = 2011
SWITCH_NO_BUMP_SOUND = 108
SWITCH_HOENN_GO_SEE_RIVAL = 2012
SWITCH_HOENN_BEAT_RIVAL_INTRO = 2014
SWITCH_HOENN_INTRO_GOT_POKEDEX = 2017
MAP_ROUTE_101 = 5
MAP_LITTLEROOT = 9
MAP_LITTLEROOT_INTERIOR = 13
def hoenn_dev_quick_start
return false unless $DEBUG
choices = []
cmd_truck = "Intro (Normal)"
cmd_starter = "Starter Selection"
cmd_pokedex = "Pokédex obtained"
choices << cmd_truck
choices << cmd_starter
choices << cmd_pokedex
chosen = pbMessage("[Debug] Start where?",choices)
case choices[chosen]
when cmd_truck
return false
when cmd_starter
setHoennDefaultIntroSwitches
hoennCharacterSelection
setHoennSwitchesToStarter
pbFadeOutIn {
$game_temp.player_new_map_id = MAP_ROUTE_101
$game_temp.player_new_x = 19
$game_temp.player_new_y = 19
$game_temp.player_new_direction = DIRECTION_UP
$scene.transfer_player(true)
$game_map.autoplay
$game_map.refresh
}
when cmd_pokedex
setHoennDefaultIntroSwitches
hoennCharacterSelection
setHoennSwitchesToStarter
setHoennSwitchesFromStarterToPokedex
pbFadeOutIn {
$game_temp.player_new_map_id = MAP_LITTLEROOT
$game_temp.player_new_x = 16
$game_temp.player_new_y = 23
$game_temp.player_new_direction = DIRECTION_DOWN
$scene.transfer_player(true)
$game_map.autoplay
$game_map.refresh
}
end
return true
end
VAR_BATTLE_UI_STYLE = 199
def setHoennDefaultIntroSwitches
pbSet(VAR_BATTLE_UI_STYLE, 0)
$game_switches[SWITCH_GYM_RANDOM_EACH_BATTLE] = true
$game_switches[SWITCH_TIME_PAUSED] = true
$game_switches[SWITCH_NO_BUMP_SOUND]
$PokemonSystem.overworld_encounters= true
$PokemonGlobal.runningShoes=true
pbChangePlayer(0)
set_starting_options
pbShuffleItems
pbShuffleTMs
Kernel.initRandomTypeArray()
$game_switches[SWITCH_NEW_GAME_PLUS]= SaveData.exists?
end
def hoennCharacterSelection
menu = CharacterSelectionMenuView.new
menu.start
setupStartingOutfit()
end
def setHoennSwitchesToStarter
#Mom switches
pbSetSelfSwitch(7,"A",true,MAP_LITTLEROOT) #outside (male)
pbSetSelfSwitch(8,"A",true,MAP_LITTLEROOT) #outside (female)
pbSetSelfSwitch(25,"A",true,MAP_LITTLEROOT_INTERIOR) #inside (male)
pbSetSelfSwitch(39,"A",true,MAP_LITTLEROOT_INTERIOR) #inside (female)
pbSetSelfSwitch(37,"A",true,MAP_LITTLEROOT_INTERIOR) #inside upstairs (male)
pbSetSelfSwitch(38,"A",true,MAP_LITTLEROOT_INTERIOR) #inside upstairs (male)
pbSetSelfSwitch(46,"A",true,MAP_LITTLEROOT_INTERIOR) #inside 3 (male)
pbSetSelfSwitch(47,"A",true,MAP_LITTLEROOT_INTERIOR) #inside 3 (male)
$game_switches[SWITCH_LITTLEROOT_FINISHED_MOVING] = true
$game_switches[SWITCH_LITTLEROOT_TRUCK] = false
$game_switches[SWITCH_LITTLEROOT_DAD_ON_TV] = true
$game_switches[SWITCH_LITTLEROOT_MOM_INTRO_OVER] = true
#Rival
menu = CharacterSelectionMenuView.new
menu.start_rival
$game_switches[SWITCH_HOENN_RIVAL_APPEARANCE_SET] = true
$game_switches[SWITCH_HOENN_MET_RIVAL] = true
#Starter
$game_switches[SWITCH_HOENN_CHOOSING_STARTER] = true
end
def setHoennSwitchesFromStarterToPokedex
starter = hoennSelectStarter
pbAddPokemonSilent(starter,5)
pbSet(VAR_HOENN_STARTER,starter)
$game_switches[SWITCH_HOENN_SAVED_BIRCH] = true
$game_switches[SWITCH_HOENN_GO_SEE_RIVAL] = true
$game_switches[SWITCH_HOENN_BEAT_RIVAL_INTRO] = true
$PokemonGlobal.battledTrainers = {} if !$PokemonGlobal.battledTrainers
rival_trainer = initializeRivalBattledTrainer()
$PokemonGlobal.battledTrainers[BATTLED_TRAINER_RIVAL_KEY] = rival_trainer
$game_switches[SWITCH_TIME_PAUSED] = false
$game_switches[SWITCH_HOENN_INTRO_GOT_POKEDEX] = true
pbSetSelfSwitch(20,"A",true,MAP_ROUTE_101) #Rival route 101
pbSetSelfSwitch(21,"A",true,MAP_ROUTE_101) #Rival route 101
$Trainer.has_pokedex = true
pbUnlockDex
$PokemonBag.pbStoreItem(:POKEBALL,5)
end
@@ -3,7 +3,7 @@ def export_music_use_map()
for map_id in 1..796
mapInfos = load_data(sprintf("Data/Map%03d.rxdata", map_id))
bgm_name = mapInfos.bgm.name
map_name = Kernel.getMapName(map_id)
map_name = getMapName(map_id)
formatted_value = map_name + " [" + map_id.to_s + "]"
if music_hash.has_key?(bgm_name)
music_hash[bgm_name] << formatted_value
@@ -2,21 +2,25 @@
EXPORT_EXCEPT_MAP_IDS= [768,722,723,724,720,809,816]
def exportAllMaps
for id in 817..830
(1..800).each do |id|
next if EXPORT_EXCEPT_MAP_IDS.include?(id)
next if !pbRgssExists?("Data/Map%03d.rxdata" % id)
begin
MapExporter.export(id, [:Events]) if !EXPORT_EXCEPT_MAP_IDS.include?(id)
rescue
echo "error in " +(id.to_s) +"\n"
MapExporter.export(id, [:Events])
rescue => e
echo "error in #{id}: #{e.message}\n"
end
end
end
def exportSpecificMaps(maps_to_export)
for id in maps_to_export
maps_to_export.each do |id|
next if !pbRgssExists?("Data/Map%03d.rxdata" % id)
begin
MapExporter.export(id, [:Events])
rescue
echo "error in " +(id.to_s) +"\n"
rescue => e
echo "error in #{id}: #{e.message}\n"
next
end
end
end
@@ -34,7 +38,7 @@ module MapExporter
begin
@@map = $MapFactory.getMapForExport(map_id)
rescue
error("Map #{map_id} (#{map_name}) could not be loaded.")
echoln "Map #{map_id} (#{map_name}) could not be loaded."
end
@@bitmap = Bitmap.new(@@map.width * Game_Map::TILE_HEIGHT, @@map.height * Game_Map::TILE_WIDTH)
@@helper = TileDrawingHelper.fromTileset($data_tilesets[@@map.tileset_id])
@@ -46,8 +50,8 @@ module MapExporter
echoln "Map #{map_id} (#{map_name}) doesn't have a Panorama."
end
end
draw_reflective_tiles
draw_all_reflections(options)
#draw_reflective_tiles
#draw_all_reflections(options)
draw_regular_tiles
if !draw_all_events(options)
draw_low_priority_tiles
@@ -95,7 +99,7 @@ module MapExporter
next if priority == nil
next if priority != 1
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
next if !tag_data || tag_data.shows_reflections
next if !tag_data || tile_id == TilemapRenderer::INVISIBLE_WALL_TILE_ID #|| tag_data.shows_reflections
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
end
end
@@ -146,7 +150,7 @@ module MapExporter
break
end
end
draw_event_reflection(event, dep) if event
# draw_event_reflection(event, dep) if event
end
end
return true
@@ -158,7 +162,7 @@ module MapExporter
for z in 0..2
tile_id = @@map.data[x, y, z] || 0
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
next if !tag_data || !tag_data.shows_reflections
next if !tag_data || tile_id == TilemapRenderer::INVISIBLE_WALL_TILE_ID#|| !tag_data.shows_reflections
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
end
end
@@ -174,7 +178,7 @@ module MapExporter
next if priority == nil
next if priority >= 1
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
next if !tag_data || tag_data.shows_reflections
next if !tag_data || tile_id == TilemapRenderer::INVISIBLE_WALL_TILE_ID#|| tag_data.shows_reflections
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
end
end
@@ -189,7 +193,7 @@ module MapExporter
priority = @@map.priorities[tile_id]
next unless priority == 1
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
next if !tag_data || tag_data.shows_reflections
next if !tag_data || tile_id == TilemapRenderer::INVISIBLE_WALL_TILE_ID#|| tag_data.shows_reflections
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
end
end
@@ -205,7 +209,7 @@ module MapExporter
next if priority == nil
next if priority < 2
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
next if !tag_data || tag_data.shows_reflections
next if !tag_data || tile_id == TilemapRenderer::INVISIBLE_WALL_TILE_ID#|| tag_data.shows_reflections
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
end
end
@@ -293,13 +297,13 @@ module MapExporter
fixed = false
if event == $game_player || forced
height = $PokemonGlobal.bridge
elsif event.name[/reflection/i]
height = 0
if event.name[/reflection\((\d+)\)/i]
height = $~[1].to_i || 0
else
height = $PokemonGlobal.bridge
end
# elsif event.name[/reflection/i]
# height = 0
# if event.name[/reflection\((\d+)\)/i]
# height = $~[1].to_i || 0
# else
# height = $PokemonGlobal.bridge
# end
end
if height
final_x = (event.x * Game_Map::TILE_WIDTH) + ((event.width * Game_Map::TILE_WIDTH)/2) - bmp.width/8
@@ -506,8 +510,7 @@ module MapExporter
def error(message)
emessage = "Map Exporter EX Error:\n\n" + message
print(_INTL(emessage))
exit!
echoln emessage
end
end