mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Moved global/map metadata constants and schema into modules
This commit is contained in:
@@ -460,7 +460,7 @@ def pbGetPlayerCharset(meta,charset,trainer=nil,force=false)
|
||||
end
|
||||
|
||||
def pbUpdateVehicle
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
if meta
|
||||
charset = 1 # Regular graphic
|
||||
if $PokemonGlobal.diving; charset = 5 # Diving graphic
|
||||
@@ -480,9 +480,9 @@ def pbCancelVehicles(destination=nil)
|
||||
end
|
||||
|
||||
def pbCanUseBike?(mapid)
|
||||
return true if pbGetMetadata(mapid,MetadataBicycleAlways)
|
||||
val = pbGetMetadata(mapid,MetadataBicycle)
|
||||
val = pbGetMetadata(mapid,MetadataOutdoor) if val==nil
|
||||
return true if pbGetMetadata(mapid,MapMetadata::BICYCLE_ALWAYS)
|
||||
val = pbGetMetadata(mapid,MapMetadata::BICYCLE)
|
||||
val = pbGetMetadata(mapid,MapMetadata::OUTDOOR) if val==nil
|
||||
return (val) ? true : false
|
||||
end
|
||||
|
||||
@@ -490,7 +490,7 @@ def pbMountBike
|
||||
return if $PokemonGlobal.bicycle
|
||||
$PokemonGlobal.bicycle = true
|
||||
pbUpdateVehicle
|
||||
bikebgm = pbGetMetadata(0,MetadataBicycleBGM)
|
||||
bikebgm = pbGetMetadata(0,Metadata::BICYCLE_BGM)
|
||||
pbCueBGM(bikebgm,0.5) if bikebgm
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class Game_Player < Game_Character
|
||||
@defaultCharacterName = "" if !@defaultCharacterName
|
||||
return @defaultCharacterName if @defaultCharacterName!=""
|
||||
if !@move_route_forcing && $PokemonGlobal.playerID>=0
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
|
||||
charset = 1 # Display normal character sprite
|
||||
if pbCanRun? && (moving? || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!=""
|
||||
|
||||
@@ -318,7 +318,7 @@ class Game_Map
|
||||
|
||||
def display_x=(value)
|
||||
@display_x = value
|
||||
if pbGetMetadata(self.map_id,MetadataSnapEdges)
|
||||
if pbGetMetadata(self.map_id,MapMetadata::SNAP_EDGES)
|
||||
max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
|
||||
@display_x = [0, [@display_x, max_x].min].max
|
||||
end
|
||||
@@ -327,7 +327,7 @@ class Game_Map
|
||||
|
||||
def display_y=(value)
|
||||
@display_y = value
|
||||
if pbGetMetadata(self.map_id,MetadataSnapEdges)
|
||||
if pbGetMetadata(self.map_id,MapMetadata::SNAP_EDGES)
|
||||
max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y
|
||||
@display_y = [0, [@display_y, max_y].min].max
|
||||
end
|
||||
|
||||
@@ -869,7 +869,7 @@ class PokemonEntryScene
|
||||
addBackgroundPlane(@sprites,"background","Naming/bg_2",@viewport)
|
||||
case subject
|
||||
when 1 # Player
|
||||
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
||||
meta=pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
if meta
|
||||
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
|
||||
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
|
||||
@@ -1147,7 +1147,7 @@ class PokemonEntryScene2
|
||||
@sprites["bg"].setBitmap("Graphics/Pictures/Naming/bg")
|
||||
case subject
|
||||
when 1 # Player
|
||||
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
||||
meta=pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
if meta
|
||||
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
|
||||
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
|
||||
|
||||
@@ -33,84 +33,90 @@ end
|
||||
#===============================================================================
|
||||
# Global and map metadata
|
||||
#===============================================================================
|
||||
MetadataHome = 1
|
||||
MetadataWildBattleBGM = 2
|
||||
MetadataTrainerBattleBGM = 3
|
||||
MetadataWildVictoryME = 4
|
||||
MetadataTrainerVictoryME = 5
|
||||
MetadataWildCaptureME = 6
|
||||
MetadataSurfBGM = 7
|
||||
MetadataBicycleBGM = 8
|
||||
MetadataPlayerA = 9
|
||||
MetadataPlayerB = 10
|
||||
MetadataPlayerC = 11
|
||||
MetadataPlayerD = 12
|
||||
MetadataPlayerE = 13
|
||||
MetadataPlayerF = 14
|
||||
MetadataPlayerG = 15
|
||||
MetadataPlayerH = 16
|
||||
module Metadata
|
||||
HOME = 1
|
||||
WILD_BATTLE_BGM = 2
|
||||
TRAINER_BATTLE_BGM = 3
|
||||
WILD_VICTORY_ME = 4
|
||||
TRAINER_VICTORY_ME = 5
|
||||
WILD_CAPTURE_ME = 6
|
||||
SURF_BGM = 7
|
||||
BICYCLE_BGM = 8
|
||||
PLAYER_A = 9
|
||||
PLAYER_B = 10
|
||||
PLAYER_C = 11
|
||||
PLAYER_D = 12
|
||||
PLAYER_E = 13
|
||||
PLAYER_F = 14
|
||||
PLAYER_G = 15
|
||||
PLAYER_H = 16
|
||||
|
||||
MetadataOutdoor = 1
|
||||
MetadataShowArea = 2
|
||||
MetadataBicycle = 3
|
||||
MetadataBicycleAlways = 4
|
||||
MetadataHealingSpot = 5
|
||||
MetadataWeather = 6
|
||||
MetadataMapPosition = 7
|
||||
MetadataDiveMap = 8
|
||||
MetadataDarkMap = 9
|
||||
MetadataSafariMap = 10
|
||||
MetadataSnapEdges = 11
|
||||
MetadataDungeon = 12
|
||||
MetadataBattleBack = 13
|
||||
MetadataMapWildBattleBGM = 14
|
||||
MetadataMapTrainerBattleBGM = 15
|
||||
MetadataMapWildVictoryME = 16
|
||||
MetadataMapTrainerVictoryME = 17
|
||||
MetadataMapWildCaptureME = 18
|
||||
MetadataMapSize = 19
|
||||
MetadataEnvironment = 20
|
||||
|
||||
module PokemonMetadata
|
||||
GlobalTypes = {
|
||||
"Home" => [MetadataHome, "uuuu"],
|
||||
"WildBattleBGM" => [MetadataWildBattleBGM, "s"],
|
||||
"TrainerBattleBGM" => [MetadataTrainerBattleBGM, "s"],
|
||||
"WildVictoryME" => [MetadataWildVictoryME, "s"],
|
||||
"TrainerVictoryME" => [MetadataTrainerVictoryME, "s"],
|
||||
"WildCaptureME" => [MetadataWildCaptureME, "s"],
|
||||
"SurfBGM" => [MetadataSurfBGM, "s"],
|
||||
"BicycleBGM" => [MetadataBicycleBGM, "s"],
|
||||
"PlayerA" => [MetadataPlayerA, "esssssss", :PBTrainers],
|
||||
"PlayerB" => [MetadataPlayerB, "esssssss", :PBTrainers],
|
||||
"PlayerC" => [MetadataPlayerC, "esssssss", :PBTrainers],
|
||||
"PlayerD" => [MetadataPlayerD, "esssssss", :PBTrainers],
|
||||
"PlayerE" => [MetadataPlayerE, "esssssss", :PBTrainers],
|
||||
"PlayerF" => [MetadataPlayerF, "esssssss", :PBTrainers],
|
||||
"PlayerG" => [MetadataPlayerG, "esssssss", :PBTrainers],
|
||||
"PlayerH" => [MetadataPlayerH, "esssssss", :PBTrainers]
|
||||
SCHEMA = {
|
||||
"Home" => [HOME, "uuuu"],
|
||||
"WildBattleBGM" => [WILD_BATTLE_BGM, "s"],
|
||||
"TrainerBattleBGM" => [TRAINER_BATTLE_BGM, "s"],
|
||||
"WildVictoryME" => [WILD_VICTORY_ME, "s"],
|
||||
"TrainerVictoryME" => [TRAINER_VICTORY_ME, "s"],
|
||||
"WildCaptureME" => [WILD_CAPTURE_ME, "s"],
|
||||
"SurfBGM" => [SURF_BGM, "s"],
|
||||
"BicycleBGM" => [BICYCLE_BGM, "s"],
|
||||
"PlayerA" => [PLAYER_A, "esssssss", :PBTrainers],
|
||||
"PlayerB" => [PLAYER_B, "esssssss", :PBTrainers],
|
||||
"PlayerC" => [PLAYER_C, "esssssss", :PBTrainers],
|
||||
"PlayerD" => [PLAYER_D, "esssssss", :PBTrainers],
|
||||
"PlayerE" => [PLAYER_E, "esssssss", :PBTrainers],
|
||||
"PlayerF" => [PLAYER_F, "esssssss", :PBTrainers],
|
||||
"PlayerG" => [PLAYER_G, "esssssss", :PBTrainers],
|
||||
"PlayerH" => [PLAYER_H, "esssssss", :PBTrainers]
|
||||
}
|
||||
NonGlobalTypes = {
|
||||
"Outdoor" => [MetadataOutdoor, "b"],
|
||||
"ShowArea" => [MetadataShowArea, "b"],
|
||||
"Bicycle" => [MetadataBicycle, "b"],
|
||||
"BicycleAlways" => [MetadataBicycleAlways, "b"],
|
||||
"HealingSpot" => [MetadataHealingSpot, "uuu"],
|
||||
"Weather" => [MetadataWeather, "eu", :PBFieldWeather],
|
||||
"MapPosition" => [MetadataMapPosition, "uuu"],
|
||||
"DiveMap" => [MetadataDiveMap, "u"],
|
||||
"DarkMap" => [MetadataDarkMap, "b"],
|
||||
"SafariMap" => [MetadataSafariMap, "b"],
|
||||
"SnapEdges" => [MetadataSnapEdges, "b"],
|
||||
"Dungeon" => [MetadataDungeon, "b"],
|
||||
"BattleBack" => [MetadataBattleBack, "s"],
|
||||
"WildBattleBGM" => [MetadataMapWildBattleBGM, "s"],
|
||||
"TrainerBattleBGM" => [MetadataMapTrainerBattleBGM, "s"],
|
||||
"WildVictoryME" => [MetadataMapWildVictoryME, "s"],
|
||||
"TrainerVictoryME" => [MetadataMapTrainerVictoryME, "s"],
|
||||
"WildCaptureME" => [MetadataMapWildCaptureME, "s"],
|
||||
"MapSize" => [MetadataMapSize, "us"],
|
||||
"Environment" => [MetadataEnvironment, "e", :PBEnvironment]
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Map-specific metadata
|
||||
#===============================================================================
|
||||
module MapMetadata
|
||||
OUTDOOR = 1
|
||||
SHOW_AREA = 2
|
||||
BICYCLE = 3
|
||||
BICYCLE_ALWAYS = 4
|
||||
HEALING_SPOT = 5
|
||||
WEATHER = 6
|
||||
MAP_POSITION = 7
|
||||
DIVE_MAP = 8
|
||||
DARK_MAP = 9
|
||||
SAFARI_MAP = 10
|
||||
SNAP_EDGES = 11
|
||||
DUNGEON = 12
|
||||
BATTLE_BACK = 13
|
||||
WILD_BATTLE_BGM = 14
|
||||
TRAINER_BATTLE_BGM = 15
|
||||
WILD_VICTORY_ME = 16
|
||||
TRAINER_VICTORY_ME = 17
|
||||
WILD_CAPTURE_ME = 18
|
||||
MAP_SIZE = 19
|
||||
ENVIRONMENT = 20
|
||||
|
||||
SCHEMA = {
|
||||
"Outdoor" => [OUTDOOR, "b"],
|
||||
"ShowArea" => [SHOW_AREA, "b"],
|
||||
"Bicycle" => [BICYCLE, "b"],
|
||||
"BicycleAlways" => [BICYCLE_ALWAYS, "b"],
|
||||
"HealingSpot" => [HEALING_SPOT, "uuu"],
|
||||
"Weather" => [WEATHER, "eu", :PBFieldWeather],
|
||||
"MapPosition" => [MAP_POSITION, "uuu"],
|
||||
"DiveMap" => [DIVE_MAP, "u"],
|
||||
"DarkMap" => [DARK_MAP, "b"],
|
||||
"SafariMap" => [SAFARI_MAP, "b"],
|
||||
"SnapEdges" => [SNAP_EDGES, "b"],
|
||||
"Dungeon" => [DUNGEON, "b"],
|
||||
"BattleBack" => [BATTLE_BACK, "s"],
|
||||
"WildBattleBGM" => [WILD_BATTLE_BGM, "s"],
|
||||
"TrainerBattleBGM" => [TRAINER_BATTLE_BGM, "s"],
|
||||
"WildVictoryME" => [WILD_VICTORY_ME, "s"],
|
||||
"TrainerVictoryME" => [TRAINER_VICTORY_ME, "s"],
|
||||
"WildCaptureME" => [WILD_CAPTURE_ME, "s"],
|
||||
"MapSize" => [MAP_SIZE, "us"],
|
||||
"Environment" => [ENVIRONMENT, "e", :PBEnvironment]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -399,11 +399,11 @@ Events.onMapChanging += proc { |_sender,e|
|
||||
newMapID = e[0]
|
||||
if newMapID>0
|
||||
mapinfos = ($RPGVX) ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
|
||||
oldWeather = pbGetMetadata($game_map.map_id,MetadataWeather)
|
||||
oldWeather = pbGetMetadata($game_map.map_id,MapMetadata::WEATHER)
|
||||
if $game_map.name!=mapinfos[newMapID].name
|
||||
$game_screen.weather(0,0,0) if oldWeather
|
||||
else
|
||||
newWeather = pbGetMetadata(newMapID,MetadataWeather)
|
||||
newWeather = pbGetMetadata(newMapID,MapMetadata::WEATHER)
|
||||
$game_screen.weather(0,0,0) if oldWeather && !newWeather
|
||||
end
|
||||
end
|
||||
@@ -412,18 +412,18 @@ Events.onMapChanging += proc { |_sender,e|
|
||||
# Set up various data related to the new map
|
||||
Events.onMapChange += proc { |_sender,e|
|
||||
oldid = e[0] # previous map ID, 0 if no map ID
|
||||
healing = pbGetMetadata($game_map.map_id,MetadataHealingSpot)
|
||||
healing = pbGetMetadata($game_map.map_id,MapMetadata::HEALING_SPOT)
|
||||
$PokemonGlobal.healingSpot = healing if healing
|
||||
$PokemonMap.clear if $PokemonMap
|
||||
$PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters
|
||||
$PokemonGlobal.visitedMaps[$game_map.map_id] = true
|
||||
if oldid!=0 && oldid!=$game_map.map_id
|
||||
mapinfos = ($RPGVX) ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
|
||||
weather = pbGetMetadata($game_map.map_id,MetadataWeather)
|
||||
weather = pbGetMetadata($game_map.map_id,MapMetadata::WEATHER)
|
||||
if $game_map.name!=mapinfos[oldid].name
|
||||
$game_screen.weather(weather[0],8,20) if weather && rand(100)<weather[1]
|
||||
else
|
||||
oldweather = pbGetMetadata(oldid,MetadataWeather)
|
||||
oldweather = pbGetMetadata(oldid,MapMetadata::WEATHER)
|
||||
$game_screen.weather(weather[0],8,20) if weather && !oldweather && rand(100)<weather[1]
|
||||
end
|
||||
end
|
||||
@@ -444,7 +444,7 @@ Events.onMapSceneChange += proc { |_sender,e|
|
||||
$PokemonGlobal.mapTrail[0] = $game_map.map_id
|
||||
end
|
||||
# Display darkness circle on dark maps
|
||||
darkmap = pbGetMetadata($game_map.map_id,MetadataDarkMap)
|
||||
darkmap = pbGetMetadata($game_map.map_id,MapMetadata::DARK_MAP)
|
||||
if darkmap
|
||||
if $PokemonGlobal.flashUsed
|
||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
||||
@@ -464,7 +464,7 @@ Events.onMapSceneChange += proc { |_sender,e|
|
||||
end
|
||||
# Show location signpost
|
||||
if mapChanged
|
||||
if pbGetMetadata($game_map.map_id,MetadataShowArea)
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::SHOW_AREA)
|
||||
nosignpost = false
|
||||
if $PokemonGlobal.mapTrail[1]
|
||||
for i in 0...NO_SIGNPOSTS.length/2
|
||||
@@ -480,7 +480,7 @@ Events.onMapSceneChange += proc { |_sender,e|
|
||||
end
|
||||
end
|
||||
# Force cycling/walking
|
||||
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
|
||||
pbMountBike
|
||||
elsif !pbCanUseBike?($game_map.map_id)
|
||||
pbDismountBike
|
||||
@@ -698,7 +698,7 @@ def pbFishingBegin
|
||||
$PokemonGlobal.fishing = true
|
||||
if !pbCommonEvent(FISHING_BEGIN_COMMON_EVENT)
|
||||
patternb = 2*$game_player.direction - 1
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
num = ($PokemonGlobal.surfing) ? 7 : 6
|
||||
if meta && meta[num] && meta[num]!=""
|
||||
charset = pbGetPlayerCharset(meta,num)
|
||||
@@ -717,7 +717,7 @@ end
|
||||
def pbFishingEnd
|
||||
if !pbCommonEvent(FISHING_END_COMMON_EVENT)
|
||||
patternb = 2*($game_player.direction - 2)
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
|
||||
num = ($PokemonGlobal.surfing) ? 7 : 6
|
||||
if meta && meta[num] && meta[num]!=""
|
||||
charset = pbGetPlayerCharset(meta,num)
|
||||
@@ -1223,7 +1223,7 @@ def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)
|
||||
end
|
||||
|
||||
def pbAutoplayOnTransition
|
||||
surfbgm = pbGetMetadata(0,MetadataSurfBGM)
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
if $PokemonGlobal.surfing && surfbgm
|
||||
pbBGMPlay(surfbgm)
|
||||
else
|
||||
@@ -1232,7 +1232,7 @@ def pbAutoplayOnTransition
|
||||
end
|
||||
|
||||
def pbAutoplayOnSave
|
||||
surfbgm = pbGetMetadata(0,MetadataSurfBGM)
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
if $PokemonGlobal.surfing && surfbgm
|
||||
pbBGMPlay(surfbgm)
|
||||
else
|
||||
|
||||
@@ -276,7 +276,7 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
||||
location = 3
|
||||
elsif $PokemonEncounters.isCave?
|
||||
location = 2
|
||||
elsif !pbGetMetadata($game_map.map_id,MetadataOutdoor)
|
||||
elsif !pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
|
||||
location = 1
|
||||
end
|
||||
anim = ""
|
||||
@@ -653,7 +653,7 @@ def pbStartOver(gameover=false)
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
$game_map.refresh
|
||||
else
|
||||
homedata = pbGetMetadata(0,MetadataHome)
|
||||
homedata = pbGetMetadata(0,Metadata::HOME)
|
||||
if homedata && !pbRxdataExists?(sprintf("Data/Map%03d",homedata[0]))
|
||||
if $DEBUG
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
|
||||
|
||||
@@ -130,7 +130,7 @@ def pbPrepareBattle(battle)
|
||||
elsif $PokemonGlobal.surfing
|
||||
backdrop = "water" # This applies wherever you are, including in caves
|
||||
else
|
||||
back = pbGetMetadata($game_map.map_id,MetadataBattleBack)
|
||||
back = pbGetMetadata($game_map.map_id,MapMetadata::BATTLE_BACK)
|
||||
backdrop = back if back && back!=""
|
||||
end
|
||||
backdrop = "indoor1" if !backdrop
|
||||
@@ -151,7 +151,7 @@ def pbPrepareBattle(battle)
|
||||
end
|
||||
battle.backdropBase = base if base
|
||||
# Time of day
|
||||
if pbGetMetadata($game_map.map_id,MetadataEnvironment)==PBEnvironment::Cave
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::ENVIRONMENT)==PBEnvironment::Cave
|
||||
battle.time = 2 # This makes Dusk Balls work properly in caves
|
||||
elsif TIME_SHADING
|
||||
timeNow = pbGetTimeNow
|
||||
@@ -165,7 +165,7 @@ end
|
||||
# Used to determine the environment in battle, and also the form of Burmy/
|
||||
# Wormadam.
|
||||
def pbGetEnvironment
|
||||
ret = pbGetMetadata($game_map.map_id,MetadataEnvironment)
|
||||
ret = pbGetMetadata($game_map.map_id,MapMetadata::ENVIRONMENT)
|
||||
ret = PBEnvironment::None if !ret
|
||||
if $PokemonTemp.encounterType==EncounterTypes::OldRod ||
|
||||
$PokemonTemp.encounterType==EncounterTypes::GoodRod ||
|
||||
|
||||
@@ -183,7 +183,7 @@ EncounterModifier.register(proc { |encounter|
|
||||
# are in the same region
|
||||
if roamerMap!=$game_map.map_id
|
||||
currentRegion = pbGetCurrentRegion
|
||||
next if pbGetMetadata(roamerMap,MetadataMapPosition)[0]!=currentRegion
|
||||
next if pbGetMetadata(roamerMap,MapMetadata::MAP_POSITION)[0]!=currentRegion
|
||||
currentMapName = pbGetMessage(MessageTypes::MapNames,$game_map.map_id)
|
||||
next if pbGetMessage(MessageTypes::MapNames,roamerMap)!=currentMapName
|
||||
end
|
||||
|
||||
@@ -555,7 +555,7 @@ end
|
||||
Events.onMapCreate += proc { |_sender, e|
|
||||
mapID=e[0]
|
||||
map=e[1]
|
||||
if pbGetMetadata(mapID,MetadataDungeon)
|
||||
if pbGetMetadata(mapID,MapMetadata::DUNGEON)
|
||||
# this map is a randomly generated dungeon
|
||||
dungeon=Dungeon.new(map.width,map.height)
|
||||
dungeon.generate
|
||||
|
||||
@@ -302,7 +302,7 @@ HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
|
||||
# Dive
|
||||
#===============================================================================
|
||||
def pbDive
|
||||
divemap = pbGetMetadata($game_map.map_id,MetadataDiveMap)
|
||||
divemap = pbGetMetadata($game_map.map_id,MapMetadata::DIVE_MAP)
|
||||
return false if !divemap
|
||||
move = getID(PBMoves,:DIVE)
|
||||
movefinder = pbCheckMove(move)
|
||||
@@ -336,7 +336,7 @@ def pbSurfacing
|
||||
divemap = nil
|
||||
meta = pbLoadMetadata
|
||||
for i in 0...meta.length
|
||||
if meta[i] && meta[i][MetadataDiveMap] && meta[i][MetadataDiveMap]==$game_map.map_id
|
||||
if meta[i] && meta[i][MapMetadata::DIVE_MAP] && meta[i][MapMetadata::DIVE_MAP]==$game_map.map_id
|
||||
divemap = i; break
|
||||
end
|
||||
end
|
||||
@@ -360,7 +360,7 @@ def pbSurfacing
|
||||
$PokemonGlobal.diving = false
|
||||
pbUpdateVehicle
|
||||
$scene.transfer_player(false)
|
||||
surfbgm = pbGetMetadata(0,MetadataSurfBGM)
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
(surfbgm) ? pbBGMPlay(surfbgm) : $game_map.autoplayAsCue
|
||||
$game_map.refresh
|
||||
}
|
||||
@@ -389,7 +389,7 @@ Events.onAction += proc { |_sender,_e|
|
||||
divemap = nil
|
||||
meta = pbLoadMetadata
|
||||
for i in 0...meta.length
|
||||
if meta[i] && meta[i][MetadataDiveMap] && meta[i][MetadataDiveMap]==$game_map.map_id
|
||||
if meta[i] && meta[i][MapMetadata::DIVE_MAP] && meta[i][MapMetadata::DIVE_MAP]==$game_map.map_id
|
||||
divemap = i; break
|
||||
end
|
||||
end
|
||||
@@ -409,7 +409,7 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
||||
divemap = nil
|
||||
meta = pbLoadMetadata
|
||||
for i in 0...meta.length
|
||||
if meta[i] && meta[i][MetadataDiveMap] && meta[i][MetadataDiveMap]==$game_map.map_id
|
||||
if meta[i] && meta[i][MapMetadata::DIVE_MAP] && meta[i][MapMetadata::DIVE_MAP]==$game_map.map_id
|
||||
divemap = i; break
|
||||
end
|
||||
end
|
||||
@@ -418,7 +418,7 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
|
||||
next false
|
||||
end
|
||||
else
|
||||
if !pbGetMetadata($game_map.map_id,MetadataDiveMap)
|
||||
if !pbGetMetadata($game_map.map_id,MapMetadata::DIVE_MAP)
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -436,12 +436,12 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
||||
divemap = nil
|
||||
meta = pbLoadMetadata
|
||||
for i in 0...meta.length
|
||||
if meta[i] && meta[i][MetadataDiveMap] && meta[i][MetadataDiveMap]==$game_map.map_id
|
||||
if meta[i] && meta[i][MapMetadata::DIVE_MAP] && meta[i][MapMetadata::DIVE_MAP]==$game_map.map_id
|
||||
divemap = i; break
|
||||
end
|
||||
end
|
||||
else
|
||||
divemap = pbGetMetadata($game_map.map_id,MetadataDiveMap)
|
||||
divemap = pbGetMetadata($game_map.map_id,MapMetadata::DIVE_MAP)
|
||||
end
|
||||
next false if !divemap
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
@@ -469,7 +469,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
|
||||
#===============================================================================
|
||||
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(BADGE_FOR_FLASH,showmsg)
|
||||
if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
|
||||
if !pbGetMetadata($game_map.map_id,MapMetadata::DARK_MAP)
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -509,7 +509,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLY,proc { |move,pkmn,showmsg|
|
||||
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
|
||||
next false
|
||||
end
|
||||
if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
|
||||
if !pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -715,7 +715,7 @@ def pbSurf
|
||||
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
|
||||
pbCancelVehicles
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
surfbgm = pbGetMetadata(0,MetadataSurfBGM)
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
pbCueBGM(surfbgm,0.5) if surfbgm
|
||||
pbStartSurfing
|
||||
return true
|
||||
@@ -768,7 +768,7 @@ end
|
||||
|
||||
Events.onAction += proc { |_sender,_e|
|
||||
next if $PokemonGlobal.surfing
|
||||
next if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
|
||||
next if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
|
||||
next if !PBTerrain.isSurfable?(pbFacingTerrainTag)
|
||||
next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
|
||||
pbSurf
|
||||
@@ -784,7 +784,7 @@ HiddenMoveHandlers::CanUseMove.add(:SURF,proc { |move,pkmn,showmsg|
|
||||
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
|
||||
next false
|
||||
end
|
||||
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
|
||||
pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -802,7 +802,7 @@ HiddenMoveHandlers::UseMove.add(:SURF,proc { |move,pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
end
|
||||
surfbgm = pbGetMetadata(0,MetadataSurfBGM)
|
||||
surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
|
||||
pbCueBGM(surfbgm,0.5) if surfbgm
|
||||
pbStartSurfing
|
||||
next true
|
||||
@@ -865,12 +865,12 @@ HiddenMoveHandlers::UseMove.add(:SWEETSCENT,proc { |move,pokemon|
|
||||
# Teleport
|
||||
#===============================================================================
|
||||
HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
|
||||
if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
|
||||
if !pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
healing = $PokemonGlobal.healingSpot
|
||||
healing = pbGetMetadata(0,MetadataHome) if !healing # Home
|
||||
healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
|
||||
if !healing
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
@@ -884,7 +884,7 @@ HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
|
||||
|
||||
HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
|
||||
healing = $PokemonGlobal.healingSpot
|
||||
healing = pbGetMetadata(0,MetadataHome) if !healing # Home
|
||||
healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
|
||||
next false if !healing
|
||||
mapname = pbGetMapNameFromId(healing[0])
|
||||
next pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
|
||||
@@ -892,7 +892,7 @@ HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
|
||||
healing = $PokemonGlobal.healingSpot
|
||||
healing = pbGetMetadata(0,MetadataHome) if !healing # Home
|
||||
healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
|
||||
next false if !healing
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
|
||||
|
||||
@@ -117,7 +117,7 @@ end
|
||||
|
||||
def pbDayNightTint(object)
|
||||
return if !$scene.is_a?(Scene_Map)
|
||||
if TIME_SHADING && pbGetMetadata($game_map.map_id,MetadataOutdoor)
|
||||
if TIME_SHADING && pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
|
||||
tone = PBDayNight.getTone
|
||||
object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
|
||||
else
|
||||
|
||||
@@ -572,14 +572,14 @@ def pbBikeCheck
|
||||
return false
|
||||
end
|
||||
if $PokemonGlobal.bicycle
|
||||
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
|
||||
if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
|
||||
pbMessage(_INTL("You can't dismount your Bike here."))
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
val = pbGetMetadata($game_map.map_id,MetadataBicycle)
|
||||
val = pbGetMetadata($game_map.map_id,MetadataOutdoor) if val==nil
|
||||
val = pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE)
|
||||
val = pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR) if val==nil
|
||||
if !val
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
return false
|
||||
|
||||
@@ -66,11 +66,11 @@ end
|
||||
def pbRandomPhoneTrainer
|
||||
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
|
||||
temparray = []
|
||||
currentRegion = pbGetMetadata($game_map.map_id,MetadataMapPosition)
|
||||
currentRegion = pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
|
||||
for num in $PokemonGlobal.phoneNumbers
|
||||
next if !num[0] || num.length!=8 # if not visible or not a trainer
|
||||
next if $game_map.map_id==num[6] # Can't call if on same map
|
||||
callerRegion = pbGetMetadata(num[6],MetadataMapPosition)
|
||||
callerRegion = pbGetMetadata(num[6],MapMetadata::MAP_POSITION)
|
||||
# Can't call if in different region
|
||||
next if callerRegion && currentRegion && callerRegion[0]!=currentRegion[0]
|
||||
temparray.push(num)
|
||||
@@ -193,8 +193,8 @@ def pbCallTrainer(trtype,trname)
|
||||
pbMessage(_INTL("The Trainer is close by.\nTalk to the Trainer in person!"))
|
||||
return
|
||||
end
|
||||
callerregion = pbGetMetadata(trainer[6],MetadataMapPosition)
|
||||
currentregion = pbGetMetadata($game_map.map_id,MetadataMapPosition)
|
||||
callerregion = pbGetMetadata(trainer[6],MapMetadata::MAP_POSITION)
|
||||
currentregion = pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
|
||||
if callerregion && currentregion && callerregion[0]!=currentregion[0]
|
||||
pbMessage(_INTL("The Trainer is out of range."))
|
||||
return # Can't call if in different region
|
||||
|
||||
@@ -679,7 +679,7 @@ MultipleForms.register(:NECROZMA,{
|
||||
MultipleForms.register(:PIKACHU,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next if pkmn.formSimple>=2
|
||||
mapPos = pbGetMetadata($game_map.map_id,MetadataMapPosition)
|
||||
mapPos = pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
|
||||
next 1 if mapPos && mapPos[0]==1 # Tiall region
|
||||
next 0
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ PBEvolution.register(:LevelDiving, {
|
||||
|
||||
PBEvolution.register(:LevelDarkness, {
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
next pkmn.level >= parameter && pbGetMetadata($game_map.map_id, MetadataDarkMap)
|
||||
next pkmn.level >= parameter && pbGetMetadata($game_map.map_id, MapMetadata::DARK_MAP)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -653,7 +653,7 @@ PBEvolution.register(:Location, {
|
||||
PBEvolution.register(:Region, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
mapPos = pbGetMetadata($game_map.map_id, MetadataMapPosition)
|
||||
mapPos = pbGetMetadata($game_map.map_id, MapMetadata::MAP_POSITION)
|
||||
next mapPos && mapPos[0] == parameter
|
||||
}
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ class PokemonPokedexInfo_Scene
|
||||
@sprites["infosprite"].x = 104
|
||||
@sprites["infosprite"].y = 136
|
||||
@mapdata = pbLoadTownMapData
|
||||
mappos = ($game_map) ? pbGetMetadata($game_map.map_id,MetadataMapPosition) : nil
|
||||
mappos = ($game_map) ? pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION) : nil
|
||||
if @region<0 # Use player's current region
|
||||
@region = (mappos) ? mappos[0] : 0 # Region 0 default
|
||||
end
|
||||
@@ -311,7 +311,7 @@ class PokemonPokedexInfo_Scene
|
||||
for enc in encdata.keys
|
||||
enctypes = encdata[enc][1]
|
||||
if pbFindEncounter(enctypes,@species)
|
||||
mappos = pbGetMetadata(enc,MetadataMapPosition)
|
||||
mappos = pbGetMetadata(enc,MapMetadata::MAP_POSITION)
|
||||
if mappos && mappos[0]==@region
|
||||
showpoint = true
|
||||
for loc in @mapdata[@region][2]
|
||||
@@ -319,7 +319,7 @@ class PokemonPokedexInfo_Scene
|
||||
loc[7] && !$game_switches[loc[7]]
|
||||
end
|
||||
if showpoint
|
||||
mapsize = pbGetMetadata(enc,MetadataMapSize)
|
||||
mapsize = pbGetMetadata(enc,MapMetadata::MAP_SIZE)
|
||||
if mapsize && mapsize[0] && mapsize[0]>0
|
||||
sqwidth = mapsize[0]
|
||||
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
||||
|
||||
@@ -77,7 +77,7 @@ class PokemonRegionMap_Scene
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@mapdata = pbLoadTownMapData
|
||||
playerpos = (!$game_map) ? nil : pbGetMetadata($game_map.map_id,MetadataMapPosition)
|
||||
playerpos = (!$game_map) ? nil : pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
|
||||
if !playerpos
|
||||
mapindex = 0
|
||||
@map = @mapdata[0]
|
||||
@@ -93,7 +93,7 @@ class PokemonRegionMap_Scene
|
||||
@map = @mapdata[playerpos[0]]
|
||||
@mapX = playerpos[1]
|
||||
@mapY = playerpos[2]
|
||||
mapsize = (!$game_map) ? nil : pbGetMetadata($game_map.map_id,MetadataMapSize)
|
||||
mapsize = (!$game_map) ? nil : pbGetMetadata($game_map.map_id,MapMetadata::MAP_SIZE)
|
||||
if mapsize && mapsize[0] && mapsize[0]>0
|
||||
sqwidth = mapsize[0]
|
||||
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
||||
|
||||
@@ -159,7 +159,7 @@ class PokemonLoad_Scene
|
||||
|
||||
def pbSetParty(trainer)
|
||||
return if !trainer || !trainer.party
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+trainer.metaID)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+trainer.metaID)
|
||||
if meta
|
||||
filename = pbGetPlayerCharset(meta,1,trainer,true)
|
||||
@sprites["player"] = TrainerWalkingCharSprite.new(filename,@viewport)
|
||||
|
||||
@@ -62,7 +62,7 @@ def pbInSafari?
|
||||
# map can be outdoors, with its own grassy patches.
|
||||
reception = pbSafariState.pbReceptionMap
|
||||
return true if $game_map.map_id==reception
|
||||
return true if pbGetMetadata($game_map.map_id,MetadataSafariMap)
|
||||
return true if pbGetMetadata($game_map.map_id,MapMetadata::SAFARI_MAP)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -532,12 +532,12 @@ def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects
|
||||
ret = nil
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MetadataMapWildBattleBGM)
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::WILD_BATTLE_BGM)
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,MetadataWildBattleBGM)
|
||||
music = pbGetMetadata(0,Metadata::WILD_BATTLE_BGM)
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle wild") if !ret
|
||||
@@ -551,12 +551,12 @@ def pbGetWildVictoryME
|
||||
ret = nil
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MetadataMapWildVictoryME)
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::WILD_VICTORY_ME)
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,MetadataWildVictoryME)
|
||||
music = pbGetMetadata(0,Metadata::WILD_VICTORY_ME)
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle victory") if !ret
|
||||
@@ -571,12 +571,12 @@ def pbGetWildCaptureME
|
||||
ret = nil
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MetadataMapWildCaptureME)
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::WILD_CAPTURE_ME)
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,MetadataWildCaptureME)
|
||||
music = pbGetMetadata(0,Metadata::WILD_CAPTURE_ME)
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle capture success") if !ret
|
||||
@@ -611,14 +611,14 @@ def pbGetTrainerBattleBGM(trainer) # can be a PokeBattle_Trainer or an array o
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MetadataMapTrainerBattleBGM)
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::TRAINER_BATTLE_BGM)
|
||||
if music && music!=""
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,MetadataTrainerBattleBGM)
|
||||
music = pbGetMetadata(0,Metadata::TRAINER_BATTLE_BGM)
|
||||
if music && music!=""
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
@@ -635,12 +635,12 @@ def pbGetTrainerBattleBGMFromType(trainertype)
|
||||
ret = pbStringToAudioFile(data[4]) if data && data[4]
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MetadataMapTrainerBattleBGM)
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::TRAINER_BATTLE_BGM)
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,MetadataTrainerBattleBGM)
|
||||
music = pbGetMetadata(0,Metadata::TRAINER_BATTLE_BGM)
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle trainer") if !ret
|
||||
@@ -663,14 +663,14 @@ def pbGetTrainerVictoryME(trainer) # can be a PokeBattle_Trainer or an array o
|
||||
end
|
||||
if !ret
|
||||
# Check map-specific metadata
|
||||
music = pbGetMetadata($game_map.map_id,MetadataMapTrainerVictoryME)
|
||||
music = pbGetMetadata($game_map.map_id,MapMetadata::TRAINER_VICTORY_ME)
|
||||
if music && music!=""
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
end
|
||||
if !ret
|
||||
# Check global metadata
|
||||
music = pbGetMetadata(0,MetadataTrainerVictoryME)
|
||||
music = pbGetMetadata(0,Metadata::TRAINER_VICTORY_ME)
|
||||
if music && music!=""
|
||||
ret = pbStringToAudioFile(music)
|
||||
end
|
||||
|
||||
@@ -666,7 +666,7 @@ end
|
||||
#===============================================================================
|
||||
def pbChangePlayer(id)
|
||||
return false if id<0 || id>=8
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+id)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
|
||||
return false if !meta
|
||||
$Trainer.trainertype = meta[0] if $Trainer
|
||||
$game_player.character_name = meta[1]
|
||||
@@ -678,7 +678,7 @@ end
|
||||
def pbGetPlayerGraphic
|
||||
id = $PokemonGlobal.playerID
|
||||
return "" if id<0 || id>=8
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+id)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
|
||||
return "" if !meta
|
||||
return pbPlayerSpriteFile(meta[0])
|
||||
end
|
||||
@@ -686,7 +686,7 @@ end
|
||||
def pbGetPlayerTrainerType
|
||||
id = $PokemonGlobal.playerID
|
||||
return 0 if id<0 || id>=8
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+id)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
|
||||
return 0 if !meta
|
||||
return meta[0]
|
||||
end
|
||||
@@ -868,7 +868,7 @@ end
|
||||
# no region was defined in the game's metadata. The ID numbers returned by
|
||||
# this function depend on the current map's position metadata.
|
||||
def pbGetCurrentRegion(defaultRegion=-1)
|
||||
mappos = ($game_map) ? pbGetMetadata($game_map.map_id,MetadataMapPosition) : nil
|
||||
mappos = ($game_map) ? pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION) : nil
|
||||
return (mappos) ? mappos[0] : defaultRegion
|
||||
end
|
||||
|
||||
|
||||
@@ -683,7 +683,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
|
||||
when "setplayer"
|
||||
limit = 0
|
||||
for i in 0...8
|
||||
meta = pbGetMetadata(0,MetadataPlayerA+i)
|
||||
meta = pbGetMetadata(0,Metadata::PLAYER_A+i)
|
||||
if !meta
|
||||
limit = i; break
|
||||
end
|
||||
|
||||
@@ -197,12 +197,12 @@ def pbSerializeMetadata(metadata,mapinfos)
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(sprintf("[%03d]\r\n",i))
|
||||
if i==0
|
||||
types = PokemonMetadata::GlobalTypes
|
||||
types = Metadata::SCHEMA
|
||||
else
|
||||
if mapinfos && mapinfos[i]
|
||||
f.write(sprintf("# %s\r\n",mapinfos[i].name))
|
||||
end
|
||||
types = PokemonMetadata::NonGlobalTypes
|
||||
types = MapMetadata::SCHEMA
|
||||
end
|
||||
for key in types.keys
|
||||
schema = types[key]
|
||||
|
||||
@@ -12,10 +12,10 @@ def pbCompileMetadata
|
||||
if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
|
||||
sectionname = $~[1]
|
||||
if currentmap==0
|
||||
if sections[currentmap][MetadataHome]==nil
|
||||
if sections[currentmap][Metadata::HOME]==nil
|
||||
raise _INTL("The entry Home is required in metadata.txt section [{1}]",sectionname)
|
||||
end
|
||||
if sections[currentmap][MetadataPlayerA]==nil
|
||||
if sections[currentmap][Metadata::PLAYER_A]==nil
|
||||
raise _INTL("The entry PlayerA is required in metadata.txt section [{1}]",sectionname)
|
||||
end
|
||||
end
|
||||
@@ -32,9 +32,9 @@ def pbCompileMetadata
|
||||
schema = nil
|
||||
FileLineData.setSection(currentmap,matchData[1],matchData[2])
|
||||
if currentmap==0
|
||||
schema = PokemonMetadata::GlobalTypes[matchData[1]]
|
||||
schema = Metadata::SCHEMA[matchData[1]]
|
||||
else
|
||||
schema = PokemonMetadata::NonGlobalTypes[matchData[1]]
|
||||
schema = MapMetadata::SCHEMA[matchData[1]]
|
||||
end
|
||||
if schema
|
||||
record = pbGetCsvRecord(matchData[2],lineno,schema)
|
||||
|
||||
Reference in New Issue
Block a user