diff --git a/Data/Scripts/003_Game classes/007_Game_Player.rb b/Data/Scripts/003_Game classes/007_Game_Player.rb index c1e50de57..6b533ec47 100644 --- a/Data/Scripts/003_Game classes/007_Game_Player.rb +++ b/Data/Scripts/003_Game classes/007_Game_Player.rb @@ -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 diff --git a/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb b/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb index e920d7595..ee7dae54b 100644 --- a/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb +++ b/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb @@ -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]!="" diff --git a/Data/Scripts/003_Game classes/009_Game_Map.rb b/Data/Scripts/003_Game classes/009_Game_Map.rb index fb949c0a0..acf9b2fa6 100644 --- a/Data/Scripts/003_Game classes/009_Game_Map.rb +++ b/Data/Scripts/003_Game classes/009_Game_Map.rb @@ -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 diff --git a/Data/Scripts/009_Objects and windows/008_TextEntry.rb b/Data/Scripts/009_Objects and windows/008_TextEntry.rb index c1b646a59..ae8800fae 100644 --- a/Data/Scripts/009_Objects and windows/008_TextEntry.rb +++ b/Data/Scripts/009_Objects and windows/008_TextEntry.rb @@ -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") diff --git a/Data/Scripts/011_Data/002_Misc_Data.rb b/Data/Scripts/011_Data/002_Misc_Data.rb index ecf35fdad..9a71da1e9 100644 --- a/Data/Scripts/011_Data/002_Misc_Data.rb +++ b/Data/Scripts/011_Data/002_Misc_Data.rb @@ -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 diff --git a/Data/Scripts/013_Overworld/002_PField_Field.rb b/Data/Scripts/013_Overworld/002_PField_Field.rb index 344f38f16..51de4906e 100644 --- a/Data/Scripts/013_Overworld/002_PField_Field.rb +++ b/Data/Scripts/013_Overworld/002_PField_Field.rb @@ -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) 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 } diff --git a/Data/Scripts/016_Pokemon/005_Pokemon_Evolution.rb b/Data/Scripts/016_Pokemon/005_Pokemon_Evolution.rb index 5761e5aa8..21a334bf4 100644 --- a/Data/Scripts/016_Pokemon/005_Pokemon_Evolution.rb +++ b/Data/Scripts/016_Pokemon/005_Pokemon_Evolution.rb @@ -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 } }) diff --git a/Data/Scripts/017_UI/004_PScreen_PokedexEntry.rb b/Data/Scripts/017_UI/004_PScreen_PokedexEntry.rb index 031434d56..2d625cba5 100644 --- a/Data/Scripts/017_UI/004_PScreen_PokedexEntry.rb +++ b/Data/Scripts/017_UI/004_PScreen_PokedexEntry.rb @@ -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 diff --git a/Data/Scripts/017_UI/009_PScreen_RegionMap.rb b/Data/Scripts/017_UI/009_PScreen_RegionMap.rb index 621947e03..ad6854aca 100644 --- a/Data/Scripts/017_UI/009_PScreen_RegionMap.rb +++ b/Data/Scripts/017_UI/009_PScreen_RegionMap.rb @@ -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 diff --git a/Data/Scripts/017_UI/013_PScreen_Load.rb b/Data/Scripts/017_UI/013_PScreen_Load.rb index 9db9aaf7d..121d1152a 100644 --- a/Data/Scripts/017_UI/013_PScreen_Load.rb +++ b/Data/Scripts/017_UI/013_PScreen_Load.rb @@ -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) diff --git a/Data/Scripts/019_Other battles/001_PBattle_Safari.rb b/Data/Scripts/019_Other battles/001_PBattle_Safari.rb index a543758d7..c518660ea 100644 --- a/Data/Scripts/019_Other battles/001_PBattle_Safari.rb +++ b/Data/Scripts/019_Other battles/001_PBattle_Safari.rb @@ -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 diff --git a/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb b/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb index 7f45d85a6..8daded929 100644 --- a/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb +++ b/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb @@ -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 diff --git a/Data/Scripts/020_System and utilities/005_PSystem_Utilities.rb b/Data/Scripts/020_System and utilities/005_PSystem_Utilities.rb index 73598486b..0e7cda3aa 100644 --- a/Data/Scripts/020_System and utilities/005_PSystem_Utilities.rb +++ b/Data/Scripts/020_System and utilities/005_PSystem_Utilities.rb @@ -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 diff --git a/Data/Scripts/021_Debug/001_Debug_Menu.rb b/Data/Scripts/021_Debug/001_Debug_Menu.rb index d75f1d37d..b80247709 100644 --- a/Data/Scripts/021_Debug/001_Debug_Menu.rb +++ b/Data/Scripts/021_Debug/001_Debug_Menu.rb @@ -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 diff --git a/Data/Scripts/021_Debug/005_Editor_SaveData.rb b/Data/Scripts/021_Debug/005_Editor_SaveData.rb index 9fe7fe749..1122c379f 100644 --- a/Data/Scripts/021_Debug/005_Editor_SaveData.rb +++ b/Data/Scripts/021_Debug/005_Editor_SaveData.rb @@ -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] diff --git a/Data/Scripts/022_Compiler/002_Compiler_PBS.rb b/Data/Scripts/022_Compiler/002_Compiler_PBS.rb index 100c20cfd..af148ec68 100644 --- a/Data/Scripts/022_Compiler/002_Compiler_PBS.rb +++ b/Data/Scripts/022_Compiler/002_Compiler_PBS.rb @@ -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)