Moved global/map metadata constants and schema into modules

This commit is contained in:
Maruno17
2020-10-16 22:05:38 +01:00
parent 71a4d09224
commit e82b5409fb
25 changed files with 170 additions and 164 deletions

View File

@@ -460,7 +460,7 @@ def pbGetPlayerCharset(meta,charset,trainer=nil,force=false)
end end
def pbUpdateVehicle def pbUpdateVehicle
meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID) meta = pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
if meta if meta
charset = 1 # Regular graphic charset = 1 # Regular graphic
if $PokemonGlobal.diving; charset = 5 # Diving graphic if $PokemonGlobal.diving; charset = 5 # Diving graphic
@@ -480,9 +480,9 @@ def pbCancelVehicles(destination=nil)
end end
def pbCanUseBike?(mapid) def pbCanUseBike?(mapid)
return true if pbGetMetadata(mapid,MetadataBicycleAlways) return true if pbGetMetadata(mapid,MapMetadata::BICYCLE_ALWAYS)
val = pbGetMetadata(mapid,MetadataBicycle) val = pbGetMetadata(mapid,MapMetadata::BICYCLE)
val = pbGetMetadata(mapid,MetadataOutdoor) if val==nil val = pbGetMetadata(mapid,MapMetadata::OUTDOOR) if val==nil
return (val) ? true : false return (val) ? true : false
end end
@@ -490,7 +490,7 @@ def pbMountBike
return if $PokemonGlobal.bicycle return if $PokemonGlobal.bicycle
$PokemonGlobal.bicycle = true $PokemonGlobal.bicycle = true
pbUpdateVehicle pbUpdateVehicle
bikebgm = pbGetMetadata(0,MetadataBicycleBGM) bikebgm = pbGetMetadata(0,Metadata::BICYCLE_BGM)
pbCueBGM(bikebgm,0.5) if bikebgm pbCueBGM(bikebgm,0.5) if bikebgm
end end

View File

@@ -38,7 +38,7 @@ class Game_Player < Game_Character
@defaultCharacterName = "" if !@defaultCharacterName @defaultCharacterName = "" if !@defaultCharacterName
return @defaultCharacterName if @defaultCharacterName!="" return @defaultCharacterName if @defaultCharacterName!=""
if !@move_route_forcing && $PokemonGlobal.playerID>=0 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 if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
charset = 1 # Display normal character sprite charset = 1 # Display normal character sprite
if pbCanRun? && (moving? || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!="" if pbCanRun? && (moving? || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!=""

View File

@@ -318,7 +318,7 @@ class Game_Map
def display_x=(value) def display_x=(value)
@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 max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
@display_x = [0, [@display_x, max_x].min].max @display_x = [0, [@display_x, max_x].min].max
end end
@@ -327,7 +327,7 @@ class Game_Map
def display_y=(value) def display_y=(value)
@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 max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y
@display_y = [0, [@display_y, max_y].min].max @display_y = [0, [@display_y, max_y].min].max
end end

View File

@@ -869,7 +869,7 @@ class PokemonEntryScene
addBackgroundPlane(@sprites,"background","Naming/bg_2",@viewport) addBackgroundPlane(@sprites,"background","Naming/bg_2",@viewport)
case subject case subject
when 1 # Player when 1 # Player
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID) meta=pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
if meta if meta
@sprites["shadow"]=IconSprite.new(0,0,@viewport) @sprites["shadow"]=IconSprite.new(0,0,@viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow") @sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@@ -1147,7 +1147,7 @@ class PokemonEntryScene2
@sprites["bg"].setBitmap("Graphics/Pictures/Naming/bg") @sprites["bg"].setBitmap("Graphics/Pictures/Naming/bg")
case subject case subject
when 1 # Player when 1 # Player
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID) meta=pbGetMetadata(0,Metadata::PLAYER_A+$PokemonGlobal.playerID)
if meta if meta
@sprites["shadow"]=IconSprite.new(0,0,@viewport) @sprites["shadow"]=IconSprite.new(0,0,@viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow") @sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")

View File

@@ -33,84 +33,90 @@ end
#=============================================================================== #===============================================================================
# Global and map metadata # Global and map metadata
#=============================================================================== #===============================================================================
MetadataHome = 1 module Metadata
MetadataWildBattleBGM = 2 HOME = 1
MetadataTrainerBattleBGM = 3 WILD_BATTLE_BGM = 2
MetadataWildVictoryME = 4 TRAINER_BATTLE_BGM = 3
MetadataTrainerVictoryME = 5 WILD_VICTORY_ME = 4
MetadataWildCaptureME = 6 TRAINER_VICTORY_ME = 5
MetadataSurfBGM = 7 WILD_CAPTURE_ME = 6
MetadataBicycleBGM = 8 SURF_BGM = 7
MetadataPlayerA = 9 BICYCLE_BGM = 8
MetadataPlayerB = 10 PLAYER_A = 9
MetadataPlayerC = 11 PLAYER_B = 10
MetadataPlayerD = 12 PLAYER_C = 11
MetadataPlayerE = 13 PLAYER_D = 12
MetadataPlayerF = 14 PLAYER_E = 13
MetadataPlayerG = 15 PLAYER_F = 14
MetadataPlayerH = 16 PLAYER_G = 15
PLAYER_H = 16
MetadataOutdoor = 1 SCHEMA = {
MetadataShowArea = 2 "Home" => [HOME, "uuuu"],
MetadataBicycle = 3 "WildBattleBGM" => [WILD_BATTLE_BGM, "s"],
MetadataBicycleAlways = 4 "TrainerBattleBGM" => [TRAINER_BATTLE_BGM, "s"],
MetadataHealingSpot = 5 "WildVictoryME" => [WILD_VICTORY_ME, "s"],
MetadataWeather = 6 "TrainerVictoryME" => [TRAINER_VICTORY_ME, "s"],
MetadataMapPosition = 7 "WildCaptureME" => [WILD_CAPTURE_ME, "s"],
MetadataDiveMap = 8 "SurfBGM" => [SURF_BGM, "s"],
MetadataDarkMap = 9 "BicycleBGM" => [BICYCLE_BGM, "s"],
MetadataSafariMap = 10 "PlayerA" => [PLAYER_A, "esssssss", :PBTrainers],
MetadataSnapEdges = 11 "PlayerB" => [PLAYER_B, "esssssss", :PBTrainers],
MetadataDungeon = 12 "PlayerC" => [PLAYER_C, "esssssss", :PBTrainers],
MetadataBattleBack = 13 "PlayerD" => [PLAYER_D, "esssssss", :PBTrainers],
MetadataMapWildBattleBGM = 14 "PlayerE" => [PLAYER_E, "esssssss", :PBTrainers],
MetadataMapTrainerBattleBGM = 15 "PlayerF" => [PLAYER_F, "esssssss", :PBTrainers],
MetadataMapWildVictoryME = 16 "PlayerG" => [PLAYER_G, "esssssss", :PBTrainers],
MetadataMapTrainerVictoryME = 17 "PlayerH" => [PLAYER_H, "esssssss", :PBTrainers]
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]
} }
NonGlobalTypes = { end
"Outdoor" => [MetadataOutdoor, "b"],
"ShowArea" => [MetadataShowArea, "b"], #===============================================================================
"Bicycle" => [MetadataBicycle, "b"], # Map-specific metadata
"BicycleAlways" => [MetadataBicycleAlways, "b"], #===============================================================================
"HealingSpot" => [MetadataHealingSpot, "uuu"], module MapMetadata
"Weather" => [MetadataWeather, "eu", :PBFieldWeather], OUTDOOR = 1
"MapPosition" => [MetadataMapPosition, "uuu"], SHOW_AREA = 2
"DiveMap" => [MetadataDiveMap, "u"], BICYCLE = 3
"DarkMap" => [MetadataDarkMap, "b"], BICYCLE_ALWAYS = 4
"SafariMap" => [MetadataSafariMap, "b"], HEALING_SPOT = 5
"SnapEdges" => [MetadataSnapEdges, "b"], WEATHER = 6
"Dungeon" => [MetadataDungeon, "b"], MAP_POSITION = 7
"BattleBack" => [MetadataBattleBack, "s"], DIVE_MAP = 8
"WildBattleBGM" => [MetadataMapWildBattleBGM, "s"], DARK_MAP = 9
"TrainerBattleBGM" => [MetadataMapTrainerBattleBGM, "s"], SAFARI_MAP = 10
"WildVictoryME" => [MetadataMapWildVictoryME, "s"], SNAP_EDGES = 11
"TrainerVictoryME" => [MetadataMapTrainerVictoryME, "s"], DUNGEON = 12
"WildCaptureME" => [MetadataMapWildCaptureME, "s"], BATTLE_BACK = 13
"MapSize" => [MetadataMapSize, "us"], WILD_BATTLE_BGM = 14
"Environment" => [MetadataEnvironment, "e", :PBEnvironment] 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 end

View File

@@ -399,11 +399,11 @@ Events.onMapChanging += proc { |_sender,e|
newMapID = e[0] newMapID = e[0]
if newMapID>0 if newMapID>0
mapinfos = ($RPGVX) ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata") 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 if $game_map.name!=mapinfos[newMapID].name
$game_screen.weather(0,0,0) if oldWeather $game_screen.weather(0,0,0) if oldWeather
else else
newWeather = pbGetMetadata(newMapID,MetadataWeather) newWeather = pbGetMetadata(newMapID,MapMetadata::WEATHER)
$game_screen.weather(0,0,0) if oldWeather && !newWeather $game_screen.weather(0,0,0) if oldWeather && !newWeather
end end
end end
@@ -412,18 +412,18 @@ Events.onMapChanging += proc { |_sender,e|
# Set up various data related to the new map # Set up various data related to the new map
Events.onMapChange += proc { |_sender,e| Events.onMapChange += proc { |_sender,e|
oldid = e[0] # previous map ID, 0 if no map ID 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 $PokemonGlobal.healingSpot = healing if healing
$PokemonMap.clear if $PokemonMap $PokemonMap.clear if $PokemonMap
$PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters $PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters
$PokemonGlobal.visitedMaps[$game_map.map_id] = true $PokemonGlobal.visitedMaps[$game_map.map_id] = true
if oldid!=0 && oldid!=$game_map.map_id if oldid!=0 && oldid!=$game_map.map_id
mapinfos = ($RPGVX) ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata") 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 if $game_map.name!=mapinfos[oldid].name
$game_screen.weather(weather[0],8,20) if weather && rand(100)<weather[1] $game_screen.weather(weather[0],8,20) if weather && rand(100)<weather[1]
else else
oldweather = pbGetMetadata(oldid,MetadataWeather) oldweather = pbGetMetadata(oldid,MapMetadata::WEATHER)
$game_screen.weather(weather[0],8,20) if weather && !oldweather && rand(100)<weather[1] $game_screen.weather(weather[0],8,20) if weather && !oldweather && rand(100)<weather[1]
end end
end end
@@ -444,7 +444,7 @@ Events.onMapSceneChange += proc { |_sender,e|
$PokemonGlobal.mapTrail[0] = $game_map.map_id $PokemonGlobal.mapTrail[0] = $game_map.map_id
end end
# Display darkness circle on dark maps # 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 darkmap
if $PokemonGlobal.flashUsed if $PokemonGlobal.flashUsed
$PokemonTemp.darknessSprite = DarknessSprite.new $PokemonTemp.darknessSprite = DarknessSprite.new
@@ -464,7 +464,7 @@ Events.onMapSceneChange += proc { |_sender,e|
end end
# Show location signpost # Show location signpost
if mapChanged if mapChanged
if pbGetMetadata($game_map.map_id,MetadataShowArea) if pbGetMetadata($game_map.map_id,MapMetadata::SHOW_AREA)
nosignpost = false nosignpost = false
if $PokemonGlobal.mapTrail[1] if $PokemonGlobal.mapTrail[1]
for i in 0...NO_SIGNPOSTS.length/2 for i in 0...NO_SIGNPOSTS.length/2
@@ -480,7 +480,7 @@ Events.onMapSceneChange += proc { |_sender,e|
end end
end end
# Force cycling/walking # Force cycling/walking
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways) if pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE_ALWAYS)
pbMountBike pbMountBike
elsif !pbCanUseBike?($game_map.map_id) elsif !pbCanUseBike?($game_map.map_id)
pbDismountBike pbDismountBike
@@ -698,7 +698,7 @@ def pbFishingBegin
$PokemonGlobal.fishing = true $PokemonGlobal.fishing = true
if !pbCommonEvent(FISHING_BEGIN_COMMON_EVENT) if !pbCommonEvent(FISHING_BEGIN_COMMON_EVENT)
patternb = 2*$game_player.direction - 1 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 num = ($PokemonGlobal.surfing) ? 7 : 6
if meta && meta[num] && meta[num]!="" if meta && meta[num] && meta[num]!=""
charset = pbGetPlayerCharset(meta,num) charset = pbGetPlayerCharset(meta,num)
@@ -717,7 +717,7 @@ end
def pbFishingEnd def pbFishingEnd
if !pbCommonEvent(FISHING_END_COMMON_EVENT) if !pbCommonEvent(FISHING_END_COMMON_EVENT)
patternb = 2*($game_player.direction - 2) 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 num = ($PokemonGlobal.surfing) ? 7 : 6
if meta && meta[num] && meta[num]!="" if meta && meta[num] && meta[num]!=""
charset = pbGetPlayerCharset(meta,num) charset = pbGetPlayerCharset(meta,num)
@@ -1223,7 +1223,7 @@ def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)
end end
def pbAutoplayOnTransition def pbAutoplayOnTransition
surfbgm = pbGetMetadata(0,MetadataSurfBGM) surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
if $PokemonGlobal.surfing && surfbgm if $PokemonGlobal.surfing && surfbgm
pbBGMPlay(surfbgm) pbBGMPlay(surfbgm)
else else
@@ -1232,7 +1232,7 @@ def pbAutoplayOnTransition
end end
def pbAutoplayOnSave def pbAutoplayOnSave
surfbgm = pbGetMetadata(0,MetadataSurfBGM) surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
if $PokemonGlobal.surfing && surfbgm if $PokemonGlobal.surfing && surfbgm
pbBGMPlay(surfbgm) pbBGMPlay(surfbgm)
else else

View File

@@ -276,7 +276,7 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
location = 3 location = 3
elsif $PokemonEncounters.isCave? elsif $PokemonEncounters.isCave?
location = 2 location = 2
elsif !pbGetMetadata($game_map.map_id,MetadataOutdoor) elsif !pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR)
location = 1 location = 1
end end
anim = "" anim = ""
@@ -653,7 +653,7 @@ def pbStartOver(gameover=false)
$scene.transfer_player if $scene.is_a?(Scene_Map) $scene.transfer_player if $scene.is_a?(Scene_Map)
$game_map.refresh $game_map.refresh
else else
homedata = pbGetMetadata(0,MetadataHome) homedata = pbGetMetadata(0,Metadata::HOME)
if homedata && !pbRxdataExists?(sprintf("Data/Map%03d",homedata[0])) if homedata && !pbRxdataExists?(sprintf("Data/Map%03d",homedata[0]))
if $DEBUG 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])) 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]))

View File

@@ -130,7 +130,7 @@ def pbPrepareBattle(battle)
elsif $PokemonGlobal.surfing elsif $PokemonGlobal.surfing
backdrop = "water" # This applies wherever you are, including in caves backdrop = "water" # This applies wherever you are, including in caves
else else
back = pbGetMetadata($game_map.map_id,MetadataBattleBack) back = pbGetMetadata($game_map.map_id,MapMetadata::BATTLE_BACK)
backdrop = back if back && back!="" backdrop = back if back && back!=""
end end
backdrop = "indoor1" if !backdrop backdrop = "indoor1" if !backdrop
@@ -151,7 +151,7 @@ def pbPrepareBattle(battle)
end end
battle.backdropBase = base if base battle.backdropBase = base if base
# Time of day # 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 battle.time = 2 # This makes Dusk Balls work properly in caves
elsif TIME_SHADING elsif TIME_SHADING
timeNow = pbGetTimeNow timeNow = pbGetTimeNow
@@ -165,7 +165,7 @@ end
# Used to determine the environment in battle, and also the form of Burmy/ # Used to determine the environment in battle, and also the form of Burmy/
# Wormadam. # Wormadam.
def pbGetEnvironment def pbGetEnvironment
ret = pbGetMetadata($game_map.map_id,MetadataEnvironment) ret = pbGetMetadata($game_map.map_id,MapMetadata::ENVIRONMENT)
ret = PBEnvironment::None if !ret ret = PBEnvironment::None if !ret
if $PokemonTemp.encounterType==EncounterTypes::OldRod || if $PokemonTemp.encounterType==EncounterTypes::OldRod ||
$PokemonTemp.encounterType==EncounterTypes::GoodRod || $PokemonTemp.encounterType==EncounterTypes::GoodRod ||

View File

@@ -183,7 +183,7 @@ EncounterModifier.register(proc { |encounter|
# are in the same region # are in the same region
if roamerMap!=$game_map.map_id if roamerMap!=$game_map.map_id
currentRegion = pbGetCurrentRegion 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) currentMapName = pbGetMessage(MessageTypes::MapNames,$game_map.map_id)
next if pbGetMessage(MessageTypes::MapNames,roamerMap)!=currentMapName next if pbGetMessage(MessageTypes::MapNames,roamerMap)!=currentMapName
end end

View File

@@ -555,7 +555,7 @@ end
Events.onMapCreate += proc { |_sender, e| Events.onMapCreate += proc { |_sender, e|
mapID=e[0] mapID=e[0]
map=e[1] map=e[1]
if pbGetMetadata(mapID,MetadataDungeon) if pbGetMetadata(mapID,MapMetadata::DUNGEON)
# this map is a randomly generated dungeon # this map is a randomly generated dungeon
dungeon=Dungeon.new(map.width,map.height) dungeon=Dungeon.new(map.width,map.height)
dungeon.generate dungeon.generate

View File

@@ -302,7 +302,7 @@ HiddenMoveHandlers::UseMove.add(:DIG,proc { |move,pokemon|
# Dive # Dive
#=============================================================================== #===============================================================================
def pbDive def pbDive
divemap = pbGetMetadata($game_map.map_id,MetadataDiveMap) divemap = pbGetMetadata($game_map.map_id,MapMetadata::DIVE_MAP)
return false if !divemap return false if !divemap
move = getID(PBMoves,:DIVE) move = getID(PBMoves,:DIVE)
movefinder = pbCheckMove(move) movefinder = pbCheckMove(move)
@@ -336,7 +336,7 @@ def pbSurfacing
divemap = nil divemap = nil
meta = pbLoadMetadata meta = pbLoadMetadata
for i in 0...meta.length 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 divemap = i; break
end end
end end
@@ -360,7 +360,7 @@ def pbSurfacing
$PokemonGlobal.diving = false $PokemonGlobal.diving = false
pbUpdateVehicle pbUpdateVehicle
$scene.transfer_player(false) $scene.transfer_player(false)
surfbgm = pbGetMetadata(0,MetadataSurfBGM) surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
(surfbgm) ? pbBGMPlay(surfbgm) : $game_map.autoplayAsCue (surfbgm) ? pbBGMPlay(surfbgm) : $game_map.autoplayAsCue
$game_map.refresh $game_map.refresh
} }
@@ -389,7 +389,7 @@ Events.onAction += proc { |_sender,_e|
divemap = nil divemap = nil
meta = pbLoadMetadata meta = pbLoadMetadata
for i in 0...meta.length 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 divemap = i; break
end end
end end
@@ -409,7 +409,7 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
divemap = nil divemap = nil
meta = pbLoadMetadata meta = pbLoadMetadata
for i in 0...meta.length 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 divemap = i; break
end end
end end
@@ -418,7 +418,7 @@ HiddenMoveHandlers::CanUseMove.add(:DIVE,proc { |move,pkmn,showmsg|
next false next false
end end
else 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 pbMessage(_INTL("Can't use that here.")) if showmsg
next false next false
end end
@@ -436,12 +436,12 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
divemap = nil divemap = nil
meta = pbLoadMetadata meta = pbLoadMetadata
for i in 0...meta.length 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 divemap = i; break
end end
end end
else else
divemap = pbGetMetadata($game_map.map_id,MetadataDiveMap) divemap = pbGetMetadata($game_map.map_id,MapMetadata::DIVE_MAP)
end end
next false if !divemap next false if !divemap
if !pbHiddenMoveAnimation(pokemon) if !pbHiddenMoveAnimation(pokemon)
@@ -469,7 +469,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE,proc { |move,pokemon|
#=============================================================================== #===============================================================================
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg| HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
next false if !pbCheckHiddenMoveBadge(BADGE_FOR_FLASH,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 pbMessage(_INTL("Can't use that here.")) if showmsg
next false next false
end 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 pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
next false next false
end 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 pbMessage(_INTL("Can't use that here.")) if showmsg
next false next false
end end
@@ -715,7 +715,7 @@ def pbSurf
pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move))) pbMessage(_INTL("{1} used {2}!",speciesname,PBMoves.getName(move)))
pbCancelVehicles pbCancelVehicles
pbHiddenMoveAnimation(movefinder) pbHiddenMoveAnimation(movefinder)
surfbgm = pbGetMetadata(0,MetadataSurfBGM) surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
pbCueBGM(surfbgm,0.5) if surfbgm pbCueBGM(surfbgm,0.5) if surfbgm
pbStartSurfing pbStartSurfing
return true return true
@@ -768,7 +768,7 @@ end
Events.onAction += proc { |_sender,_e| Events.onAction += proc { |_sender,_e|
next if $PokemonGlobal.surfing 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 !PBTerrain.isSurfable?(pbFacingTerrainTag)
next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player) next if !$game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
pbSurf 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 pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
next false next false
end 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 pbMessage(_INTL("Let's enjoy cycling!")) if showmsg
next false next false
end end
@@ -802,7 +802,7 @@ HiddenMoveHandlers::UseMove.add(:SURF,proc { |move,pokemon|
if !pbHiddenMoveAnimation(pokemon) if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move))) pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
end end
surfbgm = pbGetMetadata(0,MetadataSurfBGM) surfbgm = pbGetMetadata(0,Metadata::SURF_BGM)
pbCueBGM(surfbgm,0.5) if surfbgm pbCueBGM(surfbgm,0.5) if surfbgm
pbStartSurfing pbStartSurfing
next true next true
@@ -865,12 +865,12 @@ HiddenMoveHandlers::UseMove.add(:SWEETSCENT,proc { |move,pokemon|
# Teleport # Teleport
#=============================================================================== #===============================================================================
HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg| 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 pbMessage(_INTL("Can't use that here.")) if showmsg
next false next false
end end
healing = $PokemonGlobal.healingSpot healing = $PokemonGlobal.healingSpot
healing = pbGetMetadata(0,MetadataHome) if !healing # Home healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
if !healing if !healing
pbMessage(_INTL("Can't use that here.")) if showmsg pbMessage(_INTL("Can't use that here.")) if showmsg
next false next false
@@ -884,7 +884,7 @@ HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn| HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
healing = $PokemonGlobal.healingSpot healing = $PokemonGlobal.healingSpot
healing = pbGetMetadata(0,MetadataHome) if !healing # Home healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
next false if !healing next false if !healing
mapname = pbGetMapNameFromId(healing[0]) mapname = pbGetMapNameFromId(healing[0])
next pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname)) 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| HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
healing = $PokemonGlobal.healingSpot healing = $PokemonGlobal.healingSpot
healing = pbGetMetadata(0,MetadataHome) if !healing # Home healing = pbGetMetadata(0,Metadata::HOME) if !healing # Home
next false if !healing next false if !healing
if !pbHiddenMoveAnimation(pokemon) if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move))) pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))

View File

@@ -117,7 +117,7 @@ end
def pbDayNightTint(object) def pbDayNightTint(object)
return if !$scene.is_a?(Scene_Map) 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 tone = PBDayNight.getTone
object.tone.set(tone.red,tone.green,tone.blue,tone.gray) object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
else else

View File

@@ -572,14 +572,14 @@ def pbBikeCheck
return false return false
end end
if $PokemonGlobal.bicycle 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.")) pbMessage(_INTL("You can't dismount your Bike here."))
return false return false
end end
return true return true
end end
val = pbGetMetadata($game_map.map_id,MetadataBicycle) val = pbGetMetadata($game_map.map_id,MapMetadata::BICYCLE)
val = pbGetMetadata($game_map.map_id,MetadataOutdoor) if val==nil val = pbGetMetadata($game_map.map_id,MapMetadata::OUTDOOR) if val==nil
if !val if !val
pbMessage(_INTL("Can't use that here.")) pbMessage(_INTL("Can't use that here."))
return false return false

View File

@@ -66,11 +66,11 @@ end
def pbRandomPhoneTrainer def pbRandomPhoneTrainer
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers $PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
temparray = [] temparray = []
currentRegion = pbGetMetadata($game_map.map_id,MetadataMapPosition) currentRegion = pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
for num in $PokemonGlobal.phoneNumbers for num in $PokemonGlobal.phoneNumbers
next if !num[0] || num.length!=8 # if not visible or not a trainer 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 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 # Can't call if in different region
next if callerRegion && currentRegion && callerRegion[0]!=currentRegion[0] next if callerRegion && currentRegion && callerRegion[0]!=currentRegion[0]
temparray.push(num) temparray.push(num)
@@ -193,8 +193,8 @@ def pbCallTrainer(trtype,trname)
pbMessage(_INTL("The Trainer is close by.\nTalk to the Trainer in person!")) pbMessage(_INTL("The Trainer is close by.\nTalk to the Trainer in person!"))
return return
end end
callerregion = pbGetMetadata(trainer[6],MetadataMapPosition) callerregion = pbGetMetadata(trainer[6],MapMetadata::MAP_POSITION)
currentregion = pbGetMetadata($game_map.map_id,MetadataMapPosition) currentregion = pbGetMetadata($game_map.map_id,MapMetadata::MAP_POSITION)
if callerregion && currentregion && callerregion[0]!=currentregion[0] if callerregion && currentregion && callerregion[0]!=currentregion[0]
pbMessage(_INTL("The Trainer is out of range.")) pbMessage(_INTL("The Trainer is out of range."))
return # Can't call if in different region return # Can't call if in different region

View File

@@ -679,7 +679,7 @@ MultipleForms.register(:NECROZMA,{
MultipleForms.register(:PIKACHU,{ MultipleForms.register(:PIKACHU,{
"getForm" => proc { |pkmn| "getForm" => proc { |pkmn|
next if pkmn.formSimple>=2 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 1 if mapPos && mapPos[0]==1 # Tiall region
next 0 next 0
} }

View File

@@ -394,7 +394,7 @@ PBEvolution.register(:LevelDiving, {
PBEvolution.register(:LevelDarkness, { PBEvolution.register(:LevelDarkness, {
"levelUpCheck" => proc { |pkmn, parameter| "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, { PBEvolution.register(:Region, {
"minimumLevel" => 1, # Needs any level up "minimumLevel" => 1, # Needs any level up
"levelUpCheck" => proc { |pkmn, parameter| "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 next mapPos && mapPos[0] == parameter
} }
}) })

View File

@@ -27,7 +27,7 @@ class PokemonPokedexInfo_Scene
@sprites["infosprite"].x = 104 @sprites["infosprite"].x = 104
@sprites["infosprite"].y = 136 @sprites["infosprite"].y = 136
@mapdata = pbLoadTownMapData @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 if @region<0 # Use player's current region
@region = (mappos) ? mappos[0] : 0 # Region 0 default @region = (mappos) ? mappos[0] : 0 # Region 0 default
end end
@@ -311,7 +311,7 @@ class PokemonPokedexInfo_Scene
for enc in encdata.keys for enc in encdata.keys
enctypes = encdata[enc][1] enctypes = encdata[enc][1]
if pbFindEncounter(enctypes,@species) if pbFindEncounter(enctypes,@species)
mappos = pbGetMetadata(enc,MetadataMapPosition) mappos = pbGetMetadata(enc,MapMetadata::MAP_POSITION)
if mappos && mappos[0]==@region if mappos && mappos[0]==@region
showpoint = true showpoint = true
for loc in @mapdata[@region][2] for loc in @mapdata[@region][2]
@@ -319,7 +319,7 @@ class PokemonPokedexInfo_Scene
loc[7] && !$game_switches[loc[7]] loc[7] && !$game_switches[loc[7]]
end end
if showpoint if showpoint
mapsize = pbGetMetadata(enc,MetadataMapSize) mapsize = pbGetMetadata(enc,MapMetadata::MAP_SIZE)
if mapsize && mapsize[0] && mapsize[0]>0 if mapsize && mapsize[0] && mapsize[0]>0
sqwidth = mapsize[0] sqwidth = mapsize[0]
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil

View File

@@ -77,7 +77,7 @@ class PokemonRegionMap_Scene
@viewport.z = 99999 @viewport.z = 99999
@sprites = {} @sprites = {}
@mapdata = pbLoadTownMapData @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 if !playerpos
mapindex = 0 mapindex = 0
@map = @mapdata[0] @map = @mapdata[0]
@@ -93,7 +93,7 @@ class PokemonRegionMap_Scene
@map = @mapdata[playerpos[0]] @map = @mapdata[playerpos[0]]
@mapX = playerpos[1] @mapX = playerpos[1]
@mapY = playerpos[2] @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 if mapsize && mapsize[0] && mapsize[0]>0
sqwidth = mapsize[0] sqwidth = mapsize[0]
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil

View File

@@ -159,7 +159,7 @@ class PokemonLoad_Scene
def pbSetParty(trainer) def pbSetParty(trainer)
return if !trainer || !trainer.party return if !trainer || !trainer.party
meta = pbGetMetadata(0,MetadataPlayerA+trainer.metaID) meta = pbGetMetadata(0,Metadata::PLAYER_A+trainer.metaID)
if meta if meta
filename = pbGetPlayerCharset(meta,1,trainer,true) filename = pbGetPlayerCharset(meta,1,trainer,true)
@sprites["player"] = TrainerWalkingCharSprite.new(filename,@viewport) @sprites["player"] = TrainerWalkingCharSprite.new(filename,@viewport)

View File

@@ -62,7 +62,7 @@ def pbInSafari?
# map can be outdoors, with its own grassy patches. # map can be outdoors, with its own grassy patches.
reception = pbSafariState.pbReceptionMap reception = pbSafariState.pbReceptionMap
return true if $game_map.map_id==reception 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 end
return false return false
end end

View File

@@ -532,12 +532,12 @@ def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects
ret = nil ret = nil
if !ret if !ret
# Check map-specific metadata # 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!="" ret = pbStringToAudioFile(music) if music && music!=""
end end
if !ret if !ret
# Check global metadata # Check global metadata
music = pbGetMetadata(0,MetadataWildBattleBGM) music = pbGetMetadata(0,Metadata::WILD_BATTLE_BGM)
ret = pbStringToAudioFile(music) if music && music!="" ret = pbStringToAudioFile(music) if music && music!=""
end end
ret = pbStringToAudioFile("Battle wild") if !ret ret = pbStringToAudioFile("Battle wild") if !ret
@@ -551,12 +551,12 @@ def pbGetWildVictoryME
ret = nil ret = nil
if !ret if !ret
# Check map-specific metadata # 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!="" ret = pbStringToAudioFile(music) if music && music!=""
end end
if !ret if !ret
# Check global metadata # Check global metadata
music = pbGetMetadata(0,MetadataWildVictoryME) music = pbGetMetadata(0,Metadata::WILD_VICTORY_ME)
ret = pbStringToAudioFile(music) if music && music!="" ret = pbStringToAudioFile(music) if music && music!=""
end end
ret = pbStringToAudioFile("Battle victory") if !ret ret = pbStringToAudioFile("Battle victory") if !ret
@@ -571,12 +571,12 @@ def pbGetWildCaptureME
ret = nil ret = nil
if !ret if !ret
# Check map-specific metadata # 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!="" ret = pbStringToAudioFile(music) if music && music!=""
end end
if !ret if !ret
# Check global metadata # Check global metadata
music = pbGetMetadata(0,MetadataWildCaptureME) music = pbGetMetadata(0,Metadata::WILD_CAPTURE_ME)
ret = pbStringToAudioFile(music) if music && music!="" ret = pbStringToAudioFile(music) if music && music!=""
end end
ret = pbStringToAudioFile("Battle capture success") if !ret 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!="" ret = pbStringToAudioFile(music) if music && music!=""
if !ret if !ret
# Check map-specific metadata # Check map-specific metadata
music = pbGetMetadata($game_map.map_id,MetadataMapTrainerBattleBGM) music = pbGetMetadata($game_map.map_id,MapMetadata::TRAINER_BATTLE_BGM)
if music && music!="" if music && music!=""
ret = pbStringToAudioFile(music) ret = pbStringToAudioFile(music)
end end
end end
if !ret if !ret
# Check global metadata # Check global metadata
music = pbGetMetadata(0,MetadataTrainerBattleBGM) music = pbGetMetadata(0,Metadata::TRAINER_BATTLE_BGM)
if music && music!="" if music && music!=""
ret = pbStringToAudioFile(music) ret = pbStringToAudioFile(music)
end end
@@ -635,12 +635,12 @@ def pbGetTrainerBattleBGMFromType(trainertype)
ret = pbStringToAudioFile(data[4]) if data && data[4] ret = pbStringToAudioFile(data[4]) if data && data[4]
if !ret if !ret
# Check map-specific metadata # 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!="" ret = pbStringToAudioFile(music) if music && music!=""
end end
if !ret if !ret
# Check global metadata # Check global metadata
music = pbGetMetadata(0,MetadataTrainerBattleBGM) music = pbGetMetadata(0,Metadata::TRAINER_BATTLE_BGM)
ret = pbStringToAudioFile(music) if music && music!="" ret = pbStringToAudioFile(music) if music && music!=""
end end
ret = pbStringToAudioFile("Battle trainer") if !ret ret = pbStringToAudioFile("Battle trainer") if !ret
@@ -663,14 +663,14 @@ def pbGetTrainerVictoryME(trainer) # can be a PokeBattle_Trainer or an array o
end end
if !ret if !ret
# Check map-specific metadata # Check map-specific metadata
music = pbGetMetadata($game_map.map_id,MetadataMapTrainerVictoryME) music = pbGetMetadata($game_map.map_id,MapMetadata::TRAINER_VICTORY_ME)
if music && music!="" if music && music!=""
ret = pbStringToAudioFile(music) ret = pbStringToAudioFile(music)
end end
end end
if !ret if !ret
# Check global metadata # Check global metadata
music = pbGetMetadata(0,MetadataTrainerVictoryME) music = pbGetMetadata(0,Metadata::TRAINER_VICTORY_ME)
if music && music!="" if music && music!=""
ret = pbStringToAudioFile(music) ret = pbStringToAudioFile(music)
end end

View File

@@ -666,7 +666,7 @@ end
#=============================================================================== #===============================================================================
def pbChangePlayer(id) def pbChangePlayer(id)
return false if id<0 || id>=8 return false if id<0 || id>=8
meta = pbGetMetadata(0,MetadataPlayerA+id) meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
return false if !meta return false if !meta
$Trainer.trainertype = meta[0] if $Trainer $Trainer.trainertype = meta[0] if $Trainer
$game_player.character_name = meta[1] $game_player.character_name = meta[1]
@@ -678,7 +678,7 @@ end
def pbGetPlayerGraphic def pbGetPlayerGraphic
id = $PokemonGlobal.playerID id = $PokemonGlobal.playerID
return "" if id<0 || id>=8 return "" if id<0 || id>=8
meta = pbGetMetadata(0,MetadataPlayerA+id) meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
return "" if !meta return "" if !meta
return pbPlayerSpriteFile(meta[0]) return pbPlayerSpriteFile(meta[0])
end end
@@ -686,7 +686,7 @@ end
def pbGetPlayerTrainerType def pbGetPlayerTrainerType
id = $PokemonGlobal.playerID id = $PokemonGlobal.playerID
return 0 if id<0 || id>=8 return 0 if id<0 || id>=8
meta = pbGetMetadata(0,MetadataPlayerA+id) meta = pbGetMetadata(0,Metadata::PLAYER_A+id)
return 0 if !meta return 0 if !meta
return meta[0] return meta[0]
end end
@@ -868,7 +868,7 @@ end
# no region was defined in the game's metadata. The ID numbers returned by # no region was defined in the game's metadata. The ID numbers returned by
# this function depend on the current map's position metadata. # this function depend on the current map's position metadata.
def pbGetCurrentRegion(defaultRegion=-1) 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 return (mappos) ? mappos[0] : defaultRegion
end end

View File

@@ -683,7 +683,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
when "setplayer" when "setplayer"
limit = 0 limit = 0
for i in 0...8 for i in 0...8
meta = pbGetMetadata(0,MetadataPlayerA+i) meta = pbGetMetadata(0,Metadata::PLAYER_A+i)
if !meta if !meta
limit = i; break limit = i; break
end end

View File

@@ -197,12 +197,12 @@ def pbSerializeMetadata(metadata,mapinfos)
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
f.write(sprintf("[%03d]\r\n",i)) f.write(sprintf("[%03d]\r\n",i))
if i==0 if i==0
types = PokemonMetadata::GlobalTypes types = Metadata::SCHEMA
else else
if mapinfos && mapinfos[i] if mapinfos && mapinfos[i]
f.write(sprintf("# %s\r\n",mapinfos[i].name)) f.write(sprintf("# %s\r\n",mapinfos[i].name))
end end
types = PokemonMetadata::NonGlobalTypes types = MapMetadata::SCHEMA
end end
for key in types.keys for key in types.keys
schema = types[key] schema = types[key]

View File

@@ -12,10 +12,10 @@ def pbCompileMetadata
if line[/^\s*\[\s*(\d+)\s*\]\s*$/] if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
sectionname = $~[1] sectionname = $~[1]
if currentmap==0 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) raise _INTL("The entry Home is required in metadata.txt section [{1}]",sectionname)
end 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) raise _INTL("The entry PlayerA is required in metadata.txt section [{1}]",sectionname)
end end
end end
@@ -32,9 +32,9 @@ def pbCompileMetadata
schema = nil schema = nil
FileLineData.setSection(currentmap,matchData[1],matchData[2]) FileLineData.setSection(currentmap,matchData[1],matchData[2])
if currentmap==0 if currentmap==0
schema = PokemonMetadata::GlobalTypes[matchData[1]] schema = Metadata::SCHEMA[matchData[1]]
else else
schema = PokemonMetadata::NonGlobalTypes[matchData[1]] schema = MapMetadata::SCHEMA[matchData[1]]
end end
if schema if schema
record = pbGetCsvRecord(matchData[2],lineno,schema) record = pbGetCsvRecord(matchData[2],lineno,schema)