mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Rewrote Town Map screen
This commit is contained in:
@@ -186,30 +186,58 @@ module Settings
|
||||
66 => [5, 21, 28, 31, 39, 41, 44, 47, 69],
|
||||
69 => [5, 21, 28, 31, 39, 41, 44, 47, 66 ]
|
||||
}
|
||||
# A set of arrays, each containing the details of a roaming Pokémon. The
|
||||
# information within each array is as follows:
|
||||
# * Species.
|
||||
# * Level.
|
||||
# * Game Switch; the Pokémon roams while this is ON.
|
||||
# * Encounter type (see def pbRoamingMethodAllowed for their use):
|
||||
# 0 = grass, walking in cave, surfing
|
||||
# 1 = grass, walking in cave
|
||||
# 2 = surfing
|
||||
# 3 = fishing
|
||||
# 4 = surfing, fishing
|
||||
# * Name of BGM to play for that encounter (optional).
|
||||
# * Roaming areas specifically for this Pokémon (optional; used instead of
|
||||
# ROAMING_AREAS).
|
||||
# A set of hashes, each containing the details of a roaming Pokémon. The
|
||||
# information within each hash is as follows:
|
||||
# * :species
|
||||
# * :level
|
||||
# * :icon - Filename in Graphics/UI/Town Map/ of the roamer's Town Map icon.
|
||||
# * :game_switch - The Pokémon roams if this is nil or <=0 or if that Game
|
||||
# Switch is ON. Optional.
|
||||
# * :encounter_type - One of:
|
||||
# :all = grass, walking in cave, surfing (default)
|
||||
# :land = grass, walking in cave
|
||||
# :water = surfing, fishing
|
||||
# :surfing = surfing
|
||||
# :fishing = fishing
|
||||
# * :bgm - The BGM to play for the encounter. Optional.
|
||||
# * :areas - A hash of map IDs that determine where this Pokémon roams. Used
|
||||
# instead of ROAMING_AREAS above. Optional.
|
||||
ROAMING_SPECIES = [
|
||||
[:LATIAS, 30, 53, 0, "Battle roaming"],
|
||||
[:LATIOS, 30, 53, 0, "Battle roaming"],
|
||||
[:KYOGRE, 40, 54, 2, nil, {
|
||||
{
|
||||
:species => :LATIAS,
|
||||
:level => 30,
|
||||
:icon => "pin_latias",
|
||||
:game_switch => 53,
|
||||
:encounter_type => :all,
|
||||
:bgm => "Battle roaming"
|
||||
},
|
||||
{
|
||||
:species => :LATIOS,
|
||||
:level => 30,
|
||||
:icon => "pin_latios",
|
||||
:game_switch => 53,
|
||||
:encounter_type => :all,
|
||||
:bgm => "Battle roaming"
|
||||
},
|
||||
{
|
||||
:species => :KYOGRE,
|
||||
:level => 40,
|
||||
:game_switch => 54,
|
||||
:encounter_type => :surfing,
|
||||
:areas => {
|
||||
2 => [ 21, 31 ],
|
||||
21 => [2, 31, 69],
|
||||
31 => [2, 21, 69],
|
||||
69 => [ 21, 31 ]
|
||||
}],
|
||||
[:ENTEI, 40, 55, 1]
|
||||
}
|
||||
},
|
||||
{
|
||||
:species => :ENTEI,
|
||||
:level => 40,
|
||||
:icon => "pin_entei",
|
||||
:game_switch => 55,
|
||||
:encounter_type => :land
|
||||
}
|
||||
]
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -44,6 +44,13 @@ module Settings
|
||||
# by the Pokémon that knows it.
|
||||
SHOW_MODIFIED_MOVE_PROPERTIES = false
|
||||
|
||||
# Whether pressing Use in the Town Map will zoom it in to 200% and show a text
|
||||
# pane on the right showing the selected point's description. The cursor can
|
||||
# still be moved while zoomed in.
|
||||
ENABLE_TOWN_MAP_ZOOM_IN_FOR_DETAILS = true
|
||||
# Whether points in the Town Map can be marked.
|
||||
ENABLE_TOWN_MAP_MARKING = true
|
||||
|
||||
# TODO: Allow renaming a Pokémon from the party screen/summary screen (not
|
||||
# sure which). Gen 9 feature.
|
||||
# TODO: Allow forgetting/remembering moves from the summary screen. Gen 9
|
||||
|
||||
@@ -6,7 +6,10 @@ module GameData
|
||||
attr_reader :id
|
||||
attr_reader :real_name
|
||||
attr_reader :filename
|
||||
attr_reader :point
|
||||
attr_reader :margins
|
||||
attr_reader :point_size
|
||||
attr_reader :size
|
||||
attr_reader :points
|
||||
attr_reader :flags
|
||||
attr_reader :pbs_file_suffix
|
||||
|
||||
@@ -17,20 +20,40 @@ module GameData
|
||||
"SectionName" => [:id, "u"],
|
||||
"Name" => [:real_name, "s"],
|
||||
"Filename" => [:filename, "s"],
|
||||
"Point" => [:point, "^uusSUUUU"],
|
||||
"Margins" => [:margins, "uu"], # Left/right and top/bottom padding in pixels
|
||||
"PointSize" => [:point_size, "vv"], # Size of a point in pixels
|
||||
"Size" => [:size, "vv"], # Width and height in points
|
||||
"Point" => [:points, "^uusSUUUU"],
|
||||
"Flags" => [:flags, "*s"]
|
||||
}
|
||||
# This schema is for definable properties of individual points (apart from
|
||||
# position and name which are above).
|
||||
SUB_SCHEMA = {
|
||||
"Image" => [:image, "s"],
|
||||
"Description" => [:real_description, "q"],
|
||||
"FlySpot" => [:fly_spot, "vuu"], # Map ID, x coord, y coord
|
||||
"HideFlyIcon" => [:hide_fly_icon, "b"],
|
||||
"FlyIconOffset" => [:fly_icon_offset, "ii"], # x and y offsets in pixels
|
||||
"Switch" => [:switch, "v"] # Game Switch ID
|
||||
}
|
||||
|
||||
extend ClassMethodsIDNumbers
|
||||
include InstanceMethods
|
||||
|
||||
def self.sub_schema
|
||||
return SUB_SCHEMA
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "???"
|
||||
@filename = hash[:filename]
|
||||
@point = hash[:point] || []
|
||||
@margins = hash[:margins] || [0, 0]
|
||||
@point_size = hash[:point_size] || [16, 16]
|
||||
@size = hash[:size] || [30, 20]
|
||||
@points = hash[:points] || []
|
||||
@flags = hash[:flags] || []
|
||||
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
|
||||
end
|
||||
@@ -43,5 +66,18 @@ module GameData
|
||||
def has_flag?(flag)
|
||||
return @flags.any? { |f| f.downcase == flag.downcase }
|
||||
end
|
||||
|
||||
def get_point_property_for_PBS(key, index = 0)
|
||||
return [*@points[index][:position], @points[index][:real_name]] if key == "Point"
|
||||
ret = @points[index][SUB_SCHEMA[key][0]]
|
||||
ret = nil if ret == false || (ret.is_a?(Array) && ret.length == 0) || ret == ""
|
||||
case key
|
||||
when "Margins"
|
||||
ret = nil if ret == [0, 0]
|
||||
when "FlySpot"
|
||||
ret = nil if ret && ret.compact.empty?
|
||||
end
|
||||
return ret
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,6 +17,15 @@ end
|
||||
#===============================================================================
|
||||
# Making roaming Pokémon roam around.
|
||||
#===============================================================================
|
||||
def each_active_roamer(ignore_caught = true)
|
||||
Settings::ROAMING_SPECIES.each_with_index do |roamer, i|
|
||||
next if !GameData::Species.exists?(roamer[:species])
|
||||
next if roamer[:game_switch] && roamer[:game_switch] > 0 && !$game_switches[roamer[:game_switch]]
|
||||
next if ignore_caught && $PokemonGlobal.roamPokemon[i] == true # Has been caught
|
||||
yield roamer, i
|
||||
end
|
||||
end
|
||||
|
||||
# Resets all roaming Pokemon that were defeated without having been caught.
|
||||
def pbResetAllRoamers
|
||||
return if !$PokemonGlobal.roamPokemon
|
||||
@@ -30,7 +39,7 @@ end
|
||||
def pbRoamingAreas(idxRoamer)
|
||||
# [species ID, level, Game Switch, encounter type, battle BGM, area maps hash]
|
||||
roamData = Settings::ROAMING_SPECIES[idxRoamer]
|
||||
return roamData[5] if roamData && roamData[5]
|
||||
return roamData[:areas] if roamData && roamData[:areas]
|
||||
return Settings::ROAMING_AREAS
|
||||
end
|
||||
|
||||
@@ -47,8 +56,8 @@ def pbRoamPokemon
|
||||
# Start all roamers off in random maps
|
||||
if !$PokemonGlobal.roamPosition
|
||||
$PokemonGlobal.roamPosition = {}
|
||||
Settings::ROAMING_SPECIES.length.times do |i|
|
||||
next if !GameData::Species.exists?(Settings::ROAMING_SPECIES[i][0])
|
||||
Settings::ROAMING_SPECIES.each_with_index do |roamer, i|
|
||||
next if !GameData::Species.exists?(roamer[:species])
|
||||
keys = pbRoamingAreas(i).keys
|
||||
$PokemonGlobal.roamPosition[i] = keys[rand(keys.length)]
|
||||
end
|
||||
@@ -62,10 +71,9 @@ end
|
||||
# Makes a single roaming Pokémon roam to another map. Doesn't roam if it isn't
|
||||
# currently possible to encounter it (i.e. its Game Switch is off).
|
||||
def pbRoamPokemonOne(idxRoamer)
|
||||
# [species ID, level, Game Switch, encounter type, battle BGM, area maps hash]
|
||||
roamData = Settings::ROAMING_SPECIES[idxRoamer]
|
||||
return if roamData[2] > 0 && !$game_switches[roamData[2]] # Game Switch is off
|
||||
return if !GameData::Species.exists?(roamData[0])
|
||||
roamer = Settings::ROAMING_SPECIES[idxRoamer]
|
||||
return if !GameData::Species.exists?(roamer[:species])
|
||||
return if roamer[:game_switch] && roamer[:game_switch] > 0 && !$game_switches[roamer[:game_switch]]
|
||||
# Get hash of area patrolled by the roaming Pokémon
|
||||
mapIDs = pbRoamingAreas(idxRoamer).keys
|
||||
return if !mapIDs || mapIDs.length == 0 # No roaming area defined somehow
|
||||
@@ -81,10 +89,10 @@ def pbRoamPokemonOne(idxRoamer)
|
||||
return if !nextMaps
|
||||
nextMaps.each { |map| newMapChoices.push(map) }
|
||||
# Rarely, add a random possible map into the mix
|
||||
newMapChoices.push(mapIDs[rand(mapIDs.length)]) if rand(32) == 0
|
||||
newMapChoices.push(mapIDs.sample) if rand(32) == 0
|
||||
# Choose a random new map to roam to
|
||||
if newMapChoices.length > 0
|
||||
$PokemonGlobal.roamPosition[idxRoamer] = newMapChoices[rand(newMapChoices.length)]
|
||||
$PokemonGlobal.roamPosition[idxRoamer] = newMapChoices.sample
|
||||
end
|
||||
end
|
||||
|
||||
@@ -118,16 +126,16 @@ def pbRoamingMethodAllowed(roamer_method)
|
||||
enc_type = $PokemonEncounters.encounter_type
|
||||
type = GameData::EncounterType.get(enc_type).type
|
||||
case roamer_method
|
||||
when 0 # Any step-triggered method (except Bug Contest)
|
||||
when :all # Any step-triggered method (except Bug Contest)
|
||||
return [:land, :cave, :water].include?(type)
|
||||
when 1 # Walking (except Bug Contest)
|
||||
when :land # Walking (except Bug Contest)
|
||||
return [:land, :cave].include?(type)
|
||||
when 2 # Surfing
|
||||
return type == :water
|
||||
when 3 # Fishing
|
||||
return type == :fishing
|
||||
when 4 # Water-based
|
||||
when :water # Surfing or rishing
|
||||
return [:water, :fishing].include?(type)
|
||||
when :surfing # Surfing
|
||||
return type == :water
|
||||
when :fishing # Fishing
|
||||
return type == :fishing
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -146,11 +154,7 @@ EventHandlers.add(:on_wild_species_chosen, :roaming_pokemon,
|
||||
currentRegion = pbGetCurrentRegion
|
||||
currentMapName = $game_map.name
|
||||
possible_roamers = []
|
||||
Settings::ROAMING_SPECIES.each_with_index do |data, i|
|
||||
# data = [species, level, Game Switch, roamer method, battle BGM, area maps hash]
|
||||
next if !GameData::Species.exists?(data[0])
|
||||
next if data[2] > 0 && !$game_switches[data[2]] # Isn't roaming
|
||||
next if $PokemonGlobal.roamPokemon[i] == true # Roaming Pokémon has been caught
|
||||
each_active_roamer do |roamer, i|
|
||||
# Get the roamer's current map
|
||||
roamerMap = $PokemonGlobal.roamPosition[i]
|
||||
if !roamerMap
|
||||
@@ -168,9 +172,9 @@ EventHandlers.add(:on_wild_species_chosen, :roaming_pokemon,
|
||||
next if pbGetMapNameFromId(roamerMap) != currentMapName
|
||||
end
|
||||
# Check whether the roamer's roamer method is currently possible
|
||||
next if !pbRoamingMethodAllowed(data[3])
|
||||
next if !pbRoamingMethodAllowed(roamer[:encounter_type])
|
||||
# Add this roaming Pokémon to the list of possible roaming Pokémon to encounter
|
||||
possible_roamers.push([i, data[0], data[1], data[4]]) # [i, species, level, BGM]
|
||||
possible_roamers.push([i, roamer[:species], roamer[:level], roamer[:bgm]])
|
||||
end
|
||||
# No encounterable roaming Pokémon were found, just have the regular encounter
|
||||
next if possible_roamers.length == 0
|
||||
|
||||
@@ -23,6 +23,8 @@ class PokemonGlobalMetadata
|
||||
attr_accessor :pokedexDex # Dex currently looking at (-1 is National Dex)
|
||||
attr_accessor :pokedexIndex # Last species viewed per Dex
|
||||
attr_accessor :pokedexMode # Search mode
|
||||
# Town Map
|
||||
attr_accessor :townMapMarkings
|
||||
# Day Care
|
||||
attr_accessor :day_care
|
||||
# Special battle modes
|
||||
@@ -78,6 +80,8 @@ class PokemonGlobalMetadata
|
||||
(numRegions + 1).times do |i| # National Dex isn't a region, but is included
|
||||
@pokedexIndex[i] = 0
|
||||
end
|
||||
# Town Map
|
||||
@townMapMarkings = []
|
||||
# Day Care
|
||||
@day_care = DayCare.new
|
||||
# Special battle modes
|
||||
|
||||
@@ -313,11 +313,10 @@ ItemHandlers::UseInField.copy(:ITEMFINDER, :DOWSINGMCHN, :DOWSINGMACHINE)
|
||||
|
||||
ItemHandlers::UseFromBag.add(:TOWNMAP, proc { |item, bag_screen|
|
||||
pbFadeOutInWithUpdate(bag_screen&.sprites) do
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
if ret
|
||||
$game_temp.fly_destination = ret
|
||||
town_map_screen = UI::TownMap.new
|
||||
town_map_screen.main
|
||||
if town_map_screen.result
|
||||
$game_temp.fly_destination = town_map_screen.result
|
||||
bag_screen&.silent_end_screen
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPokedexInfo_Scene
|
||||
LEFT = 0
|
||||
TOP = 0
|
||||
RIGHT = 29
|
||||
BOTTOM = 19
|
||||
SQUARE_WIDTH = 16
|
||||
SQUARE_HEIGHT = 16
|
||||
|
||||
def pbStartScene(dexlist, index, region)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@@ -31,8 +38,8 @@ class PokemonPokedexInfo_Scene
|
||||
pbDrawImagePositions(
|
||||
@sprites["areamap"].bitmap,
|
||||
[["Graphics/UI/Town Map/#{hidden[4]}",
|
||||
hidden[2] * PokemonRegionMap_Scene::SQUARE_WIDTH,
|
||||
hidden[3] * PokemonRegionMap_Scene::SQUARE_HEIGHT]]
|
||||
hidden[2] * SQUARE_WIDTH,
|
||||
hidden[3] * SQUARE_HEIGHT]]
|
||||
)
|
||||
end
|
||||
@sprites["areahighlight"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@@ -315,12 +322,12 @@ class PokemonPokedexInfo_Scene
|
||||
# defined point in town_map.txt, and which either have no Self Switch
|
||||
# controlling their visibility or whose Self Switch is ON)
|
||||
visible_points = []
|
||||
@mapdata.point.each do |loc|
|
||||
next if loc[7] && !$game_switches[loc[7]] # Point is not visible
|
||||
visible_points.push([loc[0], loc[1]])
|
||||
@mapdata.points.each do |loc|
|
||||
next if loc[:switch] && !$game_switches[loc[:switch]] # Point is not visible
|
||||
visible_points.push(loc[:position])
|
||||
end
|
||||
# Find all points with a visible area for @species
|
||||
town_map_width = 1 + PokemonRegionMap_Scene::RIGHT - PokemonRegionMap_Scene::LEFT
|
||||
town_map_width = 1 + RIGHT - LEFT
|
||||
ret = []
|
||||
GameData::Encounter.each_of_version($PokemonGlobal.encounter_version) do |enc_data|
|
||||
next if !pbFindEncounter(enc_data.types, @species) # Species isn't in encounter table
|
||||
@@ -362,9 +369,9 @@ class PokemonPokedexInfo_Scene
|
||||
# Draw coloured squares on each point of the Town Map with a nest
|
||||
pointcolor = Color.new(0, 248, 248)
|
||||
pointcolorhl = Color.new(192, 248, 248)
|
||||
town_map_width = 1 + PokemonRegionMap_Scene::RIGHT - PokemonRegionMap_Scene::LEFT
|
||||
sqwidth = PokemonRegionMap_Scene::SQUARE_WIDTH
|
||||
sqheight = PokemonRegionMap_Scene::SQUARE_HEIGHT
|
||||
town_map_width = 1 + RIGHT - LEFT
|
||||
sqwidth = SQUARE_WIDTH
|
||||
sqheight = SQUARE_HEIGHT
|
||||
points.length.times do |j|
|
||||
next if !points[j]
|
||||
x = (j % town_map_width) * sqwidth
|
||||
|
||||
@@ -164,11 +164,10 @@ MenuHandlers.add(:pokegear_menu, :map, {
|
||||
"order" => 10,
|
||||
"effect" => proc { |menu|
|
||||
pbFadeOutIn do
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
if ret
|
||||
$game_temp.fly_destination = ret
|
||||
town_map_screen = UI::TownMap.new
|
||||
town_map_screen.main
|
||||
if town_map_screen.result
|
||||
$game_temp.fly_destination = town_map_screen.result
|
||||
menu.dispose
|
||||
next 99999
|
||||
end
|
||||
|
||||
@@ -263,9 +263,9 @@ class PokemonReadyMenu
|
||||
ret = nil
|
||||
pbFadeOutInWithUpdate(@scene.sprites) do
|
||||
pbHideMenu
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartFlyScreen
|
||||
town_map_screen = UI::TownMap.new(mode: :fly)
|
||||
town_map_screen.main
|
||||
ret = town_map_screen.result
|
||||
pbShowMenu if !ret
|
||||
end
|
||||
if ret
|
||||
|
||||
@@ -307,6 +307,7 @@ module UI
|
||||
#=============================================================================
|
||||
class BaseVisuals
|
||||
attr_reader :sprites
|
||||
attr_reader :mode
|
||||
|
||||
BACKGROUND_FILENAME = "bg"
|
||||
|
||||
@@ -709,6 +710,7 @@ module UI
|
||||
#=============================================================================
|
||||
class BaseScreen
|
||||
attr_reader :visuals
|
||||
attr_reader :mode
|
||||
attr_accessor :result
|
||||
|
||||
def initialize
|
||||
|
||||
@@ -256,9 +256,9 @@ MenuHandlers.add(:pause_menu, :town_map, {
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn do
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
town_map_screen = UI::TownMap.new
|
||||
town_map_screen.main
|
||||
ret = town_map_screen.result
|
||||
$game_temp.fly_destination = ret if ret
|
||||
($game_temp.fly_destination) ? menu.silent_end_screen : menu.refresh
|
||||
end
|
||||
|
||||
@@ -738,7 +738,7 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::Party < UI::BaseScreen
|
||||
attr_reader :party, :mode
|
||||
attr_reader :party
|
||||
|
||||
SCREEN_ID = :party_screen
|
||||
|
||||
@@ -930,13 +930,12 @@ class UI::Party < UI::BaseScreen
|
||||
if pbCanUseHiddenMove?(pkmn, move_id) && pbConfirmUseHiddenMove(pkmn, move_id)
|
||||
if move_id == :FLY
|
||||
pbFadeOutInWithUpdate(sprites) do
|
||||
town_map_scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
town_map_screen = PokemonRegionMapScreen.new(town_map_scene)
|
||||
ret = town_map_screen.pbStartFlyScreen
|
||||
if ret
|
||||
town_map_screen = UI::TownMap.new(mode: :fly)
|
||||
town_map_screen.main
|
||||
if town_map_screen.result
|
||||
$game_temp.field_move_to_use = move_id
|
||||
$game_temp.field_move_user = pkmn
|
||||
$game_temp.fly_destination = ret
|
||||
$game_temp.fly_destination = town_map_screen.result
|
||||
silent_end_screen
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1372,7 +1372,7 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::PokemonSummary < UI::BaseScreen
|
||||
attr_reader :party, :mode
|
||||
attr_reader :party
|
||||
attr_accessor :party_index, :pokemon
|
||||
|
||||
SCREEN_ID = :summary_screen
|
||||
|
||||
1078
Data/Scripts/016b_UI redesign/009_UI_TownMap.rb
Normal file
1078
Data/Scripts/016b_UI redesign/009_UI_TownMap.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1604,7 +1604,7 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::PokemonStorage < UI::BaseScreen
|
||||
attr_reader :storage, :mode
|
||||
attr_reader :storage
|
||||
|
||||
SCREEN_ID = :pokemon_storage_screen
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class UI::MoveReminder < UI::BaseScreen
|
||||
attr_reader :pokemon, :mode
|
||||
attr_reader :pokemon
|
||||
|
||||
SCREEN_ID = :move_reminder_screen
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
=begin
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -356,3 +357,4 @@ def pbShowMap(region = -1, wallmap = true)
|
||||
$game_temp.fly_destination = ret if ret && !wallmap
|
||||
end
|
||||
end
|
||||
=end
|
||||
@@ -448,10 +448,10 @@ class SpriteWindow_DebugRoamers < Window_DrawableCommand
|
||||
self.shadowtext(_INTL("[Clear all current roamer locations]"), rect.x, rect.y, nameWidth, rect.height)
|
||||
else
|
||||
pkmn = Settings::ROAMING_SPECIES[index]
|
||||
name = GameData::Species.get(pkmn[0]).name + " (Lv. #{pkmn[1]})"
|
||||
name = GameData::Species.get(pkmn[:species]).name + " (Lv. #{pkmn[:level]})"
|
||||
status = ""
|
||||
statuscolor = 0
|
||||
if pkmn[2] <= 0 || $game_switches[pkmn[2]]
|
||||
if !pkmn[:game_switch] || pkmn[:game_switch] <= 0 || $game_switches[pkmn[:game_switch]]
|
||||
status = $PokemonGlobal.roamPokemon[index]
|
||||
if status == true
|
||||
if $PokemonGlobal.roamPokemonCaught[index]
|
||||
@@ -472,7 +472,7 @@ class SpriteWindow_DebugRoamers < Window_DrawableCommand
|
||||
statuscolor = 2
|
||||
end
|
||||
else
|
||||
status = "[NOT ROAMING][Switch #{pkmn[2]} is off]"
|
||||
status = "[NOT ROAMING][Switch #{pkmn[:game_switch]} is off]"
|
||||
end
|
||||
self.shadowtext(name, rect.x, rect.y, nameWidth, rect.height)
|
||||
self.shadowtext(status, rect.x + nameWidth, rect.y, statusWidth, rect.height, 1, statuscolor)
|
||||
@@ -500,7 +500,7 @@ def pbDebugRoamers
|
||||
pkmn = nil
|
||||
end
|
||||
if Input.trigger?(Input::ACTION) && cmdwindow.index < cmdwindow.roamerCount &&
|
||||
(pkmn[2] <= 0 || $game_switches[pkmn[2]]) &&
|
||||
(!pkmn[:game_switch] || pkmn[:game_switch] <= 0 || $game_switches[pkmn[:game_switch]]) &&
|
||||
$PokemonGlobal.roamPokemon[cmdwindow.index] != true
|
||||
# Roam selected Pokémon
|
||||
pbPlayDecisionSE
|
||||
@@ -527,9 +527,9 @@ def pbDebugRoamers
|
||||
if cmdwindow.index < cmdwindow.roamerCount
|
||||
pbPlayDecisionSE
|
||||
# Toggle through roaming, not roaming, defeated
|
||||
if pkmn[2] > 0 && !$game_switches[pkmn[2]]
|
||||
if pkmn[:game_switch] && pkmn[:game_switch] > 0 && !$game_switches[pkmn[:game_switch]]
|
||||
# not roaming -> roaming
|
||||
$game_switches[pkmn[2]] = true
|
||||
$game_switches[pkmn[:game_switch]] = true
|
||||
elsif $PokemonGlobal.roamPokemon[cmdwindow.index] != true
|
||||
# roaming -> defeated
|
||||
$PokemonGlobal.roamPokemon[cmdwindow.index] = true
|
||||
@@ -538,9 +538,9 @@ def pbDebugRoamers
|
||||
!$PokemonGlobal.roamPokemonCaught[cmdwindow.index]
|
||||
# defeated -> caught
|
||||
$PokemonGlobal.roamPokemonCaught[cmdwindow.index] = true
|
||||
elsif pkmn[2] > 0
|
||||
elsif pkmn[:game_switch] && pkmn[:game_switch] > 0
|
||||
# caught -> not roaming (or roaming if Switch ID is 0)
|
||||
$game_switches[pkmn[2]] = false if pkmn[2] > 0
|
||||
$game_switches[pkmn[:game_switch]] = false if pkmn[:game_switch] && pkmn[:game_switch] > 0
|
||||
$PokemonGlobal.roamPokemon[cmdwindow.index] = nil
|
||||
$PokemonGlobal.roamPokemonCaught[cmdwindow.index] = false
|
||||
end
|
||||
|
||||
@@ -207,9 +207,79 @@ module Compiler
|
||||
# Compile Town Map data.
|
||||
#-----------------------------------------------------------------------------
|
||||
def compile_town_map(*paths)
|
||||
compile_PBS_file_generic(GameData::TownMap, *paths) do |final_validate, hash|
|
||||
(final_validate) ? validate_all_compiled_town_maps : validate_compiled_town_map(hash)
|
||||
GameData::TownMap::DATA.clear
|
||||
schema = GameData::TownMap.schema
|
||||
sub_schema = GameData::TownMap.sub_schema
|
||||
idx = 0
|
||||
# Read from PBS file(s)
|
||||
paths.each do |path|
|
||||
compile_pbs_file_message_start(path)
|
||||
file_suffix = File.basename(path, ".txt")[GameData::TownMap::PBS_BASE_FILENAME.length + 1, path.length] || ""
|
||||
data_hash = nil
|
||||
current_point = nil
|
||||
section_name = nil
|
||||
section_line = nil
|
||||
# Read each line of town_map.txt at a time and compile it as a town map property
|
||||
pbCompilerEachPreppedLine(path) do |line, line_no|
|
||||
echo "." if idx % 100 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 500 == 0
|
||||
FileLineData.setSection(section_name, nil, section_line)
|
||||
if line[/^\s*\[\s*(.+)\s*\]\s*$/]
|
||||
# New section [region_number]
|
||||
section_name = $~[1]
|
||||
section_line = line
|
||||
if data_hash
|
||||
validate_compiled_town_map(data_hash)
|
||||
GameData::TownMap.register(data_hash)
|
||||
end
|
||||
FileLineData.setSection(section_name, nil, section_line)
|
||||
# Construct data hash
|
||||
data_hash = {
|
||||
:pbs_file_suffix => file_suffix
|
||||
}
|
||||
data_hash[schema["SectionName"][0]] = get_csv_record(section_name.clone, schema["SectionName"])
|
||||
data_hash[schema["Point"][0]] = []
|
||||
current_point = nil
|
||||
elsif line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||
# XXX=YYY lines
|
||||
if !data_hash
|
||||
raise _INTL("Expected a section at the beginning of the file.") + "\n" + FileLineData.linereport
|
||||
end
|
||||
key = $~[1]
|
||||
if schema[key] # Property of the town map
|
||||
property_value = get_csv_record($~[2], schema[key])
|
||||
if key == "Point"
|
||||
current_point = {
|
||||
:position => [property_value[0], property_value[1]],
|
||||
:real_name => property_value[2]
|
||||
}
|
||||
current_point[:real_description] = property_value[3] if property_value[3]
|
||||
current_point[:fly_spot] = [property_value[4], property_value[5], property_value[6]] if property_value[4]
|
||||
current_point[:switch] = property_value[7] if property_value[7]
|
||||
data_hash[schema[key][0]].push(current_point)
|
||||
else
|
||||
data_hash[schema[key][0]] = property_value
|
||||
end
|
||||
elsif sub_schema[key] # Property of a point
|
||||
if !current_point
|
||||
raise _INTL("Property \"{1}\" is point-specific, but a point hasn't been defined yet.", key) + "\n" + FileLineData.linereport
|
||||
end
|
||||
current_point[sub_schema[key][0]] = get_csv_record($~[2], sub_schema[key])
|
||||
end
|
||||
end
|
||||
end
|
||||
# Add last town map's data to records
|
||||
if data_hash
|
||||
FileLineData.setSection(section_name, nil, section_line)
|
||||
validate_compiled_town_map(data_hash)
|
||||
GameData::TownMap.register(data_hash)
|
||||
end
|
||||
process_pbs_file_message_end
|
||||
end
|
||||
validate_all_compiled_town_maps
|
||||
# Save all data
|
||||
GameData::TownMap.save
|
||||
end
|
||||
|
||||
def validate_compiled_town_map(hash)
|
||||
@@ -219,19 +289,19 @@ module Compiler
|
||||
# Get town map names and descriptions for translating
|
||||
region_names = []
|
||||
point_names = []
|
||||
interest_names = []
|
||||
point_descriptions = []
|
||||
GameData::TownMap.each do |town_map|
|
||||
region_names[town_map.id] = town_map.real_name
|
||||
town_map.point.each do |point|
|
||||
point_names.push(point[2])
|
||||
interest_names.push(point[3])
|
||||
town_map.points.each do |point|
|
||||
point_names.push(point[:real_name])
|
||||
point_descriptions.push(point[:real_description])
|
||||
end
|
||||
end
|
||||
point_names.uniq!
|
||||
interest_names.uniq!
|
||||
point_descriptions.uniq!
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::REGION_NAMES, region_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::REGION_LOCATION_NAMES, point_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::REGION_LOCATION_DESCRIPTIONS, interest_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::REGION_LOCATION_DESCRIPTIONS, point_descriptions)
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -107,7 +107,57 @@ module Compiler
|
||||
# Save Town Map data to PBS file.
|
||||
#-----------------------------------------------------------------------------
|
||||
def write_town_map
|
||||
write_PBS_file_generic(GameData::TownMap)
|
||||
paths = get_all_PBS_file_paths(GameData::TownMap)
|
||||
schema = GameData::TownMap.schema
|
||||
sub_schema = GameData::TownMap.sub_schema
|
||||
idx = 0
|
||||
paths.each do |path|
|
||||
write_pbs_file_message_start(path[0])
|
||||
File.open(path[0], "wb") do |f|
|
||||
add_PBS_header_to_file(f)
|
||||
# Write each element in turn
|
||||
GameData::TownMap.each do |element|
|
||||
next if element.pbs_file_suffix != path[1]
|
||||
echo "." if idx % 100 == 0
|
||||
Graphics.update if idx % 500 == 0
|
||||
idx += 1
|
||||
f.write("\#-------------------------------\r\n")
|
||||
if schema["SectionName"]
|
||||
f.write("[")
|
||||
pbWriteCsvRecord(element.get_property_for_PBS("SectionName"), f, schema["SectionName"])
|
||||
f.write("]\r\n")
|
||||
else
|
||||
f.write("[#{element.id}]\r\n")
|
||||
end
|
||||
# Write each town map property
|
||||
schema.each_key do |key|
|
||||
next if ["SectionName", "Point"].include?(key)
|
||||
val = element.get_property_for_PBS(key)
|
||||
next if val.nil?
|
||||
f.write(sprintf("%s = ", key))
|
||||
pbWriteCsvRecord(val, f, schema[key])
|
||||
f.write("\r\n")
|
||||
end
|
||||
# Write each point in turn
|
||||
element.points.each_with_index do |point, i|
|
||||
# Write position/name
|
||||
val = element.get_point_property_for_PBS("Point", i)
|
||||
f.write("Point = ")
|
||||
pbWriteCsvRecord(val, f, schema["Point"])
|
||||
f.write("\r\n")
|
||||
# Write other point properties
|
||||
sub_schema.each_key do |key|
|
||||
val = element.get_point_property_for_PBS(key, i)
|
||||
next if val.nil?
|
||||
f.write(sprintf(" %s = ", key))
|
||||
pbWriteCsvRecord(val, f, sub_schema[key])
|
||||
f.write("\r\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
process_pbs_file_message_end
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -3,34 +3,77 @@
|
||||
[0]
|
||||
Name = Essen
|
||||
Filename = mapRegion0.png
|
||||
Point = 13,12,Lappet Town,Oak's Lab,2,8,8
|
||||
PointSize = 16,16
|
||||
Size = 30,20
|
||||
Point = 13,12,Lappet Town
|
||||
Image = image_lappet_town
|
||||
Description = \PN's house\nProfessor Oak's lab
|
||||
FlySpot = 2,8,8
|
||||
Point = 13,11,Route 1
|
||||
Point = 13,10,Cedolan City,Cedolan Dept. Store,7,47,11
|
||||
Point = 14,10,Cedolan City,,7,47,11
|
||||
Description = Kurt's house
|
||||
Point = 13,10,Cedolan City
|
||||
Image = image_cedolan_city
|
||||
Description = Cedolan Dept. Store\nCedolan Gym\nMove Maniac House
|
||||
FlySpot = 7,47,11
|
||||
FlyIconOffset = 8,0
|
||||
Point = 14,10,Cedolan City
|
||||
Image = image_cedolan_city
|
||||
Description = Game Corner\nPokémon Institute
|
||||
FlySpot = 7,47,11
|
||||
HideFlyIcon = true
|
||||
Point = 14,9,Route 2
|
||||
Description = Bridges
|
||||
Point = 14,8,Route 2
|
||||
Point = 15,8,Lerucean Town,,23,11,15
|
||||
Description = Bridges
|
||||
Point = 15,8,Lerucean Town
|
||||
Image = image_lerucean_town
|
||||
Description = Day Care Center\nPokémon Fan Club\nLerucean Market
|
||||
FlySpot = 23,11,15
|
||||
Point = 16,8,Natural Park
|
||||
Description = A Bug Catching Contest is held here every Tuesday, Thursday and Saturday.
|
||||
Point = 15,7,Route 3
|
||||
Point = 15,6,Route 3,Ice Cave
|
||||
Point = 15,6,Route 3
|
||||
Description = Ice Cave
|
||||
Point = 14,6,Route 3
|
||||
Point = 13,6,Ingido Plateau,,35,17,7
|
||||
Description = Examples of trainer battles.
|
||||
Point = 13,6,Ingido Plateau
|
||||
Image = image_ingido_plateau
|
||||
Description = Pokémon League
|
||||
FlySpot = 35,17,7
|
||||
Point = 12,6,Route 4
|
||||
Point = 11,6,Route 4
|
||||
Point = 11,7,Route 5,Cycle Road
|
||||
Point = 11,8,Route 5,Cycle Road
|
||||
Point = 11,9,Route 5,Cycle Road
|
||||
Description = Cycle Road
|
||||
Point = 11,7,Route 5
|
||||
Description = Cycle Road
|
||||
Point = 11,8,Route 5
|
||||
Description = Cycle Road
|
||||
Point = 11,9,Route 5
|
||||
Description = Cycle Road
|
||||
Point = 11,10,Route 6
|
||||
Description = Cycle Road
|
||||
Point = 12,10,Route 6
|
||||
Point = 15,10,Route 7
|
||||
Point = 16,10,Route 7,Rock Cave
|
||||
Point = 17,10,Battle Frontier,,52,17,14
|
||||
Point = 16,10,Route 7
|
||||
Description = Rock Cave
|
||||
Point = 17,10,Battle Frontier
|
||||
Image = image_battle_frontier
|
||||
Description = Battle Palace\nBattle Tower\nBattle Arena\nBattle Factory
|
||||
FlySpot = 52,17,14
|
||||
Point = 12,12,Safari Zone
|
||||
Point = 13,13,Route 8,Diving area
|
||||
Point = 18,17,Berth Island,,,,,51
|
||||
Point = 22,16,Faraday Island,,,,,52
|
||||
Description = Challenge yourself by catching Pokémon without using your own.
|
||||
Point = 13,13,Route 8
|
||||
Image = image_route_8
|
||||
Description = Harbor\nDiving area
|
||||
Point = 18,17,Berth Island
|
||||
Description = Four mysterious meteorites can be found here.
|
||||
Switch = 51
|
||||
Point = 22,16,Faraday Island
|
||||
Description = A blue Mew can be found here every so often.
|
||||
Switch = 52
|
||||
#-------------------------------
|
||||
[1]
|
||||
Name = Tiall
|
||||
Filename = mapRegion1.png
|
||||
PointSize = 16,16
|
||||
Size = 30,20
|
||||
Point = 13,16,Here
|
||||
|
||||
Reference in New Issue
Block a user