From 9d50b27aa02f01f5254eb3328ad6e728be9f178d Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 2 Apr 2023 00:52:12 +0100 Subject: [PATCH 1/9] Fixed some bad usage of sprintf, cleaned up some translatable messages --- .../001_Technical/002_Files/001_FileTests.rb | 2 +- .../001_Technical/003_Intl_Messages.rb | 4 ++-- .../004_Scene/002_Scene_Initialize.rb | 10 +++++----- .../004_BattleArenaBattle.rb | 4 ++-- .../003_Overworld_MapTransitionAnims.rb | 12 +++++++---- .../012_Overworld/005_Overworld_Fishing.rb | 2 +- Data/Scripts/013_Items/001_Item_Utilities.rb | 4 ++-- .../001_Pokemon-related/001_FormHandlers.rb | 2 +- .../003_UI_EggHatching.rb | 2 +- .../004_UI_Evolution.rb | 2 +- Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb | 4 ++-- Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb | 2 +- Data/Scripts/016_UI/006_UI_Summary.rb | 14 ++++++------- Data/Scripts/016_UI/007_UI_Bag.rb | 8 ++++---- Data/Scripts/016_UI/008_UI_Pokegear.rb | 6 +++--- Data/Scripts/016_UI/012_UI_TrainerCard.rb | 4 ++-- Data/Scripts/016_UI/014_UI_Save.rb | 9 +++++---- Data/Scripts/016_UI/015_UI_Options.rb | 2 +- Data/Scripts/016_UI/022_UI_MoveRelearner.rb | 2 +- Data/Scripts/016_UI/024_UI_MysteryGift.rb | 2 +- Data/Scripts/016_UI/025_UI_TextEntry.rb | 2 +- .../017_Minigames/003_Minigame_SlotMachine.rb | 20 +++++++++---------- .../017_Minigames/006_Minigame_Mining.rb | 2 +- .../001_Editor screens/001_EditorScreens.rb | 4 ++-- .../002_EditorScreens_TerrainTags.rb | 2 +- .../003_EditorScreens_MapConnections.rb | 12 +++++------ .../005_AnimEditor_Functions.rb | 10 ++++------ .../Scripts/020_Debug/002_Editor_DataTypes.rb | 8 ++++---- .../004_Debug_BattleCommands.rb | 4 ++-- Data/Scripts/021_Compiler/001_Compiler.rb | 6 +++--- .../021_Compiler/003_Compiler_WritePBS.rb | 2 +- .../004_Compiler_MapsAndEvents.rb | 2 +- 32 files changed, 87 insertions(+), 84 deletions(-) diff --git a/Data/Scripts/001_Technical/002_Files/001_FileTests.rb b/Data/Scripts/001_Technical/002_Files/001_FileTests.rb index 2ad061d9a..e47d86d42 100644 --- a/Data/Scripts/001_Technical/002_Files/001_FileTests.rb +++ b/Data/Scripts/001_Technical/002_Files/001_FileTests.rb @@ -317,7 +317,7 @@ end # NOTE: load_data checks anything added in MKXP's RTP setting, and matching # mount points added through System.mount. def pbRgssOpen(file, mode = nil) - # File.open("debug.txt","ab") { |fw| fw.write([file,mode,Time.now.to_f].inspect+"\r\n") } + # File.open("debug.txt", "ab") { |fw| fw.write([file, mode, Time.now.to_f].inspect + "\r\n") } if !safeExists?("./Game.rgssad") if block_given? File.open(file, mode) { |f| yield f } diff --git a/Data/Scripts/001_Technical/003_Intl_Messages.rb b/Data/Scripts/001_Technical/003_Intl_Messages.rb index 3a8d01416..3583e8c02 100644 --- a/Data/Scripts/001_Technical/003_Intl_Messages.rb +++ b/Data/Scripts/001_Technical/003_Intl_Messages.rb @@ -284,8 +284,8 @@ module Translator f.write(0xEF.chr) f.write(0xBB.chr) f.write(0xBF.chr) - f.write("# To localize this text for a particular language, please\r\n") - f.write("# translate every second line of this file.\r\n") + f.write("# To localize this text for a particular language, please" + "\r\n") + f.write("# translate every second line of this file." + "\r\n") f.write("\#-------------------------------\r\n") if with_line end # Extract the text diff --git a/Data/Scripts/011_Battle/004_Scene/002_Scene_Initialize.rb b/Data/Scripts/011_Battle/004_Scene/002_Scene_Initialize.rb index a27a34a9a..3861bd6d9 100644 --- a/Data/Scripts/011_Battle/004_Scene/002_Scene_Initialize.rb +++ b/Data/Scripts/011_Battle/004_Scene/002_Scene_Initialize.rb @@ -104,24 +104,24 @@ class Battle::Scene messageFilename = @battle.backdrop if time trialName = sprintf("%s_%s", backdropFilename, time) - if pbResolveBitmap(sprintf("Graphics/Battlebacks/" + trialName + "_bg")) + if pbResolveBitmap(sprintf("Graphics/Battlebacks/%s_bg", trialName)) backdropFilename = trialName end trialName = sprintf("%s_%s", baseFilename, time) - if pbResolveBitmap(sprintf("Graphics/Battlebacks/" + trialName + "_base0")) + if pbResolveBitmap(sprintf("Graphics/Battlebacks/%s_base0", trialName)) baseFilename = trialName end trialName = sprintf("%s_%s", messageFilename, time) - if pbResolveBitmap(sprintf("Graphics/Battlebacks/" + trialName + "_message")) + if pbResolveBitmap(sprintf("Graphics/Battlebacks/%s_message", trialName)) messageFilename = trialName end end - if !pbResolveBitmap(sprintf("Graphics/Battlebacks/" + baseFilename + "_base0")) && + if !pbResolveBitmap(sprintf("Graphics/Battlebacks/%s_base0", baseFilename)) && @battle.backdropBase baseFilename = @battle.backdropBase if time trialName = sprintf("%s_%s", baseFilename, time) - if pbResolveBitmap(sprintf("Graphics/Battlebacks/" + trialName + "_base0")) + if pbResolveBitmap(sprintf("Graphics/Battlebacks/%s_base0", trialName)) baseFilename = trialName end end diff --git a/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb b/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb index 4d166dfdc..9b4109f64 100644 --- a/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb +++ b/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb @@ -241,9 +241,9 @@ class Battle::Scene [_INTL("Mind"), 144, 54, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], [_INTL("Skill"), 144, 86, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], [_INTL("Body"), 144, 118, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [sprintf("%d", total1), 64, 166, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [total1.to_s, 64, 166, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], [_INTL("Judgment"), 144, 166, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [sprintf("%d", total2), 224, 166, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)] + [total2.to_s, 224, 166, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)] ] pbDrawTextPositions(window.contents, textpos) images = [] diff --git a/Data/Scripts/012_Overworld/001_Overworld visuals/003_Overworld_MapTransitionAnims.rb b/Data/Scripts/012_Overworld/001_Overworld visuals/003_Overworld_MapTransitionAnims.rb index 2be66888c..ce2c3c841 100644 --- a/Data/Scripts/012_Overworld/001_Overworld visuals/003_Overworld_MapTransitionAnims.rb +++ b/Data/Scripts/012_Overworld/001_Overworld visuals/003_Overworld_MapTransitionAnims.rb @@ -88,9 +88,11 @@ def pbStartOver(gameover = false) $player.heal_party if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId >= 0 if gameover - pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back to a Pokémon Center.")) + pbMessage("\\w[]\\wm\\c[8]\\l[3]" + + _INTL("After the unfortunate defeat, you scurry back to a Pokémon Center.")) else - pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back to a Pokémon Center, protecting your exhausted Pokémon from any further harm...")) + pbMessage("\\w[]\\wm\\c[8]\\l[3]" + + _INTL("You scurry back to a Pokémon Center, protecting your exhausted Pokémon from any further harm...")) end pbCancelVehicles Followers.clear @@ -113,9 +115,11 @@ def pbStartOver(gameover = false) return end if gameover - pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back home.")) + pbMessage("\\w[]\\wm\\c[8]\\l[3]" + + _INTL("After the unfortunate defeat, you scurry back home.")) else - pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back home, protecting your exhausted Pokémon from any further harm...")) + pbMessage("\\w[]\\wm\\c[8]\\l[3]" + + _INTL("You scurry back home, protecting your exhausted Pokémon from any further harm...")) end if homedata pbCancelVehicles diff --git a/Data/Scripts/012_Overworld/005_Overworld_Fishing.rb b/Data/Scripts/012_Overworld/005_Overworld_Fishing.rb index cdbea7723..04dc25792 100644 --- a/Data/Scripts/012_Overworld/005_Overworld_Fishing.rb +++ b/Data/Scripts/012_Overworld/005_Overworld_Fishing.rb @@ -56,7 +56,7 @@ def pbFishing(hasEncounter, rodType = 1) if hasEncounter && rand(100) < biteChance $scene.spriteset.addUserAnimation(Settings::EXCLAMATION_ANIMATION_ID, $game_player.x, $game_player.y, true, 3) frames = Graphics.frame_rate - rand(Graphics.frame_rate / 2) # 0.5-1 second - if !pbWaitForInput(msgWindow, message + _INTL("\r\nOh! A bite!"), frames) + if !pbWaitForInput(msgWindow, message + "\r\n" + _INTL("Oh! A bite!"), frames) pbFishingEnd { pbMessageDisplay(msgWindow, _INTL("The Pokémon got away...")) } break end diff --git a/Data/Scripts/013_Items/001_Item_Utilities.rb b/Data/Scripts/013_Items/001_Item_Utilities.rb index df70d1125..8062f7f0e 100644 --- a/Data/Scripts/013_Items/001_Item_Utilities.rb +++ b/Data/Scripts/013_Items/001_Item_Utilities.rb @@ -591,7 +591,7 @@ def pbLearnMove(pkmn, move, ignore_if_known = false, by_machine = false, &block) return false elsif pkmn.numMoves < Pokemon::MAX_MOVES pkmn.learn_move(move) - pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]", pkmn_name, move_name), &block) + pbMessage("\\se[]" + _INTL("{1} learned {2}!\\se[Pkmn move learnt]", pkmn_name, move_name), &block) return true end pbMessage(_INTL("{1} wants to learn {2}, but it already knows {3} moves.\1", @@ -608,7 +608,7 @@ def pbLearnMove(pkmn, move, ignore_if_known = false, by_machine = false, &block) end pbMessage(_INTL("1, 2, and...\\wt[16] ...\\wt[16] ...\\wt[16] Ta-da!\\se[Battle ball drop]\1"), &block) pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1", pkmn_name, old_move_name), &block) - pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]", pkmn_name, move_name), &block) + pbMessage("\\se[]" + _INTL("{1} learned {2}!\\se[Pkmn move learnt]", pkmn_name, move_name), &block) pkmn.changeHappiness("machine") if by_machine return true elsif pbConfirmMessage(_INTL("Give up on learning {1}?", move_name), &block) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb index 316dacbf3..8c401e24b 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb @@ -255,7 +255,7 @@ MultipleForms.register(:ROTOM, { pkmn.moves[old_move_index].id = new_move_id new_move_name = pkmn.moves[old_move_index].name pbMessage(_INTL("{1} forgot {2}...\1", pkmn.name, old_move_name)) - pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]\1", pkmn.name, new_move_name)) + pbMessage("\\se[]" + _INTL("{1} learned {2}!\\se[Pkmn move learnt]\1", pkmn.name, new_move_name)) end elsif !new_move_id.nil? # Just learn the new move diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb index eebf4a48d..c5cce55c4 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb @@ -99,7 +99,7 @@ class PokemonEggHatch_Scene pbBGMStop pbMEPlay("Evolution success") @pokemon.name = nil - pbMessage(_INTL("\\se[]{1} hatched from the Egg!\\wt[80]", @pokemon.name)) { update } + pbMessage("\\se[]" + _INTL("{1} hatched from the Egg!\\wt[80]", @pokemon.name)) { update } # Record the Pokémon's species as owned in the Pokédex was_owned = $player.owned?(@pokemon.species) $player.pokedex.register(@pokemon) diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb index 87e2dd73d..0e10ba0e4 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb @@ -591,7 +591,7 @@ class PokemonEvolutionScene pbMEPlay("Evolution success") newspeciesname = GameData::Species.get(@newspecies).name pbMessageDisplay(@sprites["msgwindow"], - _INTL("\\se[]Congratulations! Your {1} evolved into {2}!\\wt[80]", + "\\se[]" + _INTL("Congratulations! Your {1} evolved into {2}!\\wt[80]", @pokemon.name, newspeciesname)) { pbUpdate } @sprites["msgwindow"].text = "" # Check for consumed item and check if Pokémon should be duplicated diff --git a/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb b/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb index 72328430d..1ae27445c 100644 --- a/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb +++ b/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb @@ -18,9 +18,9 @@ class Window_DexesList < Window_CommandPokemon super(index, count, rect) if index >= 0 && index < @commands2.length pbDrawShadowText(self.contents, rect.x + 254, rect.y, 64, rect.height, - sprintf("%d", @commands2[index][0]), self.baseColor, self.shadowColor, 1) + @commands2[index][0].to_s, self.baseColor, self.shadowColor, 1) pbDrawShadowText(self.contents, rect.x + 350, rect.y, 64, rect.height, - sprintf("%d", @commands2[index][1]), self.baseColor, self.shadowColor, 1) + @commands2[index][1].to_s, self.baseColor, self.shadowColor, 1) allseen = (@commands2[index][0] >= @commands2[index][2]) allown = (@commands2[index][1] >= @commands2[index][2]) pbDrawImagePositions( diff --git a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb index 7f9afac2a..397d37a16 100644 --- a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb +++ b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb @@ -376,7 +376,7 @@ class PokemonPokedexInfo_Scene if points.length == 0 pbDrawImagePositions( overlay, - [[sprintf("Graphics/UI/Pokedex/overlay_areanone"), 108, 188]] + [["Graphics/UI/Pokedex/overlay_areanone", 108, 188]] ) textpos.push([_INTL("Area unknown"), Graphics.width / 2, (Graphics.height / 2) + 6, 2, base, shadow]) end diff --git a/Data/Scripts/016_UI/006_UI_Summary.rb b/Data/Scripts/016_UI/006_UI_Summary.rb index 6c79f1fad..f432f50a8 100644 --- a/Data/Scripts/016_UI/006_UI_Summary.rb +++ b/Data/Scripts/016_UI/006_UI_Summary.rb @@ -325,10 +325,10 @@ class PokemonSummary_Scene end # Show Pokérus cured icon if @pokemon.pokerusStage == 2 - imagepos.push([sprintf("Graphics/UI/Summary/icon_pokerus"), 176, 100]) + imagepos.push(["Graphics/UI/Summary/icon_pokerus", 176, 100]) end # Show shininess star - imagepos.push([sprintf("Graphics/UI/shiny"), 2, 134]) if @pokemon.shiny? + imagepos.push(["Graphics/UI/shiny", 2, 134]) if @pokemon.shiny? # Draw all images pbDrawImagePositions(overlay, imagepos) # Write various bits of text @@ -640,15 +640,15 @@ class PokemonSummary_Scene [_INTL("HP"), 292, 82, 2, base, statshadows[:HP]], [sprintf("%d/%d", @pokemon.hp, @pokemon.totalhp), 462, 82, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], [_INTL("Attack"), 248, 126, 0, base, statshadows[:ATTACK]], - [sprintf("%d", @pokemon.attack), 456, 126, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [@pokemon.attack.to_s, 456, 126, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], [_INTL("Defense"), 248, 158, 0, base, statshadows[:DEFENSE]], - [sprintf("%d", @pokemon.defense), 456, 158, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [@pokemon.defense.to_s, 456, 158, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], [_INTL("Sp. Atk"), 248, 190, 0, base, statshadows[:SPECIAL_ATTACK]], - [sprintf("%d", @pokemon.spatk), 456, 190, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [@pokemon.spatk.to_s, 456, 190, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], [_INTL("Sp. Def"), 248, 222, 0, base, statshadows[:SPECIAL_DEFENSE]], - [sprintf("%d", @pokemon.spdef), 456, 222, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [@pokemon.spdef.to_s, 456, 222, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], [_INTL("Speed"), 248, 254, 0, base, statshadows[:SPEED]], - [sprintf("%d", @pokemon.speed), 456, 254, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [@pokemon.speed.to_s, 456, 254, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], [_INTL("Ability"), 224, 290, 0, base, shadow] ] # Draw ability name and description diff --git a/Data/Scripts/016_UI/007_UI_Bag.rb b/Data/Scripts/016_UI/007_UI_Bag.rb index fc3d110c5..9df1b0190 100644 --- a/Data/Scripts/016_UI/007_UI_Bag.rb +++ b/Data/Scripts/016_UI/007_UI_Bag.rb @@ -258,13 +258,13 @@ class PokemonBag_Scene def pbRefresh # Set the background image - @sprites["background"].setBitmap(sprintf("Graphics/UI/Bag/bg_#{@bag.last_viewed_pocket}")) + @sprites["background"].setBitmap(sprintf("Graphics/UI/Bag/bg_%d", @bag.last_viewed_pocket)) # Set the bag sprite - fbagexists = pbResolveBitmap(sprintf("Graphics/UI/Bag/bag_#{@bag.last_viewed_pocket}_f")) + fbagexists = pbResolveBitmap(sprintf("Graphics/UI/Bag/bag_%d_f", @bag.last_viewed_pocket)) if $player.female? && fbagexists - @sprites["bagsprite"].setBitmap("Graphics/UI/Bag/bag_#{@bag.last_viewed_pocket}_f") + @sprites["bagsprite"].setBitmap(sprintf("Graphics/UI/Bag/bag_%d_f", @bag.last_viewed_pocket")) else - @sprites["bagsprite"].setBitmap("Graphics/UI/Bag/bag_#{@bag.last_viewed_pocket}") + @sprites["bagsprite"].setBitmap(sprintf("Graphics/UI/Bag/bag_%d", @bag.last_viewed_pocket)) end # Draw the pocket icons @sprites["pocketicon"].bitmap.clear diff --git a/Data/Scripts/016_UI/008_UI_Pokegear.rb b/Data/Scripts/016_UI/008_UI_Pokegear.rb index 07950eaea..9a6cc5889 100644 --- a/Data/Scripts/016_UI/008_UI_Pokegear.rb +++ b/Data/Scripts/016_UI/008_UI_Pokegear.rb @@ -14,7 +14,7 @@ class PokegearButton < Sprite @image = command[0] @name = command[1] @selected = false - if $player.female? && pbResolveBitmap(sprintf("Graphics/UI/Pokegear/icon_button_f")) + if $player.female? && pbResolveBitmap("Graphics/UI/Pokegear/icon_button_f") @button = AnimatedBitmap.new("Graphics/UI/Pokegear/icon_button_f") else @button = AnimatedBitmap.new("Graphics/UI/Pokegear/icon_button") @@ -49,7 +49,7 @@ class PokegearButton < Sprite ] pbDrawTextPositions(self.bitmap, textpos) imagepos = [ - [sprintf("Graphics/UI/Pokegear/icon_" + @image), 18, 10] + [sprintf("Graphics/UI/Pokegear/icon_%s", @image), 18, 10] ] pbDrawImagePositions(self.bitmap, imagepos) end @@ -73,7 +73,7 @@ class PokemonPokegear_Scene @viewport.z = 99999 @sprites = {} @sprites["background"] = IconSprite.new(0, 0, @viewport) - if $player.female? && pbResolveBitmap(sprintf("Graphics/UI/Pokegear/bg_f")) + if $player.female? && pbResolveBitmap("Graphics/UI/Pokegear/bg_f") @sprites["background"].setBitmap("Graphics/UI/Pokegear/bg_f") else @sprites["background"].setBitmap("Graphics/UI/Pokegear/bg") diff --git a/Data/Scripts/016_UI/012_UI_TrainerCard.rb b/Data/Scripts/016_UI/012_UI_TrainerCard.rb index e06641060..a06e45686 100644 --- a/Data/Scripts/016_UI/012_UI_TrainerCard.rb +++ b/Data/Scripts/016_UI/012_UI_TrainerCard.rb @@ -10,13 +10,13 @@ class PokemonTrainerCard_Scene @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport.z = 99999 @sprites = {} - background = pbResolveBitmap(sprintf("Graphics/UI/Trainer Card/bg_f")) + background = pbResolveBitmap("Graphics/UI/Trainer Card/bg_f") if $player.female? && background addBackgroundPlane(@sprites, "bg", "Trainer Card/bg_f", @viewport) else addBackgroundPlane(@sprites, "bg", "Trainer Card/bg", @viewport) end - cardexists = pbResolveBitmap(sprintf("Graphics/UI/Trainer Card/card_f")) + cardexists = pbResolveBitmap("Graphics/UI/Trainer Card/card_f") @sprites["card"] = IconSprite.new(0, 0, @viewport) if $player.female? && cardexists @sprites["card"].setBitmap("Graphics/UI/Trainer Card/card_f") diff --git a/Data/Scripts/016_UI/014_UI_Save.rb b/Data/Scripts/016_UI/014_UI_Save.rb index 38c168f7d..d455efabf 100644 --- a/Data/Scripts/016_UI/014_UI_Save.rb +++ b/Data/Scripts/016_UI/014_UI_Save.rb @@ -15,9 +15,10 @@ def pbEmergencySave end end if Game.save - pbMessage(_INTL("\\se[]The game was saved.\\me[GUI save game] The previous save file has been backed up.\\wtnp[30]")) + pbMessage("\\se[]" + + _INTL("The game was saved.\\me[GUI save game] The previous save file has been backed up.\\wtnp[30]")) else - pbMessage(_INTL("\\se[]Save failed.\\wtnp[30]")) + pbMessage("\\se[]" + _INTL("Save failed.\\wtnp[30]")) end $scene = oldscene end @@ -98,10 +99,10 @@ class PokemonSaveScreen $game_temp.begun_new_game = false pbSEPlay("GUI save choice") if Game.save - pbMessage(_INTL("\\se[]{1} saved the game.\\me[GUI save game]\\wtnp[30]", $player.name)) + pbMessage("\\se[]" +_INTL("{1} saved the game.\\me[GUI save game]\\wtnp[30]", $player.name)) ret = true else - pbMessage(_INTL("\\se[]Save failed.\\wtnp[30]")) + pbMessage("\\se[]" +_INTL("Save failed.\\wtnp[30]")) ret = false end else diff --git a/Data/Scripts/016_UI/015_UI_Options.rb b/Data/Scripts/016_UI/015_UI_Options.rb index 7698e544a..d036ab17d 100644 --- a/Data/Scripts/016_UI/015_UI_Options.rb +++ b/Data/Scripts/016_UI/015_UI_Options.rb @@ -230,7 +230,7 @@ class Window_PokemonOption < Window_DrawableCommand rect.y - 8 + (rect.height / 2), 8, 16, SEL_VALUE_BASE_COLOR ) - value = sprintf("%d", @options[index].lowest_value + self[index]) + value = (@options[index].lowest_value + self[index]).to_s xpos += (rect.width - rect.x - optionwidth) - self.contents.text_size(value).width pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value, SEL_VALUE_BASE_COLOR, SEL_VALUE_SHADOW_COLOR) diff --git a/Data/Scripts/016_UI/022_UI_MoveRelearner.rb b/Data/Scripts/016_UI/022_UI_MoveRelearner.rb index e50a30adb..678aa3ead 100644 --- a/Data/Scripts/016_UI/022_UI_MoveRelearner.rb +++ b/Data/Scripts/016_UI/022_UI_MoveRelearner.rb @@ -89,7 +89,7 @@ class MoveRelearner_Scene accuracy = selMoveData.display_accuracy(@pokemon) textpos.push([_INTL("CATEGORY"), 272, 120, 0, Color.new(248, 248, 248), Color.black]) textpos.push([_INTL("POWER"), 272, 152, 0, Color.new(248, 248, 248), Color.black]) - textpos.push([power <= 1 ? power == 1 ? "???" : "---" : sprintf("%d", power), + textpos.push([power <= 1 ? power == 1 ? "???" : "---" : power.to_s, 468, 152, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)]) textpos.push([_INTL("ACCURACY"), 272, 184, 0, Color.new(248, 248, 248), Color.black]) textpos.push([accuracy == 0 ? "---" : "#{accuracy}%", diff --git a/Data/Scripts/016_UI/024_UI_MysteryGift.rb b/Data/Scripts/016_UI/024_UI_MysteryGift.rb index 2a5432cee..19ad93db2 100644 --- a/Data/Scripts/016_UI/024_UI_MysteryGift.rb +++ b/Data/Scripts/016_UI/024_UI_MysteryGift.rb @@ -154,7 +154,7 @@ def pbManageMysteryGifts command = 0 loop do commands = pbRefreshMGCommands(master, online) - command = pbMessage(_INTL("\\ts[]Manage Mystery Gifts (X=online)."), commands, -1, nil, command) + command = pbMessage("\\ts[]" + _INTL("Manage Mystery Gifts (X=online)."), commands, -1, nil, command) # Gift chosen if command == -1 || command == commands.length - 1 # Cancel break diff --git a/Data/Scripts/016_UI/025_UI_TextEntry.rb b/Data/Scripts/016_UI/025_UI_TextEntry.rb index 4ec0aa715..20f7c35eb 100644 --- a/Data/Scripts/016_UI/025_UI_TextEntry.rb +++ b/Data/Scripts/016_UI/025_UI_TextEntry.rb @@ -376,7 +376,7 @@ class PokemonEntryScene2 # Create bitmaps @bitmaps = [] @@Characters.length.times do |i| - @bitmaps[i] = AnimatedBitmap.new(sprintf("Graphics/UI/Naming/overlay_tab_#{i + 1}")) + @bitmaps[i] = AnimatedBitmap.new(sprintf("Graphics/UI/Naming/overlay_tab_%d", i + 1)) b = @bitmaps[i].bitmap.clone pbSetSystemFont(b) textPos = [] diff --git a/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb b/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb index 8fe14e725..0f04c2e6e 100644 --- a/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb +++ b/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb @@ -183,10 +183,10 @@ class SlotMachineScene Input.update update @sprites["window2"].bitmap&.clear - @sprites["window1"].setBitmap(sprintf("Graphics/UI/Slot Machine/win")) + @sprites["window1"].setBitmap("Graphics/UI/Slot Machine/win") @sprites["window1"].src_rect.set(152 * ((frame / timePerFrame) % 4), 0, 152, 208) if bonus > 0 - @sprites["window2"].setBitmap(sprintf("Graphics/UI/Slot Machine/bonus")) + @sprites["window2"].setBitmap("Graphics/UI/Slot Machine/bonus") @sprites["window2"].src_rect.set(152 * (bonus - 1), 0, 152, 208) end @sprites["light1"].visible = true @@ -231,7 +231,7 @@ class SlotMachineScene Input.update update @sprites["window2"].bitmap&.clear - @sprites["window1"].setBitmap(sprintf("Graphics/UI/Slot Machine/lose")) + @sprites["window1"].setBitmap("Graphics/UI/Slot Machine/lose") @sprites["window1"].src_rect.set(152 * ((frame / timePerFrame) % 2), 0, 152, 208) frame += 1 end @@ -249,7 +249,7 @@ class SlotMachineScene @sprites["reel3"] = SlotMachineReel.new(224, 112, difficulty) (1..3).each do |i| @sprites["button#{i}"] = IconSprite.new(68 + (80 * (i - 1)), 260, @viewport) - @sprites["button#{i}"].setBitmap(sprintf("Graphics/UI/Slot Machine/button")) + @sprites["button#{i}"].setBitmap("Graphics/UI/Slot Machine/button") @sprites["button#{i}"].visible = false end (1..5).each do |i| @@ -260,14 +260,14 @@ class SlotMachineScene @sprites["row#{i}"].visible = false end @sprites["light1"] = IconSprite.new(16, 32, @viewport) - @sprites["light1"].setBitmap(sprintf("Graphics/UI/Slot Machine/lights")) + @sprites["light1"].setBitmap("Graphics/UI/Slot Machine/lights") @sprites["light1"].visible = false @sprites["light2"] = IconSprite.new(240, 32, @viewport) - @sprites["light2"].setBitmap(sprintf("Graphics/UI/Slot Machine/lights")) + @sprites["light2"].setBitmap("Graphics/UI/Slot Machine/lights") @sprites["light2"].mirror = true @sprites["light2"].visible = false @sprites["window1"] = IconSprite.new(358, 96, @viewport) - @sprites["window1"].setBitmap(sprintf("Graphics/UI/Slot Machine/insert")) + @sprites["window1"].setBitmap("Graphics/UI/Slot Machine/insert") @sprites["window1"].src_rect.set(0, 0, 152, 208) @sprites["window2"] = IconSprite.new(358, 96, @viewport) @sprites["credit"] = SlotMachineScore.new(360, 66, $player.coins) @@ -294,7 +294,7 @@ class SlotMachineScene pbMessage(_INTL("You've run out of Coins.\nGame over!")) break elsif @gameRunning # Reels are spinning - @sprites["window1"].setBitmap(sprintf("Graphics/UI/Slot Machine/stop")) + @sprites["window1"].setBitmap("Graphics/UI/Slot Machine/stop") @sprites["window1"].src_rect.set(152 * ((frame / spinFrameTime) % 4), 0, 152, 208) if Input.trigger?(Input::USE) pbSEPlay("Slots stop") @@ -324,10 +324,10 @@ class SlotMachineScene end @gameEnd = false else # Awaiting coins for the next spin - @sprites["window1"].setBitmap(sprintf("Graphics/UI/Slot Machine/insert")) + @sprites["window1"].setBitmap("Graphics/UI/Slot Machine/insert") @sprites["window1"].src_rect.set(152 * ((frame / insertFrameTime) % 2), 0, 152, 208) if @wager > 0 - @sprites["window2"].setBitmap(sprintf("Graphics/UI/Slot Machine/press")) + @sprites["window2"].setBitmap("Graphics/UI/Slot Machine/press") @sprites["window2"].src_rect.set(152 * ((frame / insertFrameTime) % 2), 0, 152, 208) end if Input.trigger?(Input::DOWN) && @wager < 3 && @sprites["credit"].score > 0 diff --git a/Data/Scripts/017_Minigames/006_Minigame_Mining.rb b/Data/Scripts/017_Minigames/006_Minigame_Mining.rb index 94fe573f4..5feadc9f8 100644 --- a/Data/Scripts/017_Minigames/006_Minigame_Mining.rb +++ b/Data/Scripts/017_Minigames/006_Minigame_Mining.rb @@ -250,7 +250,7 @@ class MiningGameScene @sprites["crack"] = MiningGameCounter.new(0, 4) @sprites["cursor"] = MiningGameCursor.new(58, 0) # central position, pick @sprites["tool"] = IconSprite.new(434, 254, @viewport) - @sprites["tool"].setBitmap(sprintf("Graphics/UI/Mining/toolicons")) + @sprites["tool"].setBitmap("Graphics/UI/Mining/toolicons") @sprites["tool"].src_rect.set(0, 0, 68, 100) update pbFadeInAndShow(@sprites) diff --git a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb index 748504570..b09ae7337 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb @@ -1049,7 +1049,7 @@ def pbRegionalDexEditor(dex) end when 0 if cmd[1] >= 0 # Edit entry - case pbMessage(_INTL("\\ts[]Do what with this entry?"), + case pbMessage("\\ts[]" + _INTL("Do what with this entry?"), [_INTL("Change species"), _INTL("Clear"), _INTL("Insert entry"), _INTL("Delete entry"), _INTL("Cancel")], 5) @@ -1166,7 +1166,7 @@ def pbRegionalDexEditorMain refresh_list = true end elsif cmd[1] > 0 # Edit a Dex - case pbMessage(_INTL("\\ts[]Do what with this Dex?"), + case pbMessage("\\ts[]" + _INTL("Do what with this Dex?"), [_INTL("Edit"), _INTL("Copy"), _INTL("Delete"), _INTL("Cancel")], 4) when 0 # Edit dex_lists[cmd[1] - 1] = pbRegionalDexEditor(dex_lists[cmd[1] - 1]) diff --git a/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb b/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb index be667799c..9fd331464 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb @@ -212,7 +212,7 @@ class PokemonTilesetScene cmds.push("#{tag.id_number}: #{tag.real_name}") ids.push(tag.id_number) end - val = pbMessage(_INTL("\\l[1]\\ts[]Set the terrain tag."), cmds, -1, nil, old_idx) + val = pbMessage("\\l[1]\\ts[]" + _INTL("Set the terrain tag."), cmds, -1, nil, old_idx) if val >= 0 && val != old_tag set_terrain_tag_for_tile_ID(selected, ids[val]) draw_overlay diff --git a/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb b/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb index 4542c8a2f..ae9679532 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb @@ -350,12 +350,12 @@ class MapScreenScene end def helpWindow - helptext = _INTL("A: Add map to canvas\r\n") - helptext += _INTL("DEL: Delete map from canvas\r\n") - helptext += _INTL("S: Go to another map\r\n") - helptext += _INTL("Click to select a map\r\n") - helptext += _INTL("Double-click: Edit map's metadata\r\n") - helptext += _INTL("Drag map to move it\r\n") + helptext = _INTL("A: Add map to canvas") + "\r\n" + helptext += _INTL("DEL: Delete map from canvas") + "\r\n" + helptext += _INTL("S: Go to another map") + "\r\n" + helptext += _INTL("Click to select a map") + "\r\n" + helptext += _INTL("Double-click: Edit map's metadata") + "\r\n" + helptext += _INTL("Drag map to move it") + "\r\n" helptext += _INTL("Arrow keys/drag canvas: Move around canvas") title = Window_UnformattedTextPokemon.newWithSize( helptext, 0, 0, Graphics.width * 8 / 10, Graphics.height, @viewport diff --git a/Data/Scripts/020_Debug/002_Animation editor/005_AnimEditor_Functions.rb b/Data/Scripts/020_Debug/002_Animation editor/005_AnimEditor_Functions.rb index ba8112029..9622e52ab 100644 --- a/Data/Scripts/020_Debug/002_Animation editor/005_AnimEditor_Functions.rb +++ b/Data/Scripts/020_Debug/002_Animation editor/005_AnimEditor_Functions.rb @@ -380,9 +380,7 @@ module BattleAnimationEditor cmdEditBG = -1 cmdNewFO = -1 cmdEditFO = -1 - canvas.animation.timing.each do |i| - commands.push(sprintf("%s", i)) - end + canvas.animation.timing.each { |i| commands.push(i.to_s) } commands[cmdNewSound = commands.length] = _INTL("Add: Play Sound...") commands[cmdNewBG = commands.length] = _INTL("Add: Set Background Graphic...") commands[cmdEditBG = commands.length] = _INTL("Add: Edit Background Color/Location...") @@ -413,7 +411,7 @@ module BattleAnimationEditor cmdwin.index != cmdEditFO if framewindow.changed?(1) # Set Frame canvas.animation.timing[cmdwin.index].frame = framewindow.value(0) - 1 - cmdwin.commands[cmdwin.index] = sprintf("%s", canvas.animation.timing[cmdwin.index]) + cmdwin.commands[cmdwin.index] = canvas.animation.timing[cmdwin.index].to_s cmdwin.refresh next end @@ -476,7 +474,7 @@ module BattleAnimationEditor when 2, 4 pbEditBG(canvas, canvas.animation.timing[cmdwin.index]) end - cmdwin.commands[cmdwin.index] = sprintf("%s", canvas.animation.timing[cmdwin.index]) + cmdwin.commands[cmdwin.index] = canvas.animation.timing[cmdwin.index].to_s cmdwin.refresh end if redrawcmds @@ -486,7 +484,7 @@ module BattleAnimationEditor cmdwin.commands[cmdNewFO] = nil if cmdNewFO >= 0 cmdwin.commands[cmdEditFO] = nil if cmdEditFO >= 0 cmdwin.commands.compact! - cmdwin.commands.push(sprintf("%s", canvas.animation.timing[canvas.animation.timing.length - 1])) + cmdwin.commands.push(canvas.animation.timing[canvas.animation.timing.length - 1].to_s) cmdwin.commands[cmdNewSound = cmdwin.commands.length] = _INTL("Add: Play Sound...") cmdwin.commands[cmdNewBG = cmdwin.commands.length] = _INTL("Add: Set Background Graphic...") cmdwin.commands[cmdEditBG = cmdwin.commands.length] = _INTL("Add: Edit Background Color/Location...") diff --git a/Data/Scripts/020_Debug/002_Editor_DataTypes.rb b/Data/Scripts/020_Debug/002_Editor_DataTypes.rb index 96c5f5e7f..5cb08df34 100644 --- a/Data/Scripts/020_Debug/002_Editor_DataTypes.rb +++ b/Data/Scripts/020_Debug/002_Editor_DataTypes.rb @@ -287,7 +287,7 @@ class StringListProperty do_refresh = true end else # Edit value - case pbMessage(_INTL("\\ts[]Do what with this value?"), + case pbMessage("\\ts[]" + _INTL("Do what with this value?"), [_INTL("Edit"), _INTL("Delete"), _INTL("Cancel")], 3) when 0 # Edit new_value = pbMessageFreeText(_INTL("Enter the new value."), @@ -1096,7 +1096,7 @@ class GameDataPoolProperty need_refresh = true end else # Edit existing value - case pbMessage(_INTL("\\ts[]Do what with this value?"), + case pbMessage("\\ts[]" + _INTL("Do what with this value?"), [_INTL("Change value"), _INTL("Delete"), _INTL("Cancel")], 3) when 0 # Change value new_value = pbChooseFromGameDataList(@game_data, entry[0]) @@ -1250,7 +1250,7 @@ module LevelUpMovesProperty end end else # Edit existing move - case pbMessage(_INTL("\\ts[]Do what with this move?"), + case pbMessage("\\ts[]" + _INTL("Do what with this move?"), [_INTL("Change level"), _INTL("Change move"), _INTL("Delete"), _INTL("Cancel")], 4) when 0 # Change level params = ChooseNumberParams.new @@ -1457,7 +1457,7 @@ class EvolutionsProperty end end else # Edit evolution - case pbMessage(_INTL("\\ts[]Do what with this evolution?"), + case pbMessage("\\ts[]" + _INTL("Do what with this evolution?"), [_INTL("Change species"), _INTL("Change method"), _INTL("Change parameter"), _INTL("Delete"), _INTL("Cancel")], 5) when 0 # Change species diff --git a/Data/Scripts/020_Debug/003_Debug menus/004_Debug_BattleCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/004_Debug_BattleCommands.rb index 771b65e4a..a8ab301ec 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/004_Debug_BattleCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/004_Debug_BattleCommands.rb @@ -206,8 +206,8 @@ MenuHandlers.add(:battle_debug_menu, :mega_evolution, { next if !trainers[i] text = (side == 0) ? "Your side:" : "Foe side:" text += sprintf(" %d: %s", i, trainers[i].name) - text += sprintf(" [ABLE]") if value == -1 - text += sprintf(" [UNABLE]") if value == -2 + text += " [ABLE]" if value == -1 + text += " [UNABLE]" if value == -2 commands.push(text) cmds.push([side, i]) end diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index e9f6d99ce..6d9f08cef 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -40,12 +40,12 @@ module FileLineData def self.linereport if @section if @key.nil? - return _INTL("File {1}, section {2}\r\n{3}\r\n\r\n", @file, @section, @value) + return _INTL("File {1}, section {2}\r\n{3}", @file, @section, @value) + "\r\n\r\n" else - return _INTL("File {1}, section {2}, key {3}\r\n{4}\r\n\r\n", @file, @section, @key, @value) + return _INTL("File {1}, section {2}, key {3}\r\n{4}", @file, @section, @key, @value) + "\r\n\r\n" end else - return _INTL("File {1}, line {2}\r\n{3}\r\n\r\n", @file, @lineno, @linedata) + return _INTL("File {1}, line {2}\r\n{3}", @file, @lineno, @linedata) + "\r\n\r\n" end end end diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index e09bc34f3..758d83924 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -560,7 +560,7 @@ module Compiler else pbWriteCsvRecord(record, f, schema) end - f.write(sprintf("\r\n")) + f.write("\r\n") end end end diff --git a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb index 8408ee9e4..9ee076dcd 100644 --- a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb @@ -574,7 +574,7 @@ module Compiler trainerid = GameData::TrainerType.get(trtype).id filename = GameData::TrainerType.charset_filename_brief(trainerid) if FileTest.image_exist?("Graphics/Characters/" + filename) - firstpage.graphic.character_name = sprintf(filename) + firstpage.graphic.character_name = filename end end # Create strings that will be used repeatedly From b226e3cbb6821f97ae73a22d6265d1da33498b95 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 2 Apr 2023 00:57:22 +0100 Subject: [PATCH 2/9] Fixed the value of the setting HEAL_STORED_POKEMON, restored all EOR weather messages --- Data/Scripts/001_Settings.rb | 2 +- .../001_Battle/011_Battle_EndOfRoundPhase.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb index 02de22a00..6f7c62fdb 100644 --- a/Data/Scripts/001_Settings.rb +++ b/Data/Scripts/001_Settings.rb @@ -202,7 +202,7 @@ module Settings NUM_STORAGE_BOXES = 40 # Whether putting a Pokémon into Pokémon storage will heal it. IF false, they # are healed by the Recover All: Entire Party event command (at Poké Centers). - HEAL_STORED_POKEMON = (MECHANICS_GENERATION >= 8) + HEAL_STORED_POKEMON = (MECHANICS_GENERATION <= 7) #============================================================================= diff --git a/Data/Scripts/011_Battle/001_Battle/011_Battle_EndOfRoundPhase.rb b/Data/Scripts/011_Battle/001_Battle/011_Battle_EndOfRoundPhase.rb index 5d1392d46..f60677d2f 100644 --- a/Data/Scripts/011_Battle/001_Battle/011_Battle_EndOfRoundPhase.rb +++ b/Data/Scripts/011_Battle/001_Battle/011_Battle_EndOfRoundPhase.rb @@ -27,13 +27,13 @@ class Battle weather_data = GameData::BattleWeather.try_get(@field.weather) pbCommonAnimation(weather_data.animation) if weather_data case @field.weather -# when :Sun then pbDisplay(_INTL("The sunlight is strong.")) -# when :Rain then pbDisplay(_INTL("Rain continues to fall.")) + when :Sun then pbDisplay(_INTL("The sunlight is strong.")) + when :Rain then pbDisplay(_INTL("Rain continues to fall.")) when :Sandstorm then pbDisplay(_INTL("The sandstorm is raging.")) when :Hail then pbDisplay(_INTL("The hail is crashing down.")) -# when :HarshSun then pbDisplay(_INTL("The sunlight is extremely harsh.")) -# when :HeavyRain then pbDisplay(_INTL("It is raining heavily.")) -# when :StrongWinds then pbDisplay(_INTL("The wind is strong.")) + when :HarshSun then pbDisplay(_INTL("The sunlight is extremely harsh.")) + when :HeavyRain then pbDisplay(_INTL("It is raining heavily.")) + when :StrongWinds then pbDisplay(_INTL("The wind is strong.")) when :ShadowSky then pbDisplay(_INTL("The shadow sky continues.")) end # Effects due to weather From e7847fba9ab4ad5bda5245e0c6fbb16453c08eed Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 2 Apr 2023 00:59:05 +0100 Subject: [PATCH 3/9] Fixed typo in a previous commit --- Data/Scripts/016_UI/007_UI_Bag.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Scripts/016_UI/007_UI_Bag.rb b/Data/Scripts/016_UI/007_UI_Bag.rb index 9df1b0190..e4d3ae9a3 100644 --- a/Data/Scripts/016_UI/007_UI_Bag.rb +++ b/Data/Scripts/016_UI/007_UI_Bag.rb @@ -262,7 +262,7 @@ class PokemonBag_Scene # Set the bag sprite fbagexists = pbResolveBitmap(sprintf("Graphics/UI/Bag/bag_%d_f", @bag.last_viewed_pocket)) if $player.female? && fbagexists - @sprites["bagsprite"].setBitmap(sprintf("Graphics/UI/Bag/bag_%d_f", @bag.last_viewed_pocket")) + @sprites["bagsprite"].setBitmap(sprintf("Graphics/UI/Bag/bag_%d_f", @bag.last_viewed_pocket)) else @sprites["bagsprite"].setBitmap(sprintf("Graphics/UI/Bag/bag_%d", @bag.last_viewed_pocket)) end From cb4a1fd8af79444be95a38a253a06ad02b59cd3a Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Tue, 4 Apr 2023 21:16:09 +0100 Subject: [PATCH 4/9] def pbDrawTextPositions now uses symbols for text alignment and outline, and added a quicker way to draw text with no shadow/outline --- .../007_Objects and windows/010_DrawText.rb | 31 +++- Data/Scripts/009_Scenes/001_Transitions.rb | 6 +- .../004_Scene/005_Battle_Scene_Menus.rb | 6 +- .../004_Scene/006_Battle_Scene_Objects.rb | 13 +- .../001_SafariBattle.rb | 4 +- .../004_BattleArenaBattle.rb | 18 +-- .../002_Overworld_BattleIntroAnim.rb | 4 +- .../006_UI_HallOfFame.rb | 14 +- Data/Scripts/016_UI/003_UI_Pokedex_Main.rb | 104 ++++++------- Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb | 40 ++--- Data/Scripts/016_UI/005_UI_Party.rb | 12 +- Data/Scripts/016_UI/006_UI_Summary.rb | 139 +++++++++--------- Data/Scripts/016_UI/007_UI_Bag.rb | 8 +- Data/Scripts/016_UI/008_UI_Pokegear.rb | 2 +- Data/Scripts/016_UI/009_UI_RegionMap.rb | 8 +- Data/Scripts/016_UI/012_UI_TrainerCard.rb | 24 +-- Data/Scripts/016_UI/013_UI_Load.rb | 26 ++-- Data/Scripts/016_UI/016_UI_ReadyMenu.rb | 10 +- Data/Scripts/016_UI/017_UI_PokemonStorage.rb | 26 ++-- Data/Scripts/016_UI/018_UI_ItemStorage.rb | 6 +- Data/Scripts/016_UI/020_UI_PokeMart.rb | 6 +- Data/Scripts/016_UI/021_UI_BattlePointShop.rb | 6 +- Data/Scripts/016_UI/022_UI_MoveRelearner.rb | 24 +-- Data/Scripts/016_UI/023_UI_PurifyChamber.rb | 11 +- Data/Scripts/016_UI/025_UI_TextEntry.rb | 14 +- .../017_Minigames/002_Minigame_TripleTriad.rb | 6 +- .../002_EditorScreens_TerrainTags.rb | 6 +- 27 files changed, 295 insertions(+), 279 deletions(-) diff --git a/Data/Scripts/007_Objects and windows/010_DrawText.rb b/Data/Scripts/007_Objects and windows/010_DrawText.rb index a71b69252..754c79ae8 100644 --- a/Data/Scripts/007_Objects and windows/010_DrawText.rb +++ b/Data/Scripts/007_Objects and windows/010_DrawText.rb @@ -1,5 +1,5 @@ #=============================================================================== -# Text colours +# Text colors #=============================================================================== # TODO: Unused. def ctag(color) @@ -1033,6 +1033,16 @@ def pbDrawShadow(bitmap, x, y, width, height, string) pbDrawShadowText(bitmap, x, y, width, height, string, nil, bitmap.font.color) end +def pbDrawPlainText(bitmap, x, y, width, height, string, baseColor, align = 0) + return if !bitmap || !string + width = (width < 0) ? bitmap.text_size(string).width + 1 : width + height = (height < 0) ? bitmap.text_size(string).height + 1 : height + if baseColor && baseColor.alpha > 0 + bitmap.font.color = baseColor + bitmap.draw_text(x, y, width, height, string, align) + end +end + def pbDrawShadowText(bitmap, x, y, width, height, string, baseColor, shadowColor = nil, align = 0) return if !bitmap || !string width = (width < 0) ? bitmap.text_size(string).width + 1 : width @@ -1075,24 +1085,29 @@ end # 0 - Text to draw # 1 - X coordinate # 2 - Y coordinate -# 3 - If true or 1, the text is right aligned. If 2, the text is centered. -# Otherwise, the text is left aligned. +# 3 - Text alignment. Is one of :left (or false or 0), :right (or true or 1) or +# :center (or 2). If anything else, the text is left aligned. # 4 - Base color -# 5 - Shadow color -# 6 - If true or 1, the text has an outline. Otherwise, the text has a shadow. +# 5 - Shadow color. If nil, there is no shadow. +# 6 - If :outline (or true or 1), the text has a full outline. If :none (or the +# shadow color is nil), there is no shadow. Otherwise, the text has a shadow. def pbDrawTextPositions(bitmap, textpos) textpos.each do |i| textsize = bitmap.text_size(i[0]) x = i[1] y = i[2] case i[3] - when true, 1 # right align + when :right, true, 1 # right align x -= textsize.width - when 2 # centered + when :center, 2 # centered x -= (textsize.width / 2) end - if i[6] == true || i[6] == 1 # outline text + i[6] = :none if !i[5] # No shadow color given, draw plain text + case i[6] + when :outline, true, 1 # outline text pbDrawOutlineText(bitmap, x, y, textsize.width, textsize.height, i[0], i[4], i[5]) + when :none + pbDrawPlainText(bitmap, x, y, textsize.width, textsize.height, i[0], i[4]) else pbDrawShadowText(bitmap, x, y, textsize.width, textsize.height, i[0], i[4], i[5]) end diff --git a/Data/Scripts/009_Scenes/001_Transitions.rb b/Data/Scripts/009_Scenes/001_Transitions.rb index 25f4e0e44..1017ddb6b 100644 --- a/Data/Scripts/009_Scenes/001_Transitions.rb +++ b/Data/Scripts/009_Scenes/001_Transitions.rb @@ -1302,7 +1302,7 @@ module Transitions @text_sprite.visible = false pbSetSystemFont(@text_sprite.bitmap) pbDrawTextPositions(@text_sprite.bitmap, - [[$game_temp.transition_animation_data[1], 244, 86, 0, + [[$game_temp.transition_animation_data[1], 244, 86, :left, Color.new(248, 248, 248), Color.new(72, 80, 80)]]) # Foreground black @black_sprite = new_sprite(0, 0, @black_bitmap) @@ -1497,7 +1497,7 @@ module Transitions @text_sprite.z = 8 pbSetSystemFont(@text_sprite.bitmap) pbDrawTextPositions(@text_sprite.bitmap, - [[$game_temp.transition_animation_data[1], 160, 86, 0, + [[$game_temp.transition_animation_data[1], 160, 86, :left, Color.new(248, 248, 248), Color.new(72, 80, 80)]]) # VS logo @vs_main_sprite = new_sprite(Graphics.width / 2, Graphics.height / 2, @vs_1_bitmap, @@ -1804,7 +1804,7 @@ module Transitions @text_sprite.visible = false pbSetSystemFont(@text_sprite.bitmap) pbDrawTextPositions(@text_sprite.bitmap, - [[$game_temp.transition_animation_data[1], 272, 8, 0, + [[$game_temp.transition_animation_data[1], 272, 8, :left, Color.new(248, 248, 248), Color.new(72, 80, 80)]]) # Foreground black @black_sprite = new_sprite(0, 0, @black_bitmap) diff --git a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb index 09d1ec5b9..28915f713 100644 --- a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb +++ b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb @@ -358,7 +358,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase # code to ensure the font is an appropriate color. moveNameBase = button.bitmap.get_pixel(10, button.src_rect.y + 34) end - textPos.push([moves[i].name, x, y, 2, moveNameBase, TEXT_SHADOW_COLOR]) + textPos.push([moves[i].name, x, y, :center, moveNameBase, TEXT_SHADOW_COLOR]) end pbDrawTextPositions(@overlay.bitmap, textPos) end @@ -408,7 +408,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase ppFraction = [(4.0 * move.pp / move.total_pp).ceil, 3].min textPos = [] textPos.push([_INTL("PP: {1}/{2}", move.pp, move.total_pp), - 448, 56, 2, PP_COLORS[ppFraction * 2], PP_COLORS[(ppFraction * 2) + 1]]) + 448, 56, :center, PP_COLORS[ppFraction * 2], PP_COLORS[(ppFraction * 2) + 1]]) pbDrawTextPositions(@infoOverlay.bitmap, textPos) end end @@ -540,7 +540,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase next if !button || nil_or_empty?(@texts[i]) x = button.x - self.x + (button.src_rect.width / 2) y = button.y - self.y + 14 - textpos.push([@texts[i], x, y, 2, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]) + textpos.push([@texts[i], x, y, :center, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]) end pbDrawTextPositions(@overlay.bitmap, textpos) end diff --git a/Data/Scripts/011_Battle/004_Scene/006_Battle_Scene_Objects.rb b/Data/Scripts/011_Battle/004_Scene/006_Battle_Scene_Objects.rb index eb9ec8dd7..18db00389 100644 --- a/Data/Scripts/011_Battle/004_Scene/006_Battle_Scene_Objects.rb +++ b/Data/Scripts/011_Battle/004_Scene/006_Battle_Scene_Objects.rb @@ -214,7 +214,7 @@ class Battle::Scene::PokemonDataBox < Sprite nameOffset = 0 nameOffset = nameWidth - 116 if nameWidth > 116 pbDrawTextPositions(self.bitmap, - [[@battler.name, @spriteBaseX + 8 - nameOffset, 12, false, NAME_BASE_COLOR, NAME_SHADOW_COLOR]] + [[@battler.name, @spriteBaseX + 8 - nameOffset, 12, :left, NAME_BASE_COLOR, NAME_SHADOW_COLOR]] ) end @@ -233,7 +233,7 @@ class Battle::Scene::PokemonDataBox < Sprite gender_text = (gender == 0) ? _INTL("♂") : _INTL("♀") base_color = (gender == 0) ? MALE_BASE_COLOR : FEMALE_BASE_COLOR shadow_color = (gender == 0) ? MALE_SHADOW_COLOR : FEMALE_SHADOW_COLOR - pbDrawTextPositions(self.bitmap, [[gender_text, @spriteBaseX + 126, 12, false, base_color, shadow_color]]) + pbDrawTextPositions(self.bitmap, [[gender_text, @spriteBaseX + 126, 12, :left, base_color, shadow_color]]) end def draw_status @@ -479,12 +479,13 @@ class Battle::Scene::AbilitySplashBar < Sprite return if !@battler textPos = [] textX = (@side == 0) ? 10 : self.bitmap.width - 8 + align = (@side == 0) ? :left : :right # Draw Pokémon's name - textPos.push([_INTL("{1}'s", @battler.name), textX, 8, @side == 1, - TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, true]) + textPos.push([_INTL("{1}'s", @battler.name), textX, 8, align, + TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, :outline]) # Draw Pokémon's ability - textPos.push([@battler.abilityName, textX, 38, @side == 1, - TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, true]) + textPos.push([@battler.abilityName, textX, 38, align, + TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, :outline]) pbDrawTextPositions(self.bitmap, textPos) end diff --git a/Data/Scripts/011_Battle/007_Other battle types/001_SafariBattle.rb b/Data/Scripts/011_Battle/007_Other battle types/001_SafariBattle.rb index e53df76fe..78e7538dc 100644 --- a/Data/Scripts/011_Battle/007_Other battle types/001_SafariBattle.rb +++ b/Data/Scripts/011_Battle/007_Other battle types/001_SafariBattle.rb @@ -81,8 +81,8 @@ class Battle::Scene::SafariDataBox < Sprite base = Color.new(72, 72, 72) shadow = Color.new(184, 184, 184) textpos = [] - textpos.push([_INTL("Safari Balls"), 30, 14, false, base, shadow]) - textpos.push([_INTL("Left: {1}", @battle.ballCount), 30, 44, false, base, shadow]) + textpos.push([_INTL("Safari Balls"), 30, 14, :left, base, shadow]) + textpos.push([_INTL("Left: {1}", @battle.ballCount), 30, 44, :left, base, shadow]) pbDrawTextPositions(self.bitmap, textpos) end diff --git a/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb b/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb index 9b4109f64..eafa3b799 100644 --- a/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb +++ b/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb @@ -235,15 +235,15 @@ class Battle::Scene window.contents.clear pbSetSystemFont(window.contents) textpos = [ - [battler1.name, 64, 6, 2, Color.new(248, 0, 0), Color.new(208, 208, 200)], - [_INTL("VS"), 144, 6, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [battler2.name, 224, 6, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [_INTL("Mind"), 144, 54, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [_INTL("Skill"), 144, 86, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [_INTL("Body"), 144, 118, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [total1.to_s, 64, 166, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [_INTL("Judgment"), 144, 166, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [total2.to_s, 224, 166, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)] + [battler1.name, 64, 6, :center, Color.new(248, 0, 0), Color.new(208, 208, 200)], + [_INTL("VS"), 144, 6, :center, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [battler2.name, 224, 6, :center, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [_INTL("Mind"), 144, 54, :center, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [_INTL("Skill"), 144, 86, :center, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [_INTL("Body"), 144, 118, :center, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [total1.to_s, 64, 166, :center, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [_INTL("Judgment"), 144, 166, :center, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [total2.to_s, 224, 166, :center, Color.new(72, 72, 72), Color.new(208, 208, 200)] ] pbDrawTextPositions(window.contents, textpos) images = [] diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/002_Overworld_BattleIntroAnim.rb b/Data/Scripts/012_Overworld/002_Battle triggering/002_Overworld_BattleIntroAnim.rb index 783f5844c..b327c3f2f 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/002_Overworld_BattleIntroAnim.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/002_Overworld_BattleIntroAnim.rb @@ -373,9 +373,9 @@ SpecialBattleIntroAnimations.register("alternate_vs_trainer_animation", 50, # trainer.tone = Tone.new(0, 0, 0) trainername = foe[0].name textpos = [ - [$player.name, Graphics.width / 4, (Graphics.height / 1.5) + 16, 2, + [$player.name, Graphics.width / 4, (Graphics.height / 1.5) + 16, :center, Color.new(248, 248, 248), Color.new(72, 72, 72)], - [trainername, (Graphics.width / 4) + (Graphics.width / 2), (Graphics.height / 1.5) + 16, 2, + [trainername, (Graphics.width / 4) + (Graphics.width / 2), (Graphics.height / 1.5) + 16, :center, Color.new(248, 248, 248), Color.new(72, 72, 72)] ] pbDrawTextPositions(overlay.bitmap, textpos) diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb b/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb index eb6385f01..e833df101 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb @@ -319,16 +319,16 @@ class HallOfFame_Scene dexnumber = _ISPRINTF("No. {1:03d}", number) end textPositions = [ - [dexnumber, 32, Graphics.height - 74, 0, BASECOLOR, SHADOWCOLOR], - [pokename, Graphics.width - 192, Graphics.height - 74, 2, BASECOLOR, SHADOWCOLOR], + [dexnumber, 32, Graphics.height - 74, :left, BASECOLOR, SHADOWCOLOR], + [pokename, Graphics.width - 192, Graphics.height - 74, :center, BASECOLOR, SHADOWCOLOR], [_INTL("Lv. {1}", pokemon.egg? ? "?" : pokemon.level), - 64, Graphics.height - 42, 0, BASECOLOR, SHADOWCOLOR], + 64, Graphics.height - 42, :left, BASECOLOR, SHADOWCOLOR], [_INTL("ID No. {1}", pokemon.egg? ? "?????" : idno), - Graphics.width - 192, Graphics.height - 42, 2, BASECOLOR, SHADOWCOLOR] + Graphics.width - 192, Graphics.height - 42, :center, BASECOLOR, SHADOWCOLOR] ] if hallNumber > -1 - textPositions.push([_INTL("Hall of Fame No."), (Graphics.width / 2) - 104, 6, 0, BASECOLOR, SHADOWCOLOR]) - textPositions.push([hallNumber.to_s, (Graphics.width / 2) + 104, 6, 1, BASECOLOR, SHADOWCOLOR]) + textPositions.push([_INTL("Hall of Fame No."), (Graphics.width / 2) - 104, 6, :left, BASECOLOR, SHADOWCOLOR]) + textPositions.push([hallNumber.to_s, (Graphics.width / 2) + 104, 6, :right, BASECOLOR, SHADOWCOLOR]) end pbDrawTextPositions(overlay, textPositions) end @@ -337,7 +337,7 @@ class HallOfFame_Scene overlay = @sprites["overlay"].bitmap overlay.clear pbDrawTextPositions(overlay, [[_INTL("Welcome to the Hall of Fame!"), - Graphics.width / 2, Graphics.height - 68, 2, BASECOLOR, SHADOWCOLOR]]) + Graphics.width / 2, Graphics.height - 68, :center, BASECOLOR, SHADOWCOLOR]]) end def pbAnimationLoop diff --git a/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb b/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb index f0c1428f9..582320a00 100644 --- a/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb +++ b/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb @@ -430,17 +430,17 @@ class PokemonPokedex_Scene end end textpos = [ - [dexname, Graphics.width / 2, 10, 2, Color.new(248, 248, 248), Color.black] + [dexname, Graphics.width / 2, 10, :center, Color.new(248, 248, 248), Color.black] ] - textpos.push([GameData::Species.get(iconspecies).name, 112, 58, 2, base, shadow]) if iconspecies + textpos.push([GameData::Species.get(iconspecies).name, 112, 58, :center, base, shadow]) if iconspecies if @searchResults - textpos.push([_INTL("Search results"), 112, 314, 2, base, shadow]) - textpos.push([@dexlist.length.to_s, 112, 346, 2, base, shadow]) + textpos.push([_INTL("Search results"), 112, 314, :center, base, shadow]) + textpos.push([@dexlist.length.to_s, 112, 346, :center, base, shadow]) else - textpos.push([_INTL("Seen:"), 42, 314, 0, base, shadow]) - textpos.push([$player.pokedex.seen_count(pbGetPokedexRegion).to_s, 182, 314, 1, base, shadow]) - textpos.push([_INTL("Owned:"), 42, 346, 0, base, shadow]) - textpos.push([$player.pokedex.owned_count(pbGetPokedexRegion).to_s, 182, 346, 1, base, shadow]) + textpos.push([_INTL("Seen:"), 42, 314, :left, base, shadow]) + textpos.push([$player.pokedex.seen_count(pbGetPokedexRegion).to_s, 182, 314, :right, base, shadow]) + textpos.push([_INTL("Owned:"), 42, 346, :left, base, shadow]) + textpos.push([$player.pokedex.owned_count(pbGetPokedexRegion).to_s, 182, 346, :right, base, shadow]) end # Draw all text pbDrawTextPositions(overlay, textpos) @@ -483,36 +483,36 @@ class PokemonPokedex_Scene shadow = Color.new(72, 72, 72) # Write various bits of text textpos = [ - [_INTL("Search Mode"), Graphics.width / 2, 10, 2, base, shadow], - [_INTL("Order"), 136, 64, 2, base, shadow], - [_INTL("Name"), 58, 122, 2, base, shadow], - [_INTL("Type"), 58, 174, 2, base, shadow], - [_INTL("Height"), 58, 226, 2, base, shadow], - [_INTL("Weight"), 58, 278, 2, base, shadow], - [_INTL("Color"), 326, 122, 2, base, shadow], - [_INTL("Shape"), 454, 174, 2, base, shadow], - [_INTL("Reset"), 80, 346, 2, base, shadow, 1], - [_INTL("Start"), Graphics.width / 2, 346, 2, base, shadow, 1], - [_INTL("Cancel"), Graphics.width - 80, 346, 2, base, shadow, 1] + [_INTL("Search Mode"), Graphics.width / 2, 10, :center, base, shadow], + [_INTL("Order"), 136, 64, :center, base, shadow], + [_INTL("Name"), 58, 122, :center, base, shadow], + [_INTL("Type"), 58, 174, :center, base, shadow], + [_INTL("Height"), 58, 226, :center, base, shadow], + [_INTL("Weight"), 58, 278, :center, base, shadow], + [_INTL("Color"), 326, 122, :center, base, shadow], + [_INTL("Shape"), 454, 174, :center, base, shadow], + [_INTL("Reset"), 80, 346, :center, base, shadow, 1], + [_INTL("Start"), Graphics.width / 2, 346, :center, base, shadow, :outline], + [_INTL("Cancel"), Graphics.width - 80, 346, :center, base, shadow, :outline] ] # Write order, name and color parameters - textpos.push([@orderCommands[params[0]], 344, 66, 2, base, shadow, 1]) - textpos.push([(params[1] < 0) ? "----" : @nameCommands[params[1]], 176, 124, 2, base, shadow, 1]) - textpos.push([(params[8] < 0) ? "----" : @colorCommands[params[8]].name, 444, 124, 2, base, shadow, 1]) + textpos.push([@orderCommands[params[0]], 344, 66, :center, base, shadow, :outline]) + textpos.push([(params[1] < 0) ? "----" : @nameCommands[params[1]], 176, 124, :center, base, shadow, :outline]) + textpos.push([(params[8] < 0) ? "----" : @colorCommands[params[8]].name, 444, 124, :center, base, shadow, :outline]) # Draw type icons if params[2] >= 0 type_number = @typeCommands[params[2]].icon_position typerect = Rect.new(0, type_number * 32, 96, 32) overlay.blt(128, 168, @typebitmap.bitmap, typerect) else - textpos.push(["----", 176, 176, 2, base, shadow, 1]) + textpos.push(["----", 176, 176, :center, base, shadow, :outline]) end if params[3] >= 0 type_number = @typeCommands[params[3]].icon_position typerect = Rect.new(0, type_number * 32, 96, 32) overlay.blt(256, 168, @typebitmap.bitmap, typerect) else - textpos.push(["----", 304, 176, 2, base, shadow, 1]) + textpos.push(["----", 304, 176, :center, base, shadow, :outline]) end # Write height and weight limits ht1 = (params[4] < 0) ? 0 : (params[4] >= @heightCommands.length) ? 999 : @heightCommands[params[4]] @@ -525,16 +525,16 @@ class PokemonPokedex_Scene ht2 = (params[5] < 0) ? 99 * 12 : (ht2 / 0.254).round wt1 = (params[6] >= @weightCommands.length) ? 99_990 : (wt1 / 0.254).round wt2 = (params[7] < 0) ? 99_990 : (wt2 / 0.254).round - textpos.push([sprintf("%d'%02d''", ht1 / 12, ht1 % 12), 166, 228, 2, base, shadow, 1]) - textpos.push([sprintf("%d'%02d''", ht2 / 12, ht2 % 12), 294, 228, 2, base, shadow, 1]) - textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 280, 2, base, shadow, 1]) - textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 280, 2, base, shadow, 1]) + textpos.push([sprintf("%d'%02d''", ht1 / 12, ht1 % 12), 166, 228, :center, base, shadow, :outline]) + textpos.push([sprintf("%d'%02d''", ht2 / 12, ht2 % 12), 294, 228, :center, base, shadow, :outline]) + textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 280, :center, base, shadow, :outline]) + textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 280, :center, base, shadow, :outline]) hwoffset = true else - textpos.push([sprintf("%.1f", ht1 / 10.0), 166, 228, 2, base, shadow, 1]) - textpos.push([sprintf("%.1f", ht2 / 10.0), 294, 228, 2, base, shadow, 1]) - textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 280, 2, base, shadow, 1]) - textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 280, 2, base, shadow, 1]) + textpos.push([sprintf("%.1f", ht1 / 10.0), 166, 228, :center, base, shadow, :outline]) + textpos.push([sprintf("%.1f", ht2 / 10.0), 294, 228, :center, base, shadow, :outline]) + textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 280, :center, base, shadow, :outline]) + textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 280, :center, base, shadow, :outline]) end overlay.blt(344, 214, @hwbitmap.bitmap, Rect.new(0, (hwoffset) ? 44 : 0, 32, 44)) overlay.blt(344, 266, @hwbitmap.bitmap, Rect.new(32, (hwoffset) ? 44 : 0, 32, 44)) @@ -555,13 +555,13 @@ class PokemonPokedex_Scene shadow = Color.new(72, 72, 72) # Write various bits of text textpos = [ - [_INTL("Search Mode"), Graphics.width / 2, 10, 2, base, shadow], - [_INTL("OK"), 80, 346, 2, base, shadow, 1], - [_INTL("Cancel"), Graphics.width - 80, 346, 2, base, shadow, 1] + [_INTL("Search Mode"), Graphics.width / 2, 10, :center, base, shadow], + [_INTL("OK"), 80, 346, :center, base, shadow, :outline], + [_INTL("Cancel"), Graphics.width - 80, 346, :center, base, shadow, :outline] ] title = [_INTL("Order"), _INTL("Name"), _INTL("Type"), _INTL("Height"), _INTL("Weight"), _INTL("Color"), _INTL("Shape")][mode] - textpos.push([title, 102, (mode == 6) ? 70 : 64, 0, base, shadow]) + textpos.push([title, 102, (mode == 6) ? 70 : 64, :left, base, shadow]) case mode when 0 # Order xstart = 46 @@ -621,7 +621,7 @@ class PokemonPokedex_Scene when 2 # Type icons 2.times do |i| if !sel[i] || sel[i] < 0 - textpos.push(["----", 298 + (128 * i), 66, 2, base, shadow, 1]) + textpos.push(["----", 298 + (128 * i), 66, :center, base, shadow, :outline]) else type_number = @typeCommands[sel[i]].icon_position typerect = Rect.new(0, type_number * 32, 96, 32) @@ -642,8 +642,8 @@ class PokemonPokedex_Scene txt1 = sprintf("%.1f", ht1 / 10.0) txt2 = sprintf("%.1f", ht2 / 10.0) end - textpos.push([txt1, 286, 66, 2, base, shadow, 1]) - textpos.push([txt2, 414, 66, 2, base, shadow, 1]) + textpos.push([txt1, 286, 66, :center, base, shadow, :outline]) + textpos.push([txt2, 414, 66, :center, base, shadow, :outline]) overlay.blt(462, 52, @hwbitmap.bitmap, Rect.new(0, (hwoffset) ? 44 : 0, 32, 44)) when 4 # Weight range wt1 = (sel[0] < 0) ? 0 : (sel[0] >= @weightCommands.length) ? 9999 : @weightCommands[sel[0]] @@ -659,14 +659,14 @@ class PokemonPokedex_Scene txt1 = sprintf("%.1f", wt1 / 10.0) txt2 = sprintf("%.1f", wt2 / 10.0) end - textpos.push([txt1, 286, 66, 2, base, shadow, 1]) - textpos.push([txt2, 414, 66, 2, base, shadow, 1]) + textpos.push([txt1, 286, 66, :center, base, shadow, :outline]) + textpos.push([txt2, 414, 66, :center, base, shadow, :outline]) overlay.blt(462, 52, @hwbitmap.bitmap, Rect.new(32, (hwoffset) ? 44 : 0, 32, 44)) when 5 # Color if sel[0] < 0 - textpos.push(["----", 362, 66, 2, base, shadow, 1]) + textpos.push(["----", 362, 66, :center, base, shadow, :outline]) else - textpos.push([cmds[sel[0]].name, 362, 66, 2, base, shadow, 1]) + textpos.push([cmds[sel[0]].name, 362, 66, :center, base, shadow, :outline]) end when 6 # Shape icon if sel[0] >= 0 @@ -676,9 +676,9 @@ class PokemonPokedex_Scene else if sel[0] < 0 text = ["----", "-", "----", "", "", "----", ""][mode] - textpos.push([text, 362, 66, 2, base, shadow, 1]) + textpos.push([text, 362, 66, :center, base, shadow, :outline]) else - textpos.push([cmds[sel[0]], 362, 66, 2, base, shadow, 1]) + textpos.push([cmds[sel[0]], 362, 66, :center, base, shadow, :outline]) end end # Draw selected option(s) button graphic @@ -698,8 +698,8 @@ class PokemonPokedex_Scene overlay.blt(xpos2, ystart, @searchsliderbitmap.bitmap, hwrect) hwrect.y = 96 overlay.blt(xpos1, ystart + ygap, @searchsliderbitmap.bitmap, hwrect) - textpos.push([txt1, xpos1 + halfwidth, ypos1, 2, base, nil, 1]) - textpos.push([txt2, xpos2 + halfwidth, ypos2, 2, base, nil, 1]) + textpos.push([txt1, xpos1 + halfwidth, ypos1, :center, base]) + textpos.push([txt2, xpos2 + halfwidth, ypos2, :center, base]) else sel.length.times do |i| selrect = Rect.new(0, selbuttony, @selbitmap.bitmap.width, selbuttonheight) @@ -720,13 +720,13 @@ class PokemonPokedex_Scene cmds.length.times do |i| x = xstart + halfwidth + ((i % cols) * xgap) y = ystart + 14 + ((i / cols).floor * ygap) - textpos.push([cmds[i], x, y, 2, base, shadow, 1]) + textpos.push([cmds[i], x, y, :center, base, shadow, :outline]) end if mode != 0 textpos.push([(mode == 1) ? "-" : "----", xstart + halfwidth + ((cols - 1) * xgap), ystart + 14 + ((cmds.length / cols).floor * ygap), - 2, base, shadow, 1]) + :center, base, shadow, :outline]) end when 2 # Type typerect = Rect.new(0, 0, 96, 32) @@ -739,17 +739,17 @@ class PokemonPokedex_Scene textpos.push(["----", xstart + halfwidth + ((cols - 1) * xgap), ystart + 14 + ((cmds.length / cols).floor * ygap), - 2, base, shadow, 1]) + :center, base, shadow, :outline]) when 5 # Color cmds.length.times do |i| x = xstart + halfwidth + ((i % cols) * xgap) y = ystart + 14 + ((i / cols).floor * ygap) - textpos.push([cmds[i].name, x, y, 2, base, shadow, 1]) + textpos.push([cmds[i].name, x, y, :center, base, shadow, :outline]) end textpos.push(["----", xstart + halfwidth + ((cols - 1) * xgap), ystart + 14 + ((cmds.length / cols).floor * ygap), - 2, base, shadow, 1]) + :center, base, shadow, :outline]) when 6 # Shape shaperect = Rect.new(0, 0, 60, 60) cmds.length.times do |i| diff --git a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb index 397d37a16..5751c2009 100644 --- a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb +++ b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb @@ -221,18 +221,18 @@ class PokemonPokedexInfo_Scene end textpos = [ [_INTL("{1}{2} {3}", indexText, " ", species_data.name), - 246, 48, 0, Color.new(248, 248, 248), Color.black] + 246, 48, :left, Color.new(248, 248, 248), Color.black] ] if @show_battled_count - textpos.push([_INTL("Number Battled"), 314, 164, 0, base, shadow]) - textpos.push([$player.pokedex.battled_count(@species).to_s, 452, 196, 1, base, shadow]) + textpos.push([_INTL("Number Battled"), 314, 164, :left, base, shadow]) + textpos.push([$player.pokedex.battled_count(@species).to_s, 452, 196, :right, base, shadow]) else - textpos.push([_INTL("Height"), 314, 164, 0, base, shadow]) - textpos.push([_INTL("Weight"), 314, 196, 0, base, shadow]) + textpos.push([_INTL("Height"), 314, 164, :left, base, shadow]) + textpos.push([_INTL("Weight"), 314, 196, :left, base, shadow]) end if $player.owned?(@species) # Write the category - textpos.push([_INTL("{1} Pokémon", species_data.category), 246, 80, 0, base, shadow]) + textpos.push([_INTL("{1} Pokémon", species_data.category), 246, 80, :left, base, shadow]) # Write the height and weight if !@show_battled_count height = species_data.height @@ -240,11 +240,11 @@ class PokemonPokedexInfo_Scene if System.user_language[3..4] == "US" # If the user is in the United States inches = (height / 0.254).round pounds = (weight / 0.45359).round - textpos.push([_ISPRINTF("{1:d}'{2:02d}\"", inches / 12, inches % 12), 460, 164, 1, base, shadow]) - textpos.push([_ISPRINTF("{1:4.1f} lbs.", pounds / 10.0), 494, 196, 1, base, shadow]) + textpos.push([_ISPRINTF("{1:d}'{2:02d}\"", inches / 12, inches % 12), 460, 164, :right, base, shadow]) + textpos.push([_ISPRINTF("{1:4.1f} lbs.", pounds / 10.0), 494, 196, :right, base, shadow]) else - textpos.push([_ISPRINTF("{1:.1f} m", height / 10.0), 470, 164, 1, base, shadow]) - textpos.push([_ISPRINTF("{1:.1f} kg", weight / 10.0), 482, 196, 1, base, shadow]) + textpos.push([_ISPRINTF("{1:.1f} m", height / 10.0), 470, 164, :right, base, shadow]) + textpos.push([_ISPRINTF("{1:.1f} kg", weight / 10.0), 482, 196, :right, base, shadow]) end end # Draw the Pokédex entry text @@ -267,15 +267,15 @@ class PokemonPokedexInfo_Scene end else # Write the category - textpos.push([_INTL("????? Pokémon"), 246, 80, 0, base, shadow]) + textpos.push([_INTL("????? Pokémon"), 246, 80, :left, base, shadow]) # Write the height and weight if !@show_battled_count if System.user_language[3..4] == "US" # If the user is in the United States - textpos.push([_INTL("???'??\""), 460, 164, 1, base, shadow]) - textpos.push([_INTL("????.? lbs."), 494, 196, 1, base, shadow]) + textpos.push([_INTL("???'??\""), 460, 164, :right, base, shadow]) + textpos.push([_INTL("????.? lbs."), 494, 196, :right, base, shadow]) else - textpos.push([_INTL("????.? m"), 470, 164, 1, base, shadow]) - textpos.push([_INTL("????.? kg"), 482, 196, 1, base, shadow]) + textpos.push([_INTL("????.? m"), 470, 164, :right, base, shadow]) + textpos.push([_INTL("????.? kg"), 482, 196, :right, base, shadow]) end end end @@ -378,11 +378,11 @@ class PokemonPokedexInfo_Scene overlay, [["Graphics/UI/Pokedex/overlay_areanone", 108, 188]] ) - textpos.push([_INTL("Area unknown"), Graphics.width / 2, (Graphics.height / 2) + 6, 2, base, shadow]) + textpos.push([_INTL("Area unknown"), Graphics.width / 2, (Graphics.height / 2) + 6, :center, base, shadow]) end - textpos.push([@mapdata.name, 414, 50, 2, base, shadow]) + textpos.push([@mapdata.name, 414, 50, :center, base, shadow]) textpos.push([_INTL("{1}'s area", GameData::Species.get(@species).name), - Graphics.width / 2, 358, 2, base, shadow]) + Graphics.width / 2, 358, :center, base, shadow]) pbDrawTextPositions(overlay, textpos) end @@ -400,8 +400,8 @@ class PokemonPokedexInfo_Scene end end textpos = [ - [GameData::Species.get(@species).name, Graphics.width / 2, Graphics.height - 82, 2, base, shadow], - [formname, Graphics.width / 2, Graphics.height - 50, 2, base, shadow] + [GameData::Species.get(@species).name, Graphics.width / 2, Graphics.height - 82, :center, base, shadow], + [formname, Graphics.width / 2, Graphics.height - 50, :center, base, shadow] ] # Draw all text pbDrawTextPositions(overlay, textpos) diff --git a/Data/Scripts/016_UI/005_UI_Party.rb b/Data/Scripts/016_UI/005_UI_Party.rb index 2fe9710d9..3ec3d2a00 100644 --- a/Data/Scripts/016_UI/005_UI_Party.rb +++ b/Data/Scripts/016_UI/005_UI_Party.rb @@ -19,7 +19,7 @@ class PokemonPartyConfirmCancelSprite < Sprite @overlaysprite = BitmapSprite.new(@bgsprite.bitmap.width, @bgsprite.bitmap.height, viewport) @overlaysprite.z = self.z + 1 pbSetSystemFont(@overlaysprite.bitmap) - textpos = [[text, 56, (narrowbox) ? 8 : 14, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)]] + textpos = [[text, 56, (narrowbox) ? 8 : 14, :center, Color.new(248, 248, 248), Color.new(40, 40, 40)]] pbDrawTextPositions(@overlaysprite.bitmap, textpos) self.x = x self.y = y @@ -373,7 +373,7 @@ class PokemonPartyPanel < Sprite def draw_name pbDrawTextPositions(@overlaysprite.bitmap, - [[@pokemon.name, 96, 22, 0, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]]) + [[@pokemon.name, 96, 22, :left, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]]) end def draw_level @@ -384,7 +384,7 @@ class PokemonPartyPanel < Sprite # Level number pbSetSmallFont(@overlaysprite.bitmap) pbDrawTextPositions(@overlaysprite.bitmap, - [[@pokemon.level.to_s, 42, 68, 0, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]]) + [[@pokemon.level.to_s, 42, 68, :left, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]]) pbSetSystemFont(@overlaysprite.bitmap) end @@ -394,7 +394,7 @@ class PokemonPartyPanel < Sprite base_color = (@pokemon.male?) ? Color.new(0, 112, 248) : Color.new(232, 32, 16) shadow_color = (@pokemon.male?) ? Color.new(120, 184, 232) : Color.new(248, 168, 184) pbDrawTextPositions(@overlaysprite.bitmap, - [[gender_text, 224, 22, 0, base_color, shadow_color]]) + [[gender_text, 224, 22, :left, base_color, shadow_color]]) end def draw_hp @@ -402,7 +402,7 @@ class PokemonPartyPanel < Sprite # HP numbers hp_text = sprintf("% 3d /% 3d", @pokemon.hp, @pokemon.totalhp) pbDrawTextPositions(@overlaysprite.bitmap, - [[hp_text, 224, 66, 1, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]]) + [[hp_text, 224, 66, :right, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]]) # HP bar if @pokemon.able? w = @pokemon.hp * HP_BAR_WIDTH / @pokemon.totalhp.to_f @@ -440,7 +440,7 @@ class PokemonPartyPanel < Sprite def draw_annotation return if !@text || @text.length == 0 pbDrawTextPositions(@overlaysprite.bitmap, - [[@text, 96, 62, 0, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]]) + [[@text, 96, 62, :left, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]]) end def refresh diff --git a/Data/Scripts/016_UI/006_UI_Summary.rb b/Data/Scripts/016_UI/006_UI_Summary.rb index f432f50a8..6af85e36f 100644 --- a/Data/Scripts/016_UI/006_UI_Summary.rb +++ b/Data/Scripts/016_UI/006_UI_Summary.rb @@ -338,22 +338,22 @@ class PokemonSummary_Scene _INTL("MOVES"), _INTL("RIBBONS")][page - 1] textpos = [ - [pagename, 26, 22, 0, base, shadow], - [@pokemon.name, 46, 68, 0, base, shadow], - [@pokemon.level.to_s, 46, 98, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Item"), 66, 324, 0, base, shadow] + [pagename, 26, 22, :left, base, shadow], + [@pokemon.name, 46, 68, :left, base, shadow], + [@pokemon.level.to_s, 46, 98, :left, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Item"), 66, 324, :left, base, shadow] ] # Write the held item's name if @pokemon.hasItem? - textpos.push([@pokemon.item.name, 16, 358, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([@pokemon.item.name, 16, 358, :left, Color.new(64, 64, 64), Color.new(176, 176, 176)]) else - textpos.push([_INTL("None"), 16, 358, 0, Color.new(192, 200, 208), Color.new(208, 216, 224)]) + textpos.push([_INTL("None"), 16, 358, :left, Color.new(192, 200, 208), Color.new(208, 216, 224)]) end # Write the gender symbol if @pokemon.male? - textpos.push([_INTL("♂"), 178, 68, 0, Color.new(24, 112, 216), Color.new(136, 168, 208)]) + textpos.push([_INTL("♂"), 178, 68, :left, Color.new(24, 112, 216), Color.new(136, 168, 208)]) elsif @pokemon.female? - textpos.push([_INTL("♀"), 178, 68, 0, Color.new(248, 56, 32), Color.new(224, 152, 144)]) + textpos.push([_INTL("♀"), 178, 68, :left, Color.new(248, 56, 32), Color.new(224, 152, 144)]) end # Draw all text pbDrawTextPositions(overlay, textpos) @@ -386,12 +386,12 @@ class PokemonSummary_Scene end # Write various bits of text textpos = [ - [_INTL("Dex No."), 238, 86, 0, base, shadow], - [_INTL("Species"), 238, 118, 0, base, shadow], - [@pokemon.speciesName, 435, 118, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Type"), 238, 150, 0, base, shadow], - [_INTL("OT"), 238, 182, 0, base, shadow], - [_INTL("ID No."), 238, 214, 0, base, shadow] + [_INTL("Dex No."), 238, 86, :left, base, shadow], + [_INTL("Species"), 238, 118, :left, base, shadow], + [@pokemon.speciesName, 435, 118, :center, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Type"), 238, 150, :left, base, shadow], + [_INTL("OT"), 238, 182, :left, base, shadow], + [_INTL("ID No."), 238, 214, :left, base, shadow] ] # Write the Regional/National Dex number dexnum = 0 @@ -410,15 +410,15 @@ class PokemonSummary_Scene end end if dexnum <= 0 - textpos.push(["???", 435, 86, 2, dexNumBase, dexNumShadow]) + textpos.push(["???", 435, 86, :center, dexNumBase, dexNumShadow]) else dexnum -= 1 if dexnumshift - textpos.push([sprintf("%03d", dexnum), 435, 86, 2, dexNumBase, dexNumShadow]) + textpos.push([sprintf("%03d", dexnum), 435, 86, :center, dexNumBase, dexNumShadow]) end # Write Original Trainer's name and ID number if @pokemon.owner.name.empty? - textpos.push([_INTL("RENTAL"), 435, 182, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)]) - textpos.push(["?????", 435, 214, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([_INTL("RENTAL"), 435, 182, :center, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push(["?????", 435, 214, :center, Color.new(64, 64, 64), Color.new(176, 176, 176)]) else ownerbase = Color.new(64, 64, 64) ownershadow = Color.new(176, 176, 176) @@ -430,13 +430,13 @@ class PokemonSummary_Scene ownerbase = Color.new(248, 56, 32) ownershadow = Color.new(224, 152, 144) end - textpos.push([@pokemon.owner.name, 435, 182, 2, ownerbase, ownershadow]) - textpos.push([sprintf("%05d", @pokemon.owner.public_id), 435, 214, 2, + textpos.push([@pokemon.owner.name, 435, 182, :center, ownerbase, ownershadow]) + textpos.push([sprintf("%05d", @pokemon.owner.public_id), 435, 214, :center, Color.new(64, 64, 64), Color.new(176, 176, 176)]) end # Write Exp text OR heart gauge message (if a Shadow Pokémon) if @pokemon.shadowPokemon? - textpos.push([_INTL("Heart Gauge"), 238, 246, 0, base, shadow]) + textpos.push([_INTL("Heart Gauge"), 238, 246, :left, base, shadow]) heartmessage = [_INTL("The door to its heart is open! Undo the final lock!"), _INTL("The door to its heart is almost fully open."), _INTL("The door to its heart is nearly open."), @@ -447,10 +447,10 @@ class PokemonSummary_Scene drawFormattedTextEx(overlay, 234, 308, 264, memo) else endexp = @pokemon.growth_rate.minimum_exp_for_level(@pokemon.level + 1) - textpos.push([_INTL("Exp. Points"), 238, 246, 0, base, shadow]) - textpos.push([@pokemon.exp.to_s_formatted, 488, 278, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)]) - textpos.push([_INTL("To Next Lv."), 238, 310, 0, base, shadow]) - textpos.push([(endexp - @pokemon.exp).to_s_formatted, 488, 342, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([_INTL("Exp. Points"), 238, 246, :left, base, shadow]) + textpos.push([@pokemon.exp.to_s_formatted, 488, 278, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([_INTL("To Next Lv."), 238, 310, :left, base, shadow]) + textpos.push([(endexp - @pokemon.exp).to_s_formatted, 488, 342, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)]) end # Draw all text pbDrawTextPositions(overlay, textpos) @@ -486,15 +486,15 @@ class PokemonSummary_Scene pbDrawImagePositions(overlay, imagepos) # Write various bits of text textpos = [ - [_INTL("TRAINER MEMO"), 26, 22, 0, base, shadow], - [@pokemon.name, 46, 68, 0, base, shadow], - [_INTL("Item"), 66, 324, 0, base, shadow] + [_INTL("TRAINER MEMO"), 26, 22, :left, base, shadow], + [@pokemon.name, 46, 68, :left, base, shadow], + [_INTL("Item"), 66, 324, :left, base, shadow] ] # Write the held item's name if @pokemon.hasItem? - textpos.push([@pokemon.item.name, 16, 358, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([@pokemon.item.name, 16, 358, :left, Color.new(64, 64, 64), Color.new(176, 176, 176)]) else - textpos.push([_INTL("None"), 16, 358, 0, Color.new(192, 200, 208), Color.new(208, 216, 224)]) + textpos.push([_INTL("None"), 16, 358, :left, Color.new(192, 200, 208), Color.new(208, 216, 224)]) end # Draw all text pbDrawTextPositions(overlay, textpos) @@ -637,24 +637,24 @@ class PokemonSummary_Scene end # Write various bits of text textpos = [ - [_INTL("HP"), 292, 82, 2, base, statshadows[:HP]], - [sprintf("%d/%d", @pokemon.hp, @pokemon.totalhp), 462, 82, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Attack"), 248, 126, 0, base, statshadows[:ATTACK]], - [@pokemon.attack.to_s, 456, 126, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Defense"), 248, 158, 0, base, statshadows[:DEFENSE]], - [@pokemon.defense.to_s, 456, 158, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Sp. Atk"), 248, 190, 0, base, statshadows[:SPECIAL_ATTACK]], - [@pokemon.spatk.to_s, 456, 190, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Sp. Def"), 248, 222, 0, base, statshadows[:SPECIAL_DEFENSE]], - [@pokemon.spdef.to_s, 456, 222, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Speed"), 248, 254, 0, base, statshadows[:SPEED]], - [@pokemon.speed.to_s, 456, 254, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Ability"), 224, 290, 0, base, shadow] + [_INTL("HP"), 292, 82, :center, base, statshadows[:HP]], + [sprintf("%d/%d", @pokemon.hp, @pokemon.totalhp), 462, 82, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Attack"), 248, 126, :left, base, statshadows[:ATTACK]], + [@pokemon.attack.to_s, 456, 126, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Defense"), 248, 158, :left, base, statshadows[:DEFENSE]], + [@pokemon.defense.to_s, 456, 158, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Sp. Atk"), 248, 190, :left, base, statshadows[:SPECIAL_ATTACK]], + [@pokemon.spatk.to_s, 456, 190, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Sp. Def"), 248, 222, :left, base, statshadows[:SPECIAL_DEFENSE]], + [@pokemon.spdef.to_s, 456, 222, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Speed"), 248, 254, :left, base, statshadows[:SPEED]], + [@pokemon.speed.to_s, 456, 254, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Ability"), 224, 290, :left, base, shadow] ] # Draw ability name and description ability = @pokemon.ability if ability - textpos.push([ability.name, 362, 290, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([ability.name, 362, 290, :left, Color.new(64, 64, 64), Color.new(176, 176, 176)]) drawTextEx(overlay, 224, 322, 282, 2, ability.description, Color.new(64, 64, 64), Color.new(176, 176, 176)) end # Draw all text @@ -698,9 +698,9 @@ class PokemonSummary_Scene if move type_number = GameData::Type.get(move.display_type(@pokemon)).icon_position imagepos.push(["Graphics/UI/types", 248, yPos - 4, 0, type_number * 28, 64, 28]) - textpos.push([move.name, 316, yPos, 0, moveBase, moveShadow]) + textpos.push([move.name, 316, yPos, :left, moveBase, moveShadow]) if move.total_pp > 0 - textpos.push([_INTL("PP"), 342, yPos + 32, 0, moveBase, moveShadow]) + textpos.push([_INTL("PP"), 342, yPos + 32, :left, moveBase, moveShadow]) ppfraction = 0 if move.pp == 0 ppfraction = 3 @@ -709,11 +709,11 @@ class PokemonSummary_Scene elsif move.pp * 2 <= move.total_pp ppfraction = 1 end - textpos.push([sprintf("%d/%d", move.pp, move.total_pp), 460, yPos + 32, 1, ppBase[ppfraction], ppShadow[ppfraction]]) + textpos.push([sprintf("%d/%d", move.pp, move.total_pp), 460, yPos + 32, :right, ppBase[ppfraction], ppShadow[ppfraction]]) end else - textpos.push(["-", 316, yPos, 0, moveBase, moveShadow]) - textpos.push(["--", 442, yPos + 32, 1, moveBase, moveShadow]) + textpos.push(["-", 316, yPos, :left, moveBase, moveShadow]) + textpos.push(["--", 442, yPos + 32, :right, moveBase, moveShadow]) end yPos += 64 end @@ -745,10 +745,10 @@ class PokemonSummary_Scene end # Write various bits of text textpos = [ - [_INTL("MOVES"), 26, 22, 0, base, shadow], - [_INTL("CATEGORY"), 20, 128, 0, base, shadow], - [_INTL("POWER"), 20, 160, 0, base, shadow], - [_INTL("ACCURACY"), 20, 192, 0, base, shadow] + [_INTL("MOVES"), 26, 22, :left, base, shadow], + [_INTL("CATEGORY"), 20, 128, :left, base, shadow], + [_INTL("POWER"), 20, 160, :left, base, shadow], + [_INTL("ACCURACY"), 20, 192, :left, base, shadow] ] imagepos = [] # Write move names, types and PP amounts for each known move @@ -764,9 +764,9 @@ class PokemonSummary_Scene if move type_number = GameData::Type.get(move.display_type(@pokemon)).icon_position imagepos.push(["Graphics/UI/types", 248, yPos - 4, 0, type_number * 28, 64, 28]) - textpos.push([move.name, 316, yPos, 0, moveBase, moveShadow]) + textpos.push([move.name, 316, yPos, :left, moveBase, moveShadow]) if move.total_pp > 0 - textpos.push([_INTL("PP"), 342, yPos + 32, 0, moveBase, moveShadow]) + textpos.push([_INTL("PP"), 342, yPos + 32, :left, moveBase, moveShadow]) ppfraction = 0 if move.pp == 0 ppfraction = 3 @@ -775,11 +775,12 @@ class PokemonSummary_Scene elsif move.pp * 2 <= move.total_pp ppfraction = 1 end - textpos.push([sprintf("%d/%d", move.pp, move.total_pp), 460, yPos + 32, 1, ppBase[ppfraction], ppShadow[ppfraction]]) + textpos.push([sprintf("%d/%d", move.pp, move.total_pp), 460, yPos + 32, :right, + ppBase[ppfraction], ppShadow[ppfraction]]) end else - textpos.push(["-", 316, yPos, 0, moveBase, moveShadow]) - textpos.push(["--", 442, yPos + 32, 1, moveBase, moveShadow]) + textpos.push(["-", 316, yPos, :left, moveBase, moveShadow]) + textpos.push(["--", 442, yPos + 32, :right, moveBase, moveShadow]) end yPos += 64 end @@ -809,14 +810,14 @@ class PokemonSummary_Scene textpos = [] # Write power and accuracy values for selected move case selected_move.display_damage(@pokemon) - when 0 then textpos.push(["---", 216, 160, 1, base, shadow]) # Status move - when 1 then textpos.push(["???", 216, 160, 1, base, shadow]) # Variable power move - else textpos.push([selected_move.display_damage(@pokemon).to_s, 216, 160, 1, base, shadow]) + when 0 then textpos.push(["---", 216, 160, :right, base, shadow]) # Status move + when 1 then textpos.push(["???", 216, 160, :right, base, shadow]) # Variable power move + else textpos.push([selected_move.display_damage(@pokemon).to_s, 216, 160, :right, base, shadow]) end if selected_move.display_accuracy(@pokemon) == 0 - textpos.push(["---", 216, 192, 1, base, shadow]) + textpos.push(["---", 216, 192, :right, base, shadow]) else - textpos.push(["#{selected_move.display_accuracy(@pokemon)}%", 216 + overlay.text_size("%").width, 192, 1, base, shadow]) + textpos.push(["#{selected_move.display_accuracy(@pokemon)}%", 216 + overlay.text_size("%").width, 192, :right, base, shadow]) end # Draw all text pbDrawTextPositions(overlay, textpos) @@ -833,8 +834,8 @@ class PokemonSummary_Scene @sprites["downarrow"].visible = false # Write various bits of text textpos = [ - [_INTL("No. of Ribbons:"), 234, 338, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [@pokemon.numRibbons.to_s, 450, 338, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)] + [_INTL("No. of Ribbons:"), 234, 338, :left, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [@pokemon.numRibbons.to_s, 450, 338, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)] ] # Draw all text pbDrawTextPositions(overlay, textpos) @@ -873,7 +874,7 @@ class PokemonSummary_Scene pbDrawImagePositions(overlay, imagepos) # Draw name of selected ribbon textpos = [ - [name, 18, 292, 0, nameBase, nameShadow] + [name, 18, 292, :left, nameBase, nameShadow] ] pbDrawTextPositions(overlay, textpos) # Draw selected ribbon's description @@ -1082,9 +1083,9 @@ class PokemonSummary_Scene @markingbitmap.bitmap, markrect) end textpos = [ - [_INTL("Mark {1}", pokemon.name), 366, 102, 2, base, shadow], - [_INTL("OK"), 366, 254, 2, base, shadow], - [_INTL("Cancel"), 366, 304, 2, base, shadow] + [_INTL("Mark {1}", pokemon.name), 366, 102, :center, base, shadow], + [_INTL("OK"), 366, 254, :center, base, shadow], + [_INTL("Cancel"), 366, 304, :center, base, shadow] ] pbDrawTextPositions(@sprites["markingoverlay"].bitmap, textpos) redraw = false diff --git a/Data/Scripts/016_UI/007_UI_Bag.rb b/Data/Scripts/016_UI/007_UI_Bag.rb index e4d3ae9a3..b04fb31cb 100644 --- a/Data/Scripts/016_UI/007_UI_Bag.rb +++ b/Data/Scripts/016_UI/007_UI_Bag.rb @@ -66,7 +66,7 @@ class Window_PokemonBag < Window_DrawableCommand rect = Rect.new(rect.x + 16, rect.y + 16, rect.width - 16, rect.height) thispocket = @bag.pockets[@pocket] if index == self.itemCount - 1 - textpos.push([_INTL("CLOSE BAG"), rect.x, rect.y + 2, false, self.baseColor, self.shadowColor]) + textpos.push([_INTL("CLOSE BAG"), rect.x, rect.y + 2, :left, self.baseColor, self.shadowColor]) else item = (@filterlist) ? thispocket[@filterlist[@pocket][index]][0] : thispocket[index][0] baseColor = self.baseColor @@ -76,7 +76,7 @@ class Window_PokemonBag < Window_DrawableCommand shadowColor = Color.new(248, 144, 144) end textpos.push( - [@adapter.getDisplayName(item), rect.x, rect.y + 2, false, baseColor, shadowColor] + [@adapter.getDisplayName(item), rect.x, rect.y + 2, :left, baseColor, shadowColor] ) if GameData::Item.get(item).is_important? if @bag.registered?(item) @@ -94,7 +94,7 @@ class Window_PokemonBag < Window_DrawableCommand qty = (@filterlist) ? thispocket[@filterlist[@pocket][index]][1] : thispocket[index][1] qtytext = _ISPRINTF("x{1: 3d}", qty) xQty = rect.x + rect.width - self.contents.text_size(qtytext).width - 16 - textpos.push([qtytext, xQty, rect.y + 2, false, baseColor, shadowColor]) + textpos.push([qtytext, xQty, rect.y + 2, :left, baseColor, shadowColor]) end end pbDrawTextPositions(self.contents, textpos) @@ -293,7 +293,7 @@ class PokemonBag_Scene # Draw the pocket name pbDrawTextPositions( overlay, - [[PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 186, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]] + [[PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 186, :center, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]] ) # Draw slider arrows showslider = false diff --git a/Data/Scripts/016_UI/008_UI_Pokegear.rb b/Data/Scripts/016_UI/008_UI_Pokegear.rb index 9a6cc5889..041437d9b 100644 --- a/Data/Scripts/016_UI/008_UI_Pokegear.rb +++ b/Data/Scripts/016_UI/008_UI_Pokegear.rb @@ -45,7 +45,7 @@ class PokegearButton < Sprite rect.y = @button.height / 2 if @selected self.bitmap.blt(0, 0, @button.bitmap, rect) textpos = [ - [@name, rect.width / 2, (rect.height / 2) - 10, 2, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR] + [@name, rect.width / 2, (rect.height / 2) - 10, :center, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR] ] pbDrawTextPositions(self.bitmap, textpos) imagepos = [ diff --git a/Data/Scripts/016_UI/009_UI_RegionMap.rb b/Data/Scripts/016_UI/009_UI_RegionMap.rb index b9d12bbb6..dbffedcac 100644 --- a/Data/Scripts/016_UI/009_UI_RegionMap.rb +++ b/Data/Scripts/016_UI/009_UI_RegionMap.rb @@ -39,9 +39,9 @@ class MapBottomSprite < Sprite def refresh bitmap.clear textpos = [ - [@mapname, 18, 4, 0, TEXT_MAIN_COLOR, TEXT_SHADOW_COLOR], - [@maplocation, 18, 360, 0, TEXT_MAIN_COLOR, TEXT_SHADOW_COLOR], - [@mapdetails, Graphics.width - 16, 360, 1, TEXT_MAIN_COLOR, TEXT_SHADOW_COLOR] + [@mapname, 18, 4, :left, TEXT_MAIN_COLOR, TEXT_SHADOW_COLOR], + [@maplocation, 18, 360, :left, TEXT_MAIN_COLOR, TEXT_SHADOW_COLOR], + [@mapdetails, Graphics.width - 16, 360, :right, TEXT_MAIN_COLOR, TEXT_SHADOW_COLOR] ] pbDrawTextPositions(bitmap, textpos) end @@ -236,7 +236,7 @@ class PokemonRegionMap_Scene text = (@mode == 0) ? _INTL("ACTION: Fly") : _INTL("ACTION: Cancel Fly") pbDrawTextPositions( @sprites["help"].bitmap, - [[text, Graphics.width - 16, 4, 1, Color.new(248, 248, 248), Color.black]] + [[text, Graphics.width - 16, 4, :right, Color.new(248, 248, 248), Color.black]] ) @sprites.each do |key, sprite| next if !key.include?("point") diff --git a/Data/Scripts/016_UI/012_UI_TrainerCard.rb b/Data/Scripts/016_UI/012_UI_TrainerCard.rb index a06e45686..d787ab116 100644 --- a/Data/Scripts/016_UI/012_UI_TrainerCard.rb +++ b/Data/Scripts/016_UI/012_UI_TrainerCard.rb @@ -49,18 +49,18 @@ class PokemonTrainerCard_Scene $PokemonGlobal.startTime.day, $PokemonGlobal.startTime.year) textPositions = [ - [_INTL("Name"), 34, 70, 0, baseColor, shadowColor], - [$player.name, 302, 70, 1, baseColor, shadowColor], - [_INTL("ID No."), 332, 70, 0, baseColor, shadowColor], - [sprintf("%05d", $player.public_ID), 468, 70, 1, baseColor, shadowColor], - [_INTL("Money"), 34, 118, 0, baseColor, shadowColor], - [_INTL("${1}", $player.money.to_s_formatted), 302, 118, 1, baseColor, shadowColor], - [_INTL("Pokédex"), 34, 166, 0, baseColor, shadowColor], - [sprintf("%d/%d", $player.pokedex.owned_count, $player.pokedex.seen_count), 302, 166, 1, baseColor, shadowColor], - [_INTL("Time"), 34, 214, 0, baseColor, shadowColor], - [time, 302, 214, 1, baseColor, shadowColor], - [_INTL("Started"), 34, 262, 0, baseColor, shadowColor], - [starttime, 302, 262, 1, baseColor, shadowColor] + [_INTL("Name"), 34, 70, :left, baseColor, shadowColor], + [$player.name, 302, 70, :right, baseColor, shadowColor], + [_INTL("ID No."), 332, 70, :left, baseColor, shadowColor], + [sprintf("%05d", $player.public_ID), 468, 70, :right, baseColor, shadowColor], + [_INTL("Money"), 34, 118, :left, baseColor, shadowColor], + [_INTL("${1}", $player.money.to_s_formatted), 302, 118, :right, baseColor, shadowColor], + [_INTL("Pokédex"), 34, 166, :left, baseColor, shadowColor], + [sprintf("%d/%d", $player.pokedex.owned_count, $player.pokedex.seen_count), 302, 166, :right, baseColor, shadowColor], + [_INTL("Time"), 34, 214, :left, baseColor, shadowColor], + [time, 302, 214, :right, baseColor, shadowColor], + [_INTL("Started"), 34, 262, :left, baseColor, shadowColor], + [starttime, 302, 262, :right, baseColor, shadowColor] ] pbDrawTextPositions(overlay, textPositions) x = 72 diff --git a/Data/Scripts/016_UI/013_UI_Load.rb b/Data/Scripts/016_UI/013_UI_Load.rb index 2d7235909..ec4735d35 100644 --- a/Data/Scripts/016_UI/013_UI_Load.rb +++ b/Data/Scripts/016_UI/013_UI_Load.rb @@ -62,31 +62,31 @@ class PokemonLoadPanel < Sprite end textpos = [] if @isContinue - textpos.push([@title, 32, 16, 0, TEXTCOLOR, TEXTSHADOWCOLOR]) - textpos.push([_INTL("Badges:"), 32, 118, 0, TEXTCOLOR, TEXTSHADOWCOLOR]) - textpos.push([@trainer.badge_count.to_s, 206, 118, 1, TEXTCOLOR, TEXTSHADOWCOLOR]) - textpos.push([_INTL("Pokédex:"), 32, 150, 0, TEXTCOLOR, TEXTSHADOWCOLOR]) - textpos.push([@trainer.pokedex.seen_count.to_s, 206, 150, 1, TEXTCOLOR, TEXTSHADOWCOLOR]) - textpos.push([_INTL("Time:"), 32, 182, 0, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([@title, 32, 16, :left, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([_INTL("Badges:"), 32, 118, :left, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([@trainer.badge_count.to_s, 206, 118, :right, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([_INTL("Pokédex:"), 32, 150, :left, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([@trainer.pokedex.seen_count.to_s, 206, 150, :right, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([_INTL("Time:"), 32, 182, :left, TEXTCOLOR, TEXTSHADOWCOLOR]) hour = @totalsec / 60 / 60 min = @totalsec / 60 % 60 if hour > 0 - textpos.push([_INTL("{1}h {2}m", hour, min), 206, 182, 1, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([_INTL("{1}h {2}m", hour, min), 206, 182, :right, TEXTCOLOR, TEXTSHADOWCOLOR]) else - textpos.push([_INTL("{1}m", min), 206, 182, 1, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([_INTL("{1}m", min), 206, 182, :right, TEXTCOLOR, TEXTSHADOWCOLOR]) end if @trainer.male? - textpos.push([@trainer.name, 112, 70, 0, MALETEXTCOLOR, MALETEXTSHADOWCOLOR]) + textpos.push([@trainer.name, 112, 70, :left, MALETEXTCOLOR, MALETEXTSHADOWCOLOR]) elsif @trainer.female? - textpos.push([@trainer.name, 112, 70, 0, FEMALETEXTCOLOR, FEMALETEXTSHADOWCOLOR]) + textpos.push([@trainer.name, 112, 70, :left, FEMALETEXTCOLOR, FEMALETEXTSHADOWCOLOR]) else - textpos.push([@trainer.name, 112, 70, 0, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([@trainer.name, 112, 70, :left, TEXTCOLOR, TEXTSHADOWCOLOR]) end mapname = pbGetMapNameFromId(@mapid) mapname.gsub!(/\\PN/, @trainer.name) - textpos.push([mapname, 386, 16, 1, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([mapname, 386, 16, :right, TEXTCOLOR, TEXTSHADOWCOLOR]) else - textpos.push([@title, 32, 14, 0, TEXTCOLOR, TEXTSHADOWCOLOR]) + textpos.push([@title, 32, 14, :left, TEXTCOLOR, TEXTSHADOWCOLOR]) end pbDrawTextPositions(self.bitmap, textpos) end diff --git a/Data/Scripts/016_UI/016_UI_ReadyMenu.rb b/Data/Scripts/016_UI/016_UI_ReadyMenu.rb index c4cf9db94..bc5b56963 100644 --- a/Data/Scripts/016_UI/016_UI_ReadyMenu.rb +++ b/Data/Scripts/016_UI/016_UI_ReadyMenu.rb @@ -71,16 +71,16 @@ class ReadyMenuButton < Sprite self.bitmap.blt(0, 0, @button.bitmap, rect) textx = (@command[2]) ? 164 : (GameData::Item.get(@command[0]).is_important?) ? 146 : 124 textpos = [ - [@command[1], textx, 24, 2, Color.new(248, 248, 248), Color.new(40, 40, 40), 1] + [@command[1], textx, 24, :center, Color.new(248, 248, 248), Color.new(40, 40, 40), :outline] ] if !@command[2] && !GameData::Item.get(@command[0]).is_important? qty = $bag.quantity(@command[0]) if qty > 99 - textpos.push([_INTL(">99"), 230, 24, 1, - Color.new(248, 248, 248), Color.new(40, 40, 40), 1]) + textpos.push([_INTL(">99"), 230, 24, :right, + Color.new(248, 248, 248), Color.new(40, 40, 40), :outline]) else - textpos.push([_INTL("x{1}", qty), 230, 24, 1, - Color.new(248, 248, 248), Color.new(40, 40, 40), 1]) + textpos.push([_INTL("x{1}", qty), 230, 24, :right, + Color.new(248, 248, 248), Color.new(40, 40, 40), :outline]) end end pbDrawTextPositions(self.bitmap, textpos) diff --git a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb index 2fc8b96be..f83856990 100644 --- a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb +++ b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb @@ -529,7 +529,7 @@ class PokemonBoxPartySprite < Sprite @contents.blt(0, 0, @boxbitmap.bitmap, Rect.new(0, 0, 172, 352)) pbDrawTextPositions( self.bitmap, - [[_INTL("Back"), 86, 248, 2, Color.new(248, 248, 248), Color.new(80, 80, 80), 1]] + [[_INTL("Back"), 86, 248, :center, Color.new(248, 248, 248), Color.new(80, 80, 80), :outline]] ) xvalues = [] # [18, 90, 18, 90, 18, 90] yvalues = [] # [2, 18, 66, 82, 130, 146] @@ -1322,8 +1322,8 @@ class PokemonStorageScene @markingbitmap.bitmap, markrect) end textpos = [ - [_INTL("OK"), 402, 216, 2, base, shadow, 1], - [_INTL("Cancel"), 402, 280, 2, base, shadow, 1] + [_INTL("OK"), 402, 216, :center, base, shadow, :outline], + [_INTL("Cancel"), 402, 280, :center, base, shadow, :outline] ] pbDrawTextPositions(@sprites["markingoverlay"].bitmap, textpos) pbMarkingSetArrow(@sprites["arrow"], index) @@ -1396,8 +1396,8 @@ class PokemonStorageScene buttonshadow = Color.new(80, 80, 80) pbDrawTextPositions( overlay, - [[_INTL("Party: {1}", (@storage.party.length rescue 0)), 270, 334, 2, buttonbase, buttonshadow, 1], - [_INTL("Exit"), 446, 334, 2, buttonbase, buttonshadow, 1]] + [[_INTL("Party: {1}", (@storage.party.length rescue 0)), 270, 334, :center, buttonbase, buttonshadow, :outline], + [_INTL("Exit"), 446, 334, :center, buttonbase, buttonshadow, :outline]] ) pokemon = nil if @screen.pbHeldPokemon @@ -1416,26 +1416,26 @@ class PokemonStorageScene nonshadow = Color.new(224, 224, 224) pokename = pokemon.name textstrings = [ - [pokename, 10, 14, false, base, shadow] + [pokename, 10, 14, :left, base, shadow] ] if !pokemon.egg? imagepos = [] if pokemon.male? - textstrings.push([_INTL("♂"), 148, 14, false, Color.new(24, 112, 216), Color.new(136, 168, 208)]) + textstrings.push([_INTL("♂"), 148, 14, :left, Color.new(24, 112, 216), Color.new(136, 168, 208)]) elsif pokemon.female? - textstrings.push([_INTL("♀"), 148, 14, false, Color.new(248, 56, 32), Color.new(224, 152, 144)]) + textstrings.push([_INTL("♀"), 148, 14, :left, Color.new(248, 56, 32), Color.new(224, 152, 144)]) end imagepos.push(["Graphics/UI/Storage/overlay_lv", 6, 246]) - textstrings.push([pokemon.level.to_s, 28, 240, false, base, shadow]) + textstrings.push([pokemon.level.to_s, 28, 240, :left, base, shadow]) if pokemon.ability - textstrings.push([pokemon.ability.name, 86, 312, 2, base, shadow]) + textstrings.push([pokemon.ability.name, 86, 312, :center, base, shadow]) else - textstrings.push([_INTL("No ability"), 86, 312, 2, nonbase, nonshadow]) + textstrings.push([_INTL("No ability"), 86, 312, :center, nonbase, nonshadow]) end if pokemon.item - textstrings.push([pokemon.item.name, 86, 348, 2, base, shadow]) + textstrings.push([pokemon.item.name, 86, 348, :center, base, shadow]) else - textstrings.push([_INTL("No item"), 86, 348, 2, nonbase, nonshadow]) + textstrings.push([_INTL("No item"), 86, 348, :center, nonbase, nonshadow]) end imagepos.push(["Graphics/UI/shiny", 156, 198]) if pokemon.shiny? typebitmap = AnimatedBitmap.new(_INTL("Graphics/UI/types")) diff --git a/Data/Scripts/016_UI/018_UI_ItemStorage.rb b/Data/Scripts/016_UI/018_UI_ItemStorage.rb index 532e703fc..d5e0ec166 100644 --- a/Data/Scripts/016_UI/018_UI_ItemStorage.rb +++ b/Data/Scripts/016_UI/018_UI_ItemStorage.rb @@ -32,17 +32,17 @@ class Window_PokemonItemStorage < Window_DrawableCommand rect = drawCursor(index, rect) textpos = [] if index == @bag.length - textpos.push([_INTL("CANCEL"), rect.x, rect.y, false, self.baseColor, self.shadowColor]) + textpos.push([_INTL("CANCEL"), rect.x, rect.y, :left, self.baseColor, self.shadowColor]) else item = @bag[index][0] itemname = @adapter.getDisplayName(item) baseColor = (index == @sortIndex) ? Color.new(248, 24, 24) : self.baseColor - textpos.push([itemname, rect.x, rect.y, false, self.baseColor, self.shadowColor]) + textpos.push([itemname, rect.x, rect.y, :left, self.baseColor, self.shadowColor]) if !GameData::Item.get(item).is_important? # Not a Key item/HM/TM qty = _ISPRINTF("x{1: 2d}", @bag[index][1]) sizeQty = self.contents.text_size(qty).width xQty = rect.x + rect.width - sizeQty - 2 - textpos.push([qty, xQty, rect.y, false, baseColor, self.shadowColor]) + textpos.push([qty, xQty, rect.y, :left, baseColor, self.shadowColor]) end end pbDrawTextPositions(self.contents, textpos) diff --git a/Data/Scripts/016_UI/020_UI_PokeMart.rb b/Data/Scripts/016_UI/020_UI_PokeMart.rb index 73fc2a828..80e5a8860 100644 --- a/Data/Scripts/016_UI/020_UI_PokeMart.rb +++ b/Data/Scripts/016_UI/020_UI_PokeMart.rb @@ -200,15 +200,15 @@ class Window_PokemonMart < Window_DrawableCommand rect = drawCursor(index, rect) ypos = rect.y if index == count - 1 - textpos.push([_INTL("CANCEL"), rect.x, ypos + 2, false, self.baseColor, self.shadowColor]) + textpos.push([_INTL("CANCEL"), rect.x, ypos + 2, :left, self.baseColor, self.shadowColor]) else item = @stock[index] itemname = @adapter.getDisplayName(item) qty = @adapter.getDisplayPrice(item) sizeQty = self.contents.text_size(qty).width xQty = rect.x + rect.width - sizeQty - 2 - 16 - textpos.push([itemname, rect.x, ypos + 2, false, self.baseColor, self.shadowColor]) - textpos.push([qty, xQty, ypos + 2, false, self.baseColor, self.shadowColor]) + textpos.push([itemname, rect.x, ypos + 2, :left, self.baseColor, self.shadowColor]) + textpos.push([qty, xQty, ypos + 2, :left, self.baseColor, self.shadowColor]) end pbDrawTextPositions(self.contents, textpos) end diff --git a/Data/Scripts/016_UI/021_UI_BattlePointShop.rb b/Data/Scripts/016_UI/021_UI_BattlePointShop.rb index 3d5d51c82..7fdb5a0ea 100644 --- a/Data/Scripts/016_UI/021_UI_BattlePointShop.rb +++ b/Data/Scripts/016_UI/021_UI_BattlePointShop.rb @@ -115,15 +115,15 @@ class Window_BattlePointShop < Window_DrawableCommand rect = drawCursor(index, rect) ypos = rect.y if index == count - 1 - textpos.push([_INTL("CANCEL"), rect.x, ypos + 2, false, self.baseColor, self.shadowColor]) + textpos.push([_INTL("CANCEL"), rect.x, ypos + 2, :left, self.baseColor, self.shadowColor]) else item = @stock[index] itemname = @adapter.getDisplayName(item) qty = @adapter.getDisplayPrice(item) sizeQty = self.contents.text_size(qty).width xQty = rect.x + rect.width - sizeQty - 2 - 16 - textpos.push([itemname, rect.x, ypos + 2, false, self.baseColor, self.shadowColor]) - textpos.push([qty, xQty, ypos + 2, false, self.baseColor, self.shadowColor]) + textpos.push([itemname, rect.x, ypos + 2, :left, self.baseColor, self.shadowColor]) + textpos.push([qty, xQty, ypos + 2, :left, self.baseColor, self.shadowColor]) end pbDrawTextPositions(self.contents, textpos) end diff --git a/Data/Scripts/016_UI/022_UI_MoveRelearner.rb b/Data/Scripts/016_UI/022_UI_MoveRelearner.rb index 678aa3ead..77059f779 100644 --- a/Data/Scripts/016_UI/022_UI_MoveRelearner.rb +++ b/Data/Scripts/016_UI/022_UI_MoveRelearner.rb @@ -59,7 +59,7 @@ class MoveRelearner_Scene overlay.blt(type_x, 70, @typebitmap.bitmap, type_rect) end textpos = [ - [_INTL("Teach which move?"), 16, 14, 0, Color.new(88, 88, 80), Color.new(168, 184, 184)] + [_INTL("Teach which move?"), 16, 14, :left, Color.new(88, 88, 80), Color.new(168, 184, 184)] ] imagepos = [] yPos = 88 @@ -69,13 +69,13 @@ class MoveRelearner_Scene moveData = GameData::Move.get(moveobject) type_number = GameData::Type.get(moveData.display_type(@pokemon)).icon_position imagepos.push(["Graphics/UI/types", 12, yPos - 4, 0, type_number * 28, 64, 28]) - textpos.push([moveData.name, 80, yPos, 0, Color.new(248, 248, 248), Color.black]) - textpos.push([_INTL("PP"), 112, yPos + 32, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([moveData.name, 80, yPos, :left, Color.new(248, 248, 248), Color.black]) + textpos.push([_INTL("PP"), 112, yPos + 32, :left, Color.new(64, 64, 64), Color.new(176, 176, 176)]) if moveData.total_pp > 0 - textpos.push([_INTL("{1}/{1}", moveData.total_pp), 230, yPos + 32, 1, + textpos.push([_INTL("{1}/{1}", moveData.total_pp), 230, yPos + 32, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)]) else - textpos.push(["--", 230, yPos + 32, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push(["--", 230, yPos + 32, :right, Color.new(64, 64, 64), Color.new(176, 176, 176)]) end end yPos += 64 @@ -87,13 +87,13 @@ class MoveRelearner_Scene power = selMoveData.display_damage(@pokemon) category = selMoveData.display_category(@pokemon) accuracy = selMoveData.display_accuracy(@pokemon) - textpos.push([_INTL("CATEGORY"), 272, 120, 0, Color.new(248, 248, 248), Color.black]) - textpos.push([_INTL("POWER"), 272, 152, 0, Color.new(248, 248, 248), Color.black]) - textpos.push([power <= 1 ? power == 1 ? "???" : "---" : power.to_s, - 468, 152, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)]) - textpos.push([_INTL("ACCURACY"), 272, 184, 0, Color.new(248, 248, 248), Color.black]) - textpos.push([accuracy == 0 ? "---" : "#{accuracy}%", - 468, 184, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([_INTL("CATEGORY"), 272, 120, :left, Color.new(248, 248, 248), Color.black]) + textpos.push([_INTL("POWER"), 272, 152, :left, Color.new(248, 248, 248), Color.black]) + textpos.push([power <= 1 ? power == 1 ? "???" : "---" : power.to_s, 468, 152, :center, + Color.new(64, 64, 64), Color.new(176, 176, 176)]) + textpos.push([_INTL("ACCURACY"), 272, 184, :left, Color.new(248, 248, 248), Color.black]) + textpos.push([accuracy == 0 ? "---" : "#{accuracy}%", 468, 184, :center, + Color.new(64, 64, 64), Color.new(176, 176, 176)]) pbDrawTextPositions(overlay, textpos) imagepos.push(["Graphics/UI/category", 436, 116, 0, category * 28, 64, 28]) if @sprites["commands"].index < @moves.length - 1 diff --git a/Data/Scripts/016_UI/023_UI_PurifyChamber.rb b/Data/Scripts/016_UI/023_UI_PurifyChamber.rb index fd7bd2db3..292dae0ca 100644 --- a/Data/Scripts/016_UI/023_UI_PurifyChamber.rb +++ b/Data/Scripts/016_UI/023_UI_PurifyChamber.rb @@ -648,9 +648,9 @@ class Window_PurifyChamberSets < Window_DrawableCommand textpos = [] rect = drawCursor(index, rect) if index == @switching - textpos.push([(index + 1).to_s, rect.x, rect.y, false, Color.new(248, 0, 0), self.shadowColor]) + textpos.push([(index + 1).to_s, rect.x, rect.y, :left, Color.new(248, 0, 0), self.shadowColor]) else - textpos.push([(index + 1).to_s, rect.x, rect.y, false, self.baseColor, self.shadowColor]) + textpos.push([(index + 1).to_s, rect.x, rect.y, :left, self.baseColor, self.shadowColor]) end if @chamber.setCount(index) > 0 pbDrawGauge(self.contents, Rect.new(rect.x + 16, rect.y + 6, 48, 8), @@ -942,8 +942,8 @@ class PurifyChamberSetView < Sprite type_string += GameData::Type.get(type).name end textpos.push([_INTL("{1} Lv.{2} {3}", pkmn.name, pkmn.level, type_string), - 2, 6, 0, Color.new(248, 248, 248), Color.new(128, 128, 128)]) - textpos.push([_INTL("FLOW"), 2 + (@info.bitmap.width / 2), 30, 0, + 2, 6, :left, Color.new(248, 248, 248), Color.new(128, 128, 128)]) + textpos.push([_INTL("FLOW"), 2 + (@info.bitmap.width / 2), 30, :left, Color.new(248, 248, 248), Color.new(128, 128, 128)]) # draw heart gauge pbDrawGauge(@info.bitmap, Rect.new(@info.bitmap.width * 3 / 4, 8, @info.bitmap.width * 1 / 4, 8), @@ -953,8 +953,7 @@ class PurifyChamberSetView < Sprite Color.new(0, 0, 248), @chamber.chamberFlow(@set), 7) end if @chamber.setCount(@set) > 0 - textpos.push([_INTL("TEMPO"), 2, 30, 0, - Color.new(248, 248, 248), Color.new(128, 128, 128)]) + textpos.push([_INTL("TEMPO"), 2, 30, :left, Color.new(248, 248, 248), Color.new(128, 128, 128)]) # draw tempo gauge pbDrawGauge(@info.bitmap, Rect.new(@info.bitmap.width * 1 / 4, 32, @info.bitmap.width * 1 / 4, 8), Color.new(0, 0, 248), @chamber[@set].tempo, PurifyChamber.maximumTempo) diff --git a/Data/Scripts/016_UI/025_UI_TextEntry.rb b/Data/Scripts/016_UI/025_UI_TextEntry.rb index 20f7c35eb..c1deb82ff 100644 --- a/Data/Scripts/016_UI/025_UI_TextEntry.rb +++ b/Data/Scripts/016_UI/025_UI_TextEntry.rb @@ -149,9 +149,9 @@ class PokemonEntryScene pbSetSystemFont(@sprites["gender"].bitmap) textpos = [] if pokemon.male? - textpos.push([_INTL("♂"), 0, 6, false, Color.new(0, 128, 248), Color.new(168, 184, 184)]) + textpos.push([_INTL("♂"), 0, 6, :left, Color.new(0, 128, 248), Color.new(168, 184, 184)]) elsif pokemon.female? - textpos.push([_INTL("♀"), 0, 6, false, Color.new(248, 24, 24), Color.new(168, 184, 184)]) + textpos.push([_INTL("♀"), 0, 6, :left, Color.new(248, 24, 24), Color.new(168, 184, 184)]) end pbDrawTextPositions(@sprites["gender"].bitmap, textpos) end @@ -383,7 +383,7 @@ class PokemonEntryScene2 COLUMNS.times do |y| ROWS.times do |x| pos = (y * ROWS) + x - textPos.push([@@Characters[i][0][pos], 44 + (x * 32), 24 + (y * 38), 2, + textPos.push([@@Characters[i][0][pos], 44 + (x * 32), 24 + (y * 38), :center, Color.new(16, 24, 32), Color.new(160, 160, 160)]) end end @@ -430,9 +430,9 @@ class PokemonEntryScene2 pbSetSystemFont(@sprites["gender"].bitmap) textpos = [] if pokemon.male? - textpos.push([_INTL("♂"), 0, 6, false, Color.new(0, 128, 248), Color.new(168, 184, 184)]) + textpos.push([_INTL("♂"), 0, 6, :left, Color.new(0, 128, 248), Color.new(168, 184, 184)]) elsif pokemon.female? - textpos.push([_INTL("♀"), 0, 6, false, Color.new(248, 24, 24), Color.new(168, 184, 184)]) + textpos.push([_INTL("♀"), 0, 6, :left, Color.new(248, 24, 24), Color.new(168, 184, 184)]) end pbDrawTextPositions(@sprites["gender"].bitmap, textpos) end @@ -507,12 +507,12 @@ class PokemonEntryScene2 bgoverlay.clear pbSetSystemFont(bgoverlay) textPositions = [ - [@helptext, 160, 18, false, Color.new(16, 24, 32), Color.new(168, 184, 184)] + [@helptext, 160, 18, :left, Color.new(16, 24, 32), Color.new(168, 184, 184)] ] chars = @helper.textChars x = 172 chars.each do |ch| - textPositions.push([ch, x, 54, 2, Color.new(16, 24, 32), Color.new(168, 184, 184)]) + textPositions.push([ch, x, 54, :center, Color.new(16, 24, 32), Color.new(168, 184, 184)]) x += 24 end pbDrawTextPositions(bgoverlay, textPositions) diff --git a/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb b/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb index 5ab7eecff..f180a4815 100644 --- a/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb +++ b/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb @@ -200,8 +200,8 @@ class TriadScene pbSetSystemFont(@sprites["overlay"].bitmap) pbDrawTextPositions( @sprites["overlay"].bitmap, - [[@battle.opponentName, 52, 10, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)], - [@battle.playerName, Graphics.width - 52, 10, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)]] + [[@battle.opponentName, 52, 10, :center, Color.new(248, 248, 248), Color.new(96, 96, 96)], + [@battle.playerName, Graphics.width - 52, 10, :center, Color.new(248, 248, 248), Color.new(96, 96, 96)]] ) @sprites["score"] = Sprite.new(@viewport) @sprites["score"].bitmap = BitmapWrapper.new(Graphics.width, Graphics.height) @@ -578,7 +578,7 @@ class TriadScene end pbDrawTextPositions( bitmap, - [[_INTL("{1}-{2}", oppscore, playerscore), Graphics.width / 2, 10, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)]] + [[_INTL("{1}-{2}", oppscore, playerscore), Graphics.width / 2, 10, :center, Color.new(248, 248, 248), Color.new(96, 96, 96)]] ) end diff --git a/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb b/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb index 9fd331464..cd221e7de 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb @@ -88,7 +88,7 @@ class PokemonTilesetScene TILES_PER_ROW.times do |xx| tile_id = tile_ID_from_coordinates(xx, @top_y + yy) terr = @tileset.terrain_tags[tile_id] - textpos.push([terr.to_s, (xx * TILE_SIZE) + (TILE_SIZE / 2), (yy * TILE_SIZE) + 6, 2, TEXT_COLOR, TEXT_SHADOW_COLOR]) + textpos.push([terr.to_s, (xx * TILE_SIZE) + (TILE_SIZE / 2), (yy * TILE_SIZE) + 6, :center, TEXT_COLOR, TEXT_SHADOW_COLOR]) end end pbDrawTextPositions(@sprites["overlay"].bitmap, textpos) @@ -123,8 +123,8 @@ class PokemonTilesetScene terrain_tag_name = terrain_tag.to_s end textpos = [ - [_INTL("Terrain Tag:"), tile_x + TILE_SIZE, tile_y + (TILE_SIZE * 2) + 22, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)], - [terrain_tag_name, tile_x + TILE_SIZE, tile_y + (TILE_SIZE * 2) + 54, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)] + [_INTL("Terrain Tag:"), tile_x + TILE_SIZE, tile_y + (TILE_SIZE * 2) + 22, :center, Color.new(248, 248, 248), Color.new(40, 40, 40)], + [terrain_tag_name, tile_x + TILE_SIZE, tile_y + (TILE_SIZE * 2) + 54, :center, Color.new(248, 248, 248), Color.new(40, 40, 40)] ] # Draw all text pbDrawTextPositions(overlay, textpos) From 3d9d31621bb0ba8da2bb34e3949a1a64aec0453c Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Wed, 5 Apr 2023 21:41:55 +0100 Subject: [PATCH 5/9] Sped up compiling PBS files by about 5x, fixed bug from earlier commit about writing PBS lines with many optional values --- .../001_Editor screens/001_EditorScreens.rb | 4 +- Data/Scripts/021_Compiler/001_Compiler.rb | 184 +++++++++++++++++- .../021_Compiler/002_Compiler_CompilePBS.rb | 66 +++---- PBS/town_map.txt | 30 +-- 4 files changed, 224 insertions(+), 60 deletions(-) diff --git a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb index b09ae7337..110bcdb65 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb @@ -967,9 +967,9 @@ def pbPokemonEditor if param_type.nil? evo[2] = nil elsif param_type == Integer - evo[2] = Compiler.csvPosInt!(evo[2]) + evo[2] = Compiler.cast_csv_value(evo[2], "u") elsif param_type != String - evo[2] = Compiler.csvEnumField!(evo[2], param_type, "Evolutions", species_hash[:id]) + evo[2] = Compiler.cast_csv_value(evo[2], "e", param_type) end end # Add species' data to records diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index 6d9f08cef..199d69d36 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -248,9 +248,55 @@ module Compiler end end + #============================================================================= + # Splits a string containing comma-separated values into an array of those + # values. + #============================================================================= + def split_csv_line(string) + # Split the string into an array of values, using a comma as the separator + values = string.split(",") + # Check for quote marks in each value, as we may need to recombine some values + # to make proper results + (0...values.length).each do |i| + value = values[i] + next if !value || value.empty? + quote_count = value.count('"') #scan(/(?:^|\G|[^\\])(\\)*"/).length + if !quote_count.zero? + # Quote marks found in value + (i...(values.length - 1)).each do |j| + quote_count = values[i].count('"') + if quote_count == 2 && value.start_with?('\\"') && values[i].end_with?('\\"') + # Two quote marks around the whole value; remove them + values[i] = values[i][2..-3] + break + elsif quote_count.even? + break + end + # Odd number of quote marks in value; concatenate the next value to it and + # see if that's any better + values[i] += "," + values[j + 1] + values[j + 1] = nil + end + # Recheck for enclosing quote marks to remove + if quote_count != 2 + if value.count('"') == 2 && value.start_with?('\\"') && value.end_with?('\\"') + values[i] = values[i][2..-3] + end + end + end + # Remove leading and trailing whitespace from value + values[i].strip! + end + # Remove nil values caused by concatenating values above + values.compact! + return values + end + #============================================================================= # Convert a string to certain kinds of values #============================================================================= + # Unused + # NOTE: This method is about 10 times slower than split_csv_line. def csvfield!(str) ret = "" str.sub!(/^\s*/, "") @@ -286,16 +332,15 @@ module Compiler return ret end + # Unused def csvBoolean!(str, _line = -1) field = csvfield!(str) - if field[/^1|[Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]|[Yy]$/] - return true - elsif field[/^0|[Ff][Aa][Ll][Ss][Ee]|[Nn][Oo]|[Nn]$/] - return false - end + return true if field[/^(?:1|TRUE|YES|Y)$/i] + return false if field[/^(?:0|FALSE|NO|N)$/i] raise _INTL("Field {1} is not a Boolean value (true, false, 1, 0)\r\n{2}", field, FileLineData.linereport) end + # Unused def csvInt!(str, _line = -1) ret = csvfield!(str) if !ret[/^\-?\d+$/] @@ -304,6 +349,7 @@ module Compiler return ret.to_i end + # Unused def csvPosInt!(str, _line = -1) ret = csvfield!(str) if !ret[/^\d+$/] @@ -312,22 +358,83 @@ module Compiler return ret.to_i end + # Unused def csvFloat!(str, _line = -1) ret = csvfield!(str) return Float(ret) rescue raise _INTL("Field {1} is not a number\r\n{2}", ret, FileLineData.linereport) end + # Unused def csvEnumField!(value, enumer, _key, _section) ret = csvfield!(value) return checkEnumField(ret, enumer) end + # Unused def csvEnumFieldOrInt!(value, enumer, _key, _section) ret = csvfield!(value) return ret.to_i if ret[/\-?\d+/] return checkEnumField(ret, enumer) end + # Turns a value (a string) into another data type as determined by the given + # schema. + # @param value [String] + # @param schema [String] + def cast_csv_value(value, schema, enumer = nil) + case schema.downcase + when "i" # Integer + if !value[/^\-?\d+$/] + raise _INTL("Field {1} is not an integer\r\n{2}", value, FileLineData.linereport) + end + return value.to_i + when "u" # Positive integer or zero + if !value[/^\d+$/] + raise _INTL("Field {1} is not a positive integer or 0\r\n{2}", value, FileLineData.linereport) + end + return value.to_i + when "v" # Positive integer + if !value[/^\d+$/] + raise _INTL("Field {1} is not a positive integer\r\n{2}", value, FileLineData.linereport) + end + if value.to_i == 0 + raise _INTL("Field '{1}' must be greater than 0\r\n{2}", value, FileLineData.linereport) + end + return value.to_i + when "x" # Hexadecimal number + if !value[/^[A-F0-9]+$/i] + raise _INTL("Field '{1}' is not a hexadecimal number\r\n{2}", value, FileLineData.linereport) + end + return value.hex + when "f" # Floating point number + if !value[/^\-?^\d*\.?\d*$/] + raise _INTL("Field {1} is not a number\r\n{2}", value, FileLineData.linereport) + end + return value.to_f + when "b" # Boolean + return true if value[/^(?:1|TRUE|YES|Y)$/i] + return false if value[/^(?:0|FALSE|NO|N)$/i] + raise _INTL("Field {1} is not a Boolean value (true, false, 1, 0)\r\n{2}", value, FileLineData.linereport) + when "n" # Name + if !value[/^(?![0-9])\w+$/] + raise _INTL("Field '{1}' must contain only letters, digits, and\r\nunderscores and can't begin with a number.\r\n{2}", value, FileLineData.linereport) + end + when "s" # String + when "q" # Unformatted text + when "m" # Symbol + if !value[/^(?![0-9])\w+$/] + raise _INTL("Field '{1}' must contain only letters, digits, and\r\nunderscores and can't begin with a number.\r\n{2}", value, FileLineData.linereport) + end + return value.to_sym + when "e" # Enumerable + return checkEnumField(value, enumer) + when "y" # Enumerable or integer + return value.to_i if value[/^\-?\d+$/] + return checkEnumField(value, enumer) + end + return value + end + def checkEnumField(ret, enumer) case enumer when Module @@ -376,6 +483,7 @@ module Compiler raise _INTL("Enumeration not defined\r\n{1}", FileLineData.linereport) end + # Unused def checkEnumFieldOrNil(ret, enumer) case enumer when Module @@ -403,7 +511,10 @@ module Compiler #============================================================================= # Convert a string to values using a schema #============================================================================= + # Unused + # @deprecated This method is slated to be removed in v22. def pbGetCsvRecord(rec, lineno, schema) + Deprecation.warn_method("pbGetCsvRecord", "v22", "get_csv_record") record = [] repeat = false schema_length = schema[1].length @@ -573,6 +684,58 @@ module Compiler return (!repeat && schema_length == 1) ? record[0] : record end + #============================================================================= + # Convert a string to values using a schema + #============================================================================= + def get_csv_record(rec, schema) + ret = [] + repeat = false + start = 0 + schema_length = schema[1].length + case schema[1][0, 1] # First character in schema + when "*" + repeat = true + start = 1 + when "^" + start = 1 + schema_length -= 1 + end + subarrays = repeat && schema[1].length - start > 1 # Whether ret is an array of arrays + # Split the string on commas into an array of values to apply the schema to + values = split_csv_line(rec) + # Apply the schema to each value in the line + idx = -1 # Index of value to look at in values + loop do + record = [] + (start...schema[1].length).each do |i| + idx += 1 + sche = schema[1][i, 1] + if sche[/[A-Z]/] # Upper case = optional + if nil_or_empty?(values[idx]) + record.push(nil) + next + end + end + if sche.downcase == "q" # Unformatted text + record.push(rec) + idx = values.length + break + else + record.push(cast_csv_value(values[idx], sche, schema[2 + i - start])) + end + end + if !record.empty? + if subarrays + ret.push(record) + else + ret.concat(record) + end + end + break if !repeat || idx >= values.length - 1 + end + return (!repeat && schema_length == 1) ? ret[0] : ret + end + #============================================================================= # Write values to a file using a schema #============================================================================= @@ -584,9 +747,16 @@ module Compiler (start...schema[1].length).each do |i| index += 1 value = rec[index] - if schema[1][i, 1].upcase != schema[1][i, 1] || !value.nil? - file.write(",") if index > 0 + if schema[1][i, 1][/[A-Z]/] # Optional + # Check the rest of the values for non-nil things + later_value_found = false + (index...rec.length).each do |j| + later_value_found = true if !rec[j].nil? + break if later_value_found + end + break if !later_value_found end + file.write(",") if index > 0 if value.nil? # do nothing elsif value.is_a?(String) diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index 6f694024b..2691b6db5 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -31,7 +31,7 @@ module Compiler schema.each_key do |key| FileLineData.setSection(section_name, key, contents[key]) # For error reporting if key == "SectionName" - data_hash[schema[key][0]] = pbGetCsvRecord(section_name, key, schema[key]) + data_hash[schema[key][0]] = get_csv_record(section_name, schema[key]) next end # Skip empty properties @@ -39,14 +39,14 @@ module Compiler # Compile value for key if schema[key][1][0] == "^" contents[key].each do |val| - value = pbGetCsvRecord(val, key, schema[key]) + value = get_csv_record(val, schema[key]) value = nil if value.is_a?(Array) && value.empty? data_hash[schema[key][0]] ||= [] data_hash[schema[key][0]].push(value) end data_hash[schema[key][0]].compact! else - value = pbGetCsvRecord(contents[key], key, schema[key]) + value = get_csv_record(contents[key], schema[key]) value = nil if value.is_a?(Array) && value.empty? data_hash[schema[key][0]] = value end @@ -102,28 +102,22 @@ module Compiler # Compile map connections #============================================================================= def compile_connections(*paths) + hashenum = { + "N" => "N", "North" => "N", + "E" => "E", "East" => "E", + "S" => "S", "South" => "S", + "W" => "W", "West" => "W" + } + schema = [nil, "iyiiyi", nil, hashenum, nil, nil, hashenum] records = [] paths.each do |path| compile_pbs_file_message_start(path) pbCompilerEachPreppedLine(path) do |line, lineno| - hashenum = { - "N" => "N", "North" => "N", - "E" => "E", "East" => "E", - "S" => "S", "South" => "S", - "W" => "W", "West" => "W" - } - record = [] - thisline = line.dup - record.push(csvInt!(thisline, lineno)) - record.push(csvEnumFieldOrInt!(thisline, hashenum, "", sprintf("(line %d)", lineno))) - record.push(csvInt!(thisline, lineno)) - record.push(csvInt!(thisline, lineno)) - record.push(csvEnumFieldOrInt!(thisline, hashenum, "", sprintf("(line %d)", lineno))) - record.push(csvInt!(thisline, lineno)) + FileLineData.setLine(line, lineno) + record = get_csv_record(line, schema) if !pbRgssExists?(sprintf("Data/Map%03d.rxdata", record[0])) print _INTL("Warning: Map {1}, as mentioned in the map connection data, was not found.\r\n{2}", record[0], FileLineData.linereport) - end - if !pbRgssExists?(sprintf("Data/Map%03d.rxdata", record[3])) + elsif !pbRgssExists?(sprintf("Data/Map%03d.rxdata", record[3])) print _INTL("Warning: Map {1}, as mentioned in the map connection data, was not found.\r\n{2}", record[3], FileLineData.linereport) end case record[1] @@ -333,21 +327,21 @@ module Compiler FileLineData.setSection(species.id.to_s, "Offspring", nil) # For error reporting offspring = species.offspring offspring.each_with_index do |sp, i| - offspring[i] = csvEnumField!(sp, :Species, "Offspring", species.id) + offspring[i] = cast_csv_value(sp, "e", :Species) end end # Enumerate all evolution species and parameters (this couldn't be done earlier) GameData::Species.each do |species| FileLineData.setSection(species.id.to_s, "Evolutions", nil) # For error reporting species.evolutions.each do |evo| - evo[0] = csvEnumField!(evo[0], :Species, "Evolutions", species.id) + evo[0] = cast_csv_value(evo[0], "e", :Species) param_type = GameData::Evolution.get(evo[1]).parameter if param_type.nil? evo[2] = nil elsif param_type == Integer - evo[2] = csvPosInt!(evo[2]) + evo[2] = cast_csv_value(evo[2], "u") elsif param_type != String - evo[2] = csvEnumField!(evo[2], param_type, "Evolutions", species.id) + evo[2] = cast_csv_value(evo[2], "e", param_type) end end end @@ -407,7 +401,7 @@ module Compiler schema.each_key do |key| FileLineData.setSection(section_name, key, contents[key]) # For error reporting if key == "SectionName" - data_hash[schema[key][0]] = pbGetCsvRecord(section_name, key, schema[key]) + data_hash[schema[key][0]] = get_csv_record(section_name, schema[key]) next end # Skip empty properties @@ -415,14 +409,14 @@ module Compiler # Compile value for key if schema[key][1][0] == "^" contents[key].each do |val| - value = pbGetCsvRecord(val, key, schema[key]) + value = get_csv_record(val, schema[key]) value = nil if value.is_a?(Array) && value.empty? data_hash[schema[key][0]] ||= [] data_hash[schema[key][0]].push(value) end data_hash[schema[key][0]].compact! else - value = pbGetCsvRecord(contents[key], key, schema[key]) + value = get_csv_record(contents[key], schema[key]) value = nil if value.is_a?(Array) && value.empty? data_hash[schema[key][0]] = value end @@ -655,7 +649,7 @@ module Compiler raise _INTL("Expected a species entry line for encounter type {1} for map '{2}', got \"{3}\" instead.\r\n{4}", GameData::EncounterType.get(current_type).real_name, encounter_hash[:map], line, FileLineData.linereport) end - values = pbGetCsvRecord(line, line_no, [0, "vevV", nil, :Species]) + values = get_csv_record(line, [nil, "vevV", nil, :Species]) values[3] = values[2] if !values[3] if values[2] > max_level raise _INTL("Level number {1} is not valid (max. {2}).\r\n{3}", values[2], max_level, FileLineData.linereport) @@ -800,7 +794,7 @@ module Compiler data_hash = { :pbs_file_suffix => file_suffix } - data_hash[schema["SectionName"][0]] = pbGetCsvRecord(section_name.clone, line_no, schema["SectionName"]) + data_hash[schema["SectionName"][0]] = get_csv_record(section_name.clone, schema["SectionName"]) data_hash[schema["Pokemon"][0]] = [] current_pkmn = nil elsif line[/^\s*(\w+)\s*=\s*(.*)$/] @@ -810,7 +804,7 @@ module Compiler end key = $~[1] if schema[key] # Property of the trainer - property_value = pbGetCsvRecord($~[2], line_no, schema[key]) + property_value = get_csv_record($~[2], schema[key]) if key == "Pokemon" current_pkmn = { :species => property_value[0], @@ -824,7 +818,7 @@ module Compiler if !current_pkmn raise _INTL("Pokémon hasn't been defined yet!\r\n{1}", FileLineData.linereport) end - current_pkmn[sub_schema[key][0]] = pbGetCsvRecord($~[2], line_no, sub_schema[key]) + current_pkmn[sub_schema[key][0]] = get_csv_record($~[2], sub_schema[key]) end end end @@ -967,7 +961,7 @@ module Compiler schema = btTrainersRequiredTypes[key] next if key == "Challenges" && name == "DefaultTrainerList" next if !schema - record = pbGetCsvRecord(section[key], 0, schema) + record = get_csv_record(section[key], schema) rsection[schema[0]] = record end if !rsection[0] @@ -1028,7 +1022,7 @@ module Compiler FileLineData.setSection(name, key, section[key]) schema = requiredtypes[key] next if !schema - record = pbGetCsvRecord(section[key], 0, schema) + record = get_csv_record(section[key], schema) rsection[schema[0]] = record end trainernames.push(rsection[1]) @@ -1079,7 +1073,7 @@ module Compiler schema.each_key do |key| FileLineData.setSection(section_name, key, contents[key]) # For error reporting if key == "SectionName" - data_hash[schema[key][0]] = pbGetCsvRecord(section_name, key, schema[key]) + data_hash[schema[key][0]] = get_csv_record(section_name, schema[key]) next end # Skip empty properties @@ -1087,14 +1081,14 @@ module Compiler # Compile value for key if schema[key][1][0] == "^" contents[key].each do |val| - value = pbGetCsvRecord(val, key, schema[key]) + value = get_csv_record(val, schema[key]) value = nil if value.is_a?(Array) && value.empty? data_hash[schema[key][0]] ||= [] data_hash[schema[key][0]].push(value) end data_hash[schema[key][0]].compact! else - value = pbGetCsvRecord(contents[key], key, schema[key]) + value = get_csv_record(contents[key], schema[key]) value = nil if value.is_a?(Array) && value.empty? data_hash[schema[key][0]] = value end @@ -1230,7 +1224,7 @@ module Compiler hash[:id] = "default" hash[:trainer_type] = hash[:id] else - line_data = pbGetCsvRecord(hash[:id], -1, [0, "esU", :TrainerType]) + line_data = get_csv_record(hash[:id], [nil, "esU", :TrainerType]) hash[:trainer_type] = line_data[0] hash[:real_name] = line_data[1] hash[:version] = line_data[2] || 0 diff --git a/PBS/town_map.txt b/PBS/town_map.txt index 11891d45a..349e1c279 100644 --- a/PBS/town_map.txt +++ b/PBS/town_map.txt @@ -4,33 +4,33 @@ Name = Essen Filename = mapRegion0.png Point = 13,12,Lappet Town,Oak's Lab,2,8,8 -Point = 13,11,Route 1, +Point = 13,11,Route 1 Point = 13,10,Cedolan City,Cedolan Dept. Store,7,47,11 Point = 14,10,Cedolan City,,7,47,11 -Point = 14,9,Route 2, -Point = 14,8,Route 2, +Point = 14,9,Route 2 +Point = 14,8,Route 2 Point = 15,8,Lerucean Town,,23,11,15 -Point = 16,8,Natural Park, -Point = 15,7,Route 3, +Point = 16,8,Natural Park +Point = 15,7,Route 3 Point = 15,6,Route 3,Ice Cave -Point = 14,6,Route 3, +Point = 14,6,Route 3 Point = 13,6,Ingido Plateau,,35,17,7 -Point = 12,6,Route 4, -Point = 11,6,Route 4, +Point = 12,6,Route 4 +Point = 11,6,Route 4 Point = 11,7,Route 5,Cycle Road Point = 11,8,Route 5,Cycle Road Point = 11,9,Route 5,Cycle Road -Point = 11,10,Route 6, -Point = 12,10,Route 6, -Point = 15,10,Route 7, +Point = 11,10,Route 6 +Point = 12,10,Route 6 +Point = 15,10,Route 7 Point = 16,10,Route 7,Rock Cave Point = 17,10,Battle Frontier,,52,17,14 -Point = 12,12,Safari Zone, +Point = 12,12,Safari Zone Point = 13,13,Route 8,Diving area -Point = 18,17,Berth Island,,51 -Point = 22,16,Faraday Island,,52 +Point = 18,17,Berth Island,,,,,51 +Point = 22,16,Faraday Island,,,,,52 #------------------------------- [1] Name = Tiall Filename = mapRegion1.png -Point = 13,16,Here, +Point = 13,16,Here From 1ddf89c2dfdec49099f9950981aa19b887a7122e Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Thu, 6 Apr 2023 17:47:42 +0100 Subject: [PATCH 6/9] Removed script/event text collation from compiler (added a debug function to do that instead), removed system cache reloader from compiler --- .../003_Debug menus/002_Debug_MenuCommands.rb | 12 ++++++++ Data/Scripts/021_Compiler/001_Compiler.rb | 8 ------ .../021_Compiler/002_Compiler_CompilePBS.rb | 24 +++++++++------- .../021_Compiler/003_Compiler_WritePBS.rb | 28 +++++++++---------- .../004_Compiler_MapsAndEvents.rb | 4 +-- 5 files changed, 42 insertions(+), 34 deletions(-) diff --git a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb index 562065a08..7fb6d7aeb 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb @@ -1180,6 +1180,18 @@ MenuHandlers.add(:debug_menu, :rename_files, { } }) +MenuHandlers.add(:debug_menu, :rename_files, { + "name" => _INTL("Collate Script/Event Texts For Translation"), + "parent" => :files_menu, + "description" => _INTL("Get translatable text from scripts/map events. Do this before extracting text."), + "effect" => proc { + Translator.gather_script_and_event_texts + MessageTypes.save_default_messages + MessageTypes.load_default_messages if safeExists?("Data/messages_core.dat") + pbMessage(_INTL("Translatable text gathered from scripts and map events and saved in data files.")) + } +}) + MenuHandlers.add(:debug_menu, :extract_text, { "name" => _INTL("Extract Text For Translation"), "parent" => :files_menu, diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index 199d69d36..c1d52b25d 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -1015,14 +1015,6 @@ module Compiler compile_pbs_files compile_animations compile_trainer_events(mustCompile) - Console.echo_li(_INTL("Saving messages...")) - Translator.gather_script_and_event_texts - MessageTypes.save_default_messages - MessageTypes.load_default_messages if safeExists?("Data/messages_core.dat") - Console.echo_done(true) - Console.echo_li(_INTL("Reloading cache...")) - System.reload_cache - Console.echo_done(true) Console.echoln_li_done(_INTL("Successfully compiled all game data")) end diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index 2691b6db5..fabd11de5 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -20,8 +20,8 @@ module Compiler # the keys are the XXX and the values are the YYY (as unprocessed strings). idx = 0 pbEachFileSection(f, schema) do |contents, section_name| - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 data_hash = { :id => section_name.to_sym, @@ -390,8 +390,8 @@ module Compiler # the keys are the XXX and the values are the YYY (as unprocessed strings). idx = 0 pbEachFileSection(f, schema) do |contents, section_name| - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 data_hash = { :id => section_name.to_sym, @@ -639,9 +639,9 @@ module Compiler current_type = nil idx = 0 pbCompilerEachPreppedLine(path) do |line, line_no| - echo "." if idx % 50 == 0 + echo "." if idx % 100 == 0 idx += 1 - Graphics.update if idx % 250 == 0 + Graphics.update if idx % 500 == 0 next if line.length == 0 if current_type && line[/^\d+,/] # Species line values = line.split(",").collect! { |v| v.strip } @@ -777,9 +777,9 @@ module Compiler section_line = nil # Read each line of trainers.txt at a time and compile it as a trainer property pbCompilerEachPreppedLine(path) do |line, line_no| - echo "." if idx % 50 == 0 + echo "." if idx % 100 == 0 idx += 1 - Graphics.update if idx % 250 == 0 + Graphics.update if idx % 500 == 0 FileLineData.setSection(section_name, nil, section_line) if line[/^\s*\[\s*(.+)\s*\]\s*$/] # New section [trainer_type, name] or [trainer_type, name, version] @@ -1061,8 +1061,8 @@ module Compiler # the keys are the XXX and the values are the YYY (as unprocessed strings). idx = 0 pbEachFileSection(f) do |contents, section_name| - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 schema = (section_name.to_i == 0) ? global_schema : player_schema data_hash = { @@ -1270,7 +1270,11 @@ module Compiler # end # pbanims[anim.id] = pbConvertRPGAnimation(anim) if !found # end + idx = 0 pbanims.length.times do |i| + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 + idx += 1 next if !pbanims[i] if pbanims[i].name[/^OppMove\:\s*(.*)$/] if GameData::Move.exists?($~[1]) diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index 758d83924..be1b3de32 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -31,8 +31,8 @@ module Compiler # Write each element in turn game_data.each do |element| next if element.pbs_file_suffix != path[1] - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 f.write("\#-------------------------------\r\n") if schema["SectionName"] @@ -189,8 +189,8 @@ module Compiler # Write each element in turn GameData::Species.each_species do |element| next if element.pbs_file_suffix != path[1] - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 f.write("\#-------------------------------\r\n") if schema["SectionName"] @@ -249,8 +249,8 @@ module Compiler GameData::Species.each do |element| next if element.form == 0 next if element.pbs_file_suffix != path[1] - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 f.write("\#-------------------------------\r\n") if schema["SectionName"] @@ -317,8 +317,8 @@ module Compiler element.shadow_x == base_element.shadow_x && element.shadow_size == base_element.shadow_size end - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 f.write("\#-------------------------------\r\n") if schema["SectionName"] @@ -410,8 +410,8 @@ module Compiler add_PBS_header_to_file(f) GameData::Encounter.each do |element| next if element.pbs_file_suffix != path[1] - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 f.write("\#-------------------------------\r\n") map_name = (map_infos[element.map]) ? " # #{map_infos[element.map].name}" : "" @@ -463,8 +463,8 @@ module Compiler # Write each element in turn GameData::Trainer.each do |element| next if element.pbs_file_suffix != path[1] - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 f.write("\#-------------------------------\r\n") if schema["SectionName"] @@ -696,8 +696,8 @@ module Compiler add_PBS_header_to_file(f) GameData::MapMetadata.each do |element| next if element.pbs_file_suffix != path[1] - echo "." if idx % 50 == 0 - Graphics.update if idx % 250 == 0 + echo "." if idx % 100 == 0 + Graphics.update if idx % 500 == 0 idx += 1 f.write("\#-------------------------------\r\n") map_name = (map_infos && map_infos[element.id]) ? map_infos[element.id].name : nil diff --git a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb index 9ee076dcd..c23c5eb22 100644 --- a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb @@ -1681,9 +1681,9 @@ module Compiler Console.echo_li(_INTL("Processing {1} maps...", mapData.mapinfos.keys.length)) idx = 0 mapData.mapinfos.keys.sort.each do |id| - echo "." if idx % 20 == 0 + echo "." if idx % 100 == 0 idx += 1 - Graphics.update if idx % 250 == 0 + Graphics.update if idx % 500 == 0 changed = false map = mapData.getMap(id) next if !map || !mapData.mapinfos[id] From 6b690c4492721b523a372fffc4ffb99260ab29c6 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Thu, 6 Apr 2023 21:46:08 +0100 Subject: [PATCH 7/9] Fix to previous commit --- .../020_Debug/003_Debug menus/002_Debug_MenuCommands.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb index 7fb6d7aeb..11cd1d83b 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb @@ -1180,10 +1180,10 @@ MenuHandlers.add(:debug_menu, :rename_files, { } }) -MenuHandlers.add(:debug_menu, :rename_files, { +MenuHandlers.add(:debug_menu, :collate_script_and_event_text, { "name" => _INTL("Collate Script/Event Texts For Translation"), "parent" => :files_menu, - "description" => _INTL("Get translatable text from scripts/map events. Do this before extracting text."), + "description" => _INTL("Find translatable text in scripts/map events. Do this before extracting text."), "effect" => proc { Translator.gather_script_and_event_texts MessageTypes.save_default_messages From 5315b53eaed83062e1a9c867426caf10719ee2d8 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Fri, 7 Apr 2023 01:12:17 +0100 Subject: [PATCH 8/9] Tidied up usage of colour tags (everything uses c3 now via def shadowc3tag), moved gender text colours to MessageConfig --- .../001_Technical/002_RubyUtilities.rb | 24 ------- .../002_MessageConfig.rb | 71 ++++++++++--------- .../005_SpriteWindow_text.rb | 4 +- .../007_Objects and windows/010_DrawText.rb | 25 +++++-- .../007_Objects and windows/011_Messages.rb | 6 +- Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb | 6 +- Data/Scripts/016_UI/006_UI_Summary.rb | 55 ++++++++------ Data/Scripts/016_UI/014_UI_Save.rb | 33 ++++++--- .../017_Minigames/001_Minigame_Duel.rb | 17 ++++- .../001_Battle Frontier/005_UI_BattleSwap.rb | 6 +- 10 files changed, 146 insertions(+), 101 deletions(-) diff --git a/Data/Scripts/001_Technical/002_RubyUtilities.rb b/Data/Scripts/001_Technical/002_RubyUtilities.rb index 08d54466c..3fd261494 100644 --- a/Data/Scripts/001_Technical/002_RubyUtilities.rb +++ b/Data/Scripts/001_Technical/002_RubyUtilities.rb @@ -329,30 +329,6 @@ class Color def self.orange; return Color.new(255, 155, 0); end def self.purple; return Color.new(155, 0, 255); end def self.brown; return Color.new(112, 72, 32); end - - # TODO: These are from def getSkinColor. It isn't appropriate to make Color - # objects of these, though, as they're just converted straight back into - # hex strings. -# def self.text_blue; return Color.new( 0, 112, 248); end -# def self.text_blue_light; return Color.new(120, 184, 232); end -# def self.text_red; return Color.new(232, 32, 16); end -# def self.text_red_light; return Color.new(248, 168, 184); end -# def self.text_green; return Color.new( 96, 176, 72); end -# def self.text_green_light; return Color.new(174, 208, 144); end -# def self.text_cyan; return Color.new( 72, 216, 216); end -# def self.text_cyan_light; return Color.new(168, 224, 224); end -# def self.text_magenta; return Color.new(208, 56, 184); end -# def self.text_magenta_light; return Color.new(232, 160, 224); end -# def self.text_yellow; return Color.new(232, 208, 32); end -# def self.text_yellow_light; return Color.new(248, 232, 136); end -# def self.text_gray; return Color.new(160, 160, 168); end -# def self.text_gray_light; return Color.new(208, 208, 216); end -# def self.text_white; return Color.new(240, 240, 248); end -# def self.text_white_light; return Color.new(200, 200, 208); end # Intentionally darker than text_white -# def self.text_purple; return Color.new(114, 64, 232); end -# def self.text_purple_light; return Color.new(184, 168, 224); end -# def self.text_orange; return Color.new(248, 152, 24); end -# def self.text_orange_light; return Color.new(248, 200, 152); end end #=============================================================================== diff --git a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb index 77f9d6b77..80d67a911 100644 --- a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb +++ b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb @@ -2,26 +2,30 @@ # #=============================================================================== module MessageConfig - LIGHT_TEXT_MAIN_COLOR = Color.new(248, 248, 248) - LIGHT_TEXT_SHADOW_COLOR = Color.new(72, 80, 88) - DARK_TEXT_MAIN_COLOR = Color.new(80, 80, 88) - DARK_TEXT_SHADOW_COLOR = Color.new(160, 160, 168) - FONT_NAME = "Power Green" - FONT_SIZE = 27 - FONT_Y_OFFSET = 8 - SMALL_FONT_NAME = "Power Green Small" - SMALL_FONT_SIZE = 21 - SMALL_FONT_Y_OFFSET = 8 - NARROW_FONT_NAME = "Power Green Narrow" - NARROW_FONT_SIZE = 27 - NARROW_FONT_Y_OFFSET = 8 + LIGHT_TEXT_MAIN_COLOR = Color.new(248, 248, 248) + LIGHT_TEXT_SHADOW_COLOR = Color.new(72, 80, 88) + DARK_TEXT_MAIN_COLOR = Color.new(80, 80, 88) + DARK_TEXT_SHADOW_COLOR = Color.new(160, 160, 168) + MALE_TEXT_MAIN_COLOR = Color.new(48, 80, 200) # Used by message tag "\b" + MALE_TEXT_SHADOW_COLOR = Color.new(208, 208, 200) + FEMALE_TEXT_MAIN_COLOR = Color.new(224, 8, 8) # Used by message tag "\r" + FEMALE_TEXT_SHADOW_COLOR = Color.new(208, 208, 200) + FONT_NAME = "Power Green" + FONT_SIZE = 27 + FONT_Y_OFFSET = 8 + SMALL_FONT_NAME = "Power Green Small" + SMALL_FONT_SIZE = 21 + SMALL_FONT_Y_OFFSET = 8 + NARROW_FONT_NAME = "Power Green Narrow" + NARROW_FONT_SIZE = 27 + NARROW_FONT_Y_OFFSET = 8 # 0 = Pause cursor is displayed at end of text # 1 = Pause cursor is displayed at bottom right # 2 = Pause cursor is displayed at lower middle side - CURSOR_POSITION = 1 - WINDOW_OPACITY = 255 - TEXT_SPEED = nil # can be positive to wait frames or negative to - # show multiple characters in a single frame + CURSOR_POSITION = 1 + WINDOW_OPACITY = 255 + TEXT_SPEED = nil # can be positive to wait frames, or negative + # to show multiple characters in a single frame @@systemFrame = nil @@defaultTextSkin = nil @@textSpeed = nil @@ -328,21 +332,22 @@ def getSkinColor(windowskin, color, isDarkSkin) if !windowskin || windowskin.disposed? || windowskin.width != 128 || windowskin.height != 128 # Base color, shadow color (these are reversed on dark windowskins) + # Values in arrays are RGB numbers textcolors = [ - "0070F8", "78B8E8", # 1 Blue - "E82010", "F8A8B8", # 2 Red - "60B048", "B0D090", # 3 Green - "48D8D8", "A8E0E0", # 4 Cyan - "D038B8", "E8A0E0", # 5 Magenta - "E8D020", "F8E888", # 6 Yellow - "A0A0A8", "D0D0D8", # 7 Grey - "F0F0F8", "C8C8D0", # 8 White - "9040E8", "B8A8E0", # 9 Purple - "F89818", "F8C898", # 10 Orange - MessageConfig::DARK_TEXT_MAIN_COLOR.to_rgb24, - MessageConfig::DARK_TEXT_SHADOW_COLOR.to_rgb24, # 11 Dark default - MessageConfig::LIGHT_TEXT_MAIN_COLOR.to_rgb24, - MessageConfig::LIGHT_TEXT_SHADOW_COLOR.to_rgb24 # 12 Light default + [ 0, 112, 248], [120, 184, 232], # 1 Blue + [232, 32, 16], [248, 168, 184], # 2 Red + [ 96, 176, 72], [174, 208, 144], # 3 Green + [ 72, 216, 216], [168, 224, 224], # 4 Cyan + [208, 56, 184], [232, 160, 224], # 5 Magenta + [232, 208, 32], [248, 232, 136], # 6 Yellow + [160, 160, 168], [208, 208, 216], # 7 Gray + [240, 240, 248], [200, 200, 208], # 8 White + [114, 64, 232], [184, 168, 224], # 9 Purple + [248, 152, 24], [248, 200, 152], # 10 Orange + MessageConfig::DARK_TEXT_MAIN_COLOR, + MessageConfig::DARK_TEXT_SHADOW_COLOR, # 11 Dark default + MessageConfig::LIGHT_TEXT_MAIN_COLOR, + MessageConfig::LIGHT_TEXT_SHADOW_COLOR # 12 Light default ] if color == 0 || color > textcolors.length / 2 # No special colour, use default if isDarkSkin # Dark background, light text @@ -353,10 +358,10 @@ def getSkinColor(windowskin, color, isDarkSkin) end # Special colour as listed above if isDarkSkin && color != 12 # Dark background, light text - return sprintf("", textcolors[(2 * (color - 1)) + 1], textcolors[2 * (color - 1)]) + return shadowc3tag(textcolors[(2 * (color - 1)) + 1], textcolors[2 * (color - 1)]) end # Light background, dark text - return sprintf("", textcolors[2 * (color - 1)], textcolors[(2 * (color - 1)) + 1]) + return shadowc3tag(textcolors[2 * (color - 1)], textcolors[(2 * (color - 1)) + 1]) else # VX windowskin color = 0 if color >= 32 x = 64 + ((color % 8) * 8) diff --git a/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb b/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb index 15e70cb31..d45eca479 100644 --- a/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb +++ b/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb @@ -307,7 +307,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base @fmtchars = [] fmt = getFormattedText(self.contents, 0, 0, self.width - self.borderX - SpriteWindow_Base::TEXT_PADDING, -1, - shadowctag(@baseColor, @shadowColor) + value, 32, true) + shadowc3tag(@baseColor, @shadowColor) + value, 32, true) @oldfont = self.contents.font.clone fmt.each do |ch| chx = ch[1] + ch[3] @@ -334,7 +334,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base else @fmtchars = getFormattedText(self.contents, 0, 0, self.width - self.borderX - SpriteWindow_Base::TEXT_PADDING, -1, - shadowctag(@baseColor, @shadowColor) + value, 32, true) + shadowc3tag(@baseColor, @shadowColor) + value, 32, true) @oldfont = self.contents.font.clone @fmtchars.each do |ch| chx = ch[1] + ch[3] diff --git a/Data/Scripts/007_Objects and windows/010_DrawText.rb b/Data/Scripts/007_Objects and windows/010_DrawText.rb index 754c79ae8..dff209602 100644 --- a/Data/Scripts/007_Objects and windows/010_DrawText.rb +++ b/Data/Scripts/007_Objects and windows/010_DrawText.rb @@ -1,25 +1,40 @@ #=============================================================================== # Text colors #=============================================================================== -# TODO: Unused. +# Unused def ctag(color) return sprintf("", color.to_rgb32(true)) end +# Unused def shadowctag(base, shadow) return sprintf("", base.to_rgb15, shadow.to_rgb15) end +# base and shadow are either instances of class Color, or are arrays containing +# 3 or 4 integers which are RGB(A) values. def shadowc3tag(base, shadow) - return sprintf("", base.to_rgb32, shadow.to_rgb32) + if base.is_a?(Color) + base_text = base.to_rgb32 + else + base_text = sprintf("%02X%02X%02X", base[0], base[1], base[2]) + base_text += sprintf("02X", base[3]) if base[3] + end + if shadow.is_a?(Color) + shadow_text = shadow.to_rgb32 + else + shadow_text = sprintf("%02X%02X%02X", shadow[0], shadow[1], shadow[2]) + shadow_text += sprintf("02X", shadow[3]) if shadow[3] + end + return sprintf("", base_text, shadow_text) end -# TODO: Unused. +# Unused def shadowctagFromColor(color) return shadowc3tag(color, color.get_contrast_color) end -# TODO: Unused. +# Unused def shadowctagFromRgb(param) return shadowctagFromColor(Color.new_from_rgb(param)) end @@ -1022,7 +1037,7 @@ end def drawFormattedTextEx(bitmap, x, y, width, text, baseColor = nil, shadowColor = nil, lineheight = 32) base = baseColor ? baseColor.clone : Color.new(96, 96, 96) shadow = shadowColor ? shadowColor.clone : Color.new(208, 208, 200) - text = shadowctag(base, shadow) + text + text = shadowc3tag(base, shadow) + text chars = getFormattedText(bitmap, x, y, width, -1, text, lineheight) drawFormattedChars(bitmap, chars) end diff --git a/Data/Scripts/007_Objects and windows/011_Messages.rb b/Data/Scripts/007_Objects and windows/011_Messages.rb index ee624d892..848f9ff0e 100644 --- a/Data/Scripts/007_Objects and windows/011_Messages.rb +++ b/Data/Scripts/007_Objects and windows/011_Messages.rb @@ -442,8 +442,10 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni text.gsub!(/\\pog/i, "\\b") if $player&.female? text.gsub!(/\\pg/i, "") text.gsub!(/\\pog/i, "") - text.gsub!(/\\b/i, "") - text.gsub!(/\\r/i, "") + male_text_tag = shadowc3tag(MessageConfig::MALE_TEXT_MAIN_COLOR, MessageConfig::MALE_TEXT_SHADOW_COLOR) + female_text_tag = shadowc3tag(MessageConfig::FEMALE_TEXT_MAIN_COLOR, MessageConfig::FEMALE_TEXT_SHADOW_COLOR) + text.gsub!(/\\b/i, male_text_tag) + text.gsub!(/\\r/i, female_text_tag) text.gsub!(/\\[Ww]\[([^\]]*)\]/) do w = $1.to_s if w == "" diff --git a/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb b/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb index 1ae27445c..afa40a703 100644 --- a/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb +++ b/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb @@ -36,6 +36,9 @@ end # #=============================================================================== class PokemonPokedexMenu_Scene + SEEN_OBTAINED_TEXT_BASE = Color.new(248, 248, 248) + SEEN_OBTAINED_TEXT_SHADOW = Color.new(192, 32, 40) + def pbUpdate pbUpdateSpriteHash(@sprites) end @@ -47,8 +50,9 @@ class PokemonPokedexMenu_Scene @sprites = {} @sprites["background"] = IconSprite.new(0, 0, @viewport) @sprites["background"].setBitmap(_INTL("Graphics/UI/Pokedex/bg_menu")) + text_tag = shadowc3tag(SEEN_OBTAINED_TEXT_BASE, SEEN_OBTAINED_TEXT_SHADOW) @sprites["headings"] = Window_AdvancedTextPokemon.newWithSize( - _INTL("SEENOBTAINED"), 286, 136, 208, 64, @viewport + text_tag + _INTL("SEEN") + "" + _INTL("OBTAINED") + "", 286, 136, 208, 64, @viewport ) @sprites["headings"].windowskin = nil @sprites["commands"] = Window_DexesList.new(commands, commands2, Graphics.width - 84) diff --git a/Data/Scripts/016_UI/006_UI_Summary.rb b/Data/Scripts/016_UI/006_UI_Summary.rb index 6af85e36f..3ee1cfec9 100644 --- a/Data/Scripts/016_UI/006_UI_Summary.rb +++ b/Data/Scripts/016_UI/006_UI_Summary.rb @@ -104,6 +104,11 @@ end class PokemonSummary_Scene MARK_WIDTH = 16 MARK_HEIGHT = 16 + # Colors used for messages in this scene + RED_TEXT_BASE = Color.new(248, 56, 32) + RED_TEXT_SHADOW = Color.new(224, 152, 144) + BLACK_TEXT_BASE = Color.new(64, 64, 64) + BLACK_TEXT_SHADOW = Color.new(176, 176, 176) def pbUpdate pbUpdateSpriteHash(@sprites) @@ -437,13 +442,14 @@ class PokemonSummary_Scene # Write Exp text OR heart gauge message (if a Shadow Pokémon) if @pokemon.shadowPokemon? textpos.push([_INTL("Heart Gauge"), 238, 246, :left, base, shadow]) + black_text_tag = shadowc3tag(BLACK_TEXT_BASE, BLACK_TEXT_SHADOW) heartmessage = [_INTL("The door to its heart is open! Undo the final lock!"), _INTL("The door to its heart is almost fully open."), _INTL("The door to its heart is nearly open."), _INTL("The door to its heart is opening wider."), _INTL("The door to its heart is opening up."), _INTL("The door to its heart is tightly shut.")][@pokemon.heartStage] - memo = sprintf("%s\n", heartmessage) + memo = black_text_tag + heartmessage drawFormattedTextEx(overlay, 234, 308, 264, memo) else endexp = @pokemon.growth_rate.minimum_exp_for_level(@pokemon.level + 1) @@ -498,30 +504,33 @@ class PokemonSummary_Scene end # Draw all text pbDrawTextPositions(overlay, textpos) + red_text_tag = shadowc3tag(RED_TEXT_BASE, RED_TEXT_SHADOW) + black_text_tag = shadowc3tag(BLACK_TEXT_BASE, BLACK_TEXT_SHADOW) memo = "" # Write date received if @pokemon.timeReceived date = @pokemon.timeReceived.day month = pbGetMonthName(@pokemon.timeReceived.mon) year = @pokemon.timeReceived.year - memo += _INTL("{1} {2}, {3}\n", date, month, year) + memo += black_text_tag + _INTL("{1} {2}, {3}", date, month, year) + "\n" end # Write map name egg was received on mapname = pbGetMapNameFromId(@pokemon.obtain_map) mapname = @pokemon.obtain_text if @pokemon.obtain_text && !@pokemon.obtain_text.empty? if mapname && mapname != "" - memo += _INTL("A mysterious Pokémon Egg received from {1}.\n", mapname) + mapname = red_text_tag + mapname + black_text_tag + memo += black_text_tag + _INTL("A mysterious Pokémon Egg received from {1}.", mapname) + "\n" else - memo += _INTL("A mysterious Pokémon Egg.\n", mapname) + memo += black_text_tag + _INTL("A mysterious Pokémon Egg.") + "\n" end - memo += "\n" # Empty line + memo += "\n" # Empty line # Write Egg Watch blurb - memo += _INTL("\"The Egg Watch\"\n") + memo += black_text_tag + _INTL("\"The Egg Watch\"") + "\n" eggstate = _INTL("It looks like this Egg will take a long time to hatch.") eggstate = _INTL("What will hatch from this? It doesn't seem close to hatching.") if @pokemon.steps_to_hatch < 10_200 eggstate = _INTL("It appears to move occasionally. It may be close to hatching.") if @pokemon.steps_to_hatch < 2550 eggstate = _INTL("Sounds can be heard coming from inside! It will hatch soon!") if @pokemon.steps_to_hatch < 1275 - memo += sprintf("%s\n", eggstate) + memo += black_text_tag + eggstate # Draw all text drawFormattedTextEx(overlay, 232, 86, 268, memo) # Draw the Pokémon's markings @@ -530,44 +539,48 @@ class PokemonSummary_Scene def drawPageTwo overlay = @sprites["overlay"].bitmap + red_text_tag = shadowc3tag(RED_TEXT_BASE, RED_TEXT_SHADOW) + black_text_tag = shadowc3tag(BLACK_TEXT_BASE, BLACK_TEXT_SHADOW) memo = "" # Write nature showNature = !@pokemon.shadowPokemon? || @pokemon.heartStage <= 3 if showNature - natureName = @pokemon.nature.name - memo += _INTL("{1} nature.\n", natureName) + nature_name = red_text_tag + @pokemon.nature.name + black_text_tag + memo += _INTL("{1} nature.", @pokemon.nature.name) + "\n" end # Write date received if @pokemon.timeReceived date = @pokemon.timeReceived.day month = pbGetMonthName(@pokemon.timeReceived.mon) year = @pokemon.timeReceived.year - memo += _INTL("{1} {2}, {3}\n", date, month, year) + memo += black_text_tag + _INTL("{1} {2}, {3}", date, month, year) + "\n" end # Write map name Pokémon was received on mapname = pbGetMapNameFromId(@pokemon.obtain_map) mapname = @pokemon.obtain_text if @pokemon.obtain_text && !@pokemon.obtain_text.empty? mapname = _INTL("Faraway place") if nil_or_empty?(mapname) - memo += sprintf("%s\n", mapname) + memo += red_text_tag + mapname + "\n" # Write how Pokémon was obtained - mettext = [_INTL("Met at Lv. {1}.", @pokemon.obtain_level), - _INTL("Egg received."), - _INTL("Traded at Lv. {1}.", @pokemon.obtain_level), - "", - _INTL("Had a fateful encounter at Lv. {1}.", @pokemon.obtain_level)][@pokemon.obtain_method] - memo += sprintf("%s\n", mettext) if mettext && mettext != "" + mettext = [ + _INTL("Met at Lv. {1}.", @pokemon.obtain_level), + _INTL("Egg received."), + _INTL("Traded at Lv. {1}.", @pokemon.obtain_level), + "", + _INTL("Had a fateful encounter at Lv. {1}.", @pokemon.obtain_level) + ][@pokemon.obtain_method] + memo += black_text_tag + mettext + "\n" if mettext && mettext != "" # If Pokémon was hatched, write when and where it hatched if @pokemon.obtain_method == 1 if @pokemon.timeEggHatched date = @pokemon.timeEggHatched.day month = pbGetMonthName(@pokemon.timeEggHatched.mon) year = @pokemon.timeEggHatched.year - memo += _INTL("{1} {2}, {3}\n", date, month, year) + memo += black_text_tag + _INTL("{1} {2}, {3}", date, month, year) + "\n" end mapname = pbGetMapNameFromId(@pokemon.hatched_map) mapname = _INTL("Faraway place") if nil_or_empty?(mapname) - memo += sprintf("%s\n", mapname) - memo += _INTL("Egg hatched.\n") + memo += red_text_tag + mapname + "\n" + memo += black_text_tag + _INTL("Egg hatched.") + "\n" else memo += "\n" # Empty line end @@ -616,7 +629,7 @@ class PokemonSummary_Scene _INTL("Somewhat of a clown."), _INTL("Quick to flee.")] } - memo += sprintf("%s\n", characteristics[best_stat][best_iv % 5]) + memo += black_text_tag + characteristics[best_stat][best_iv % 5] + "\n" end # Write all text drawFormattedTextEx(overlay, 232, 86, 268, memo) diff --git a/Data/Scripts/016_UI/014_UI_Save.rb b/Data/Scripts/016_UI/014_UI_Save.rb index d455efabf..e339a92b1 100644 --- a/Data/Scripts/016_UI/014_UI_Save.rb +++ b/Data/Scripts/016_UI/014_UI_Save.rb @@ -27,6 +27,15 @@ end # #=============================================================================== class PokemonSave_Scene + LOCATION_TEXT_BASE = Color.new(32, 152, 8) # Green + LOCATION_TEXT_SHADOW = Color.new(144, 240, 144) + MALE_TEXT_BASE = Color.new(0, 112, 248) # Blue + MALE_TEXT_SHADOW = Color.new(120, 184, 232) + FEMALE_TEXT_BASE = Color.new(232, 32, 16) # Red + FEMALE_TEXT_SHADOW = Color.new(248, 168, 184) + OTHER_TEXT_BASE = Color.new(0, 112, 248) # Blue + OTHER_TEXT_SHADOW = Color.new(120, 184, 232) + def pbStartScreen @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport.z = 99999 @@ -35,18 +44,24 @@ class PokemonSave_Scene hour = totalsec / 60 / 60 min = totalsec / 60 % 60 mapname = $game_map.name - textColor = ["0070F8,78B8E8", "E82010,F8A8B8", "0070F8,78B8E8"][$player.gender] - locationColor = "209808,90F090" # green - loctext = _INTL("{2}", locationColor, mapname) - loctext += _INTL("Player{2}
", textColor, $player.name) - if hour > 0 - loctext += _INTL("Time{2}h {3}m
", textColor, hour, min) + if $player.male? + text_tag = shadowc3tag(MALE_TEXT_BASE, MALE_TEXT_SHADOW) + elsif $player.female? + text_tag = shadowc3tag(FEMALE_TEXT_BASE, FEMALE_TEXT_SHADOW) else - loctext += _INTL("Time{2}m
", textColor, min) + text_tag = shadowc3tag(OTHER_TEXT_BASE, OTHER_TEXT_SHADOW) end - loctext += _INTL("Badges{2}
", textColor, $player.badge_count) + location_tag = shadowc3tag(LOCATION_TEXT_BASE, LOCATION_TEXT_SHADOW) + loctext = location_tag + "" + mapname + "" + loctext += _INTL("Player") + "" + text_tag + $player.name + "
" + if hour > 0 + loctext += _INTL("Time") + "" + text_tag + _INTL("{1}h {2}m", hour, min) + "
" + else + loctext += _INTL("Time") + "" + text_tag + _INTL("{1}m", min) + "
" + end + loctext += _INTL("Badges") + "" + text_tag + $player.badge_count.to_s + "
" if $player.has_pokedex - loctext += _INTL("Pokédex{2}/{3}", textColor, $player.pokedex.owned_count, $player.pokedex.seen_count) + loctext += _INTL("Pokédex") + "" + text_tag + $player.pokedex.owned_count.to_s + "/" + $player.pokedex.seen_count.to_s + "" end @sprites["locwindow"] = Window_AdvancedTextPokemon.new(loctext) @sprites["locwindow"].viewport = @viewport diff --git a/Data/Scripts/017_Minigames/001_Minigame_Duel.rb b/Data/Scripts/017_Minigames/001_Minigame_Duel.rb index 71fd9c80e..0655a7c8d 100644 --- a/Data/Scripts/017_Minigames/001_Minigame_Duel.rb +++ b/Data/Scripts/017_Minigames/001_Minigame_Duel.rb @@ -7,6 +7,13 @@ class DuelWindow < Window_AdvancedTextPokemon attr_reader :name attr_reader :is_enemy + PLAYER_TEXT_BASE = Color.new(48, 80, 200) # Blue + PLAYER_TEXT_SHADOW = Color.new(160, 192, 240) + ENEMY_TEXT_BASE = Color.new(224, 8, 8) # Red + ENEMY_TEXT_SHADOW = Color.new(248, 184, 112) + HP_TEXT_BASE = Color.new(32, 152, 8) # Green + HP_TEXT_SHADOW = Color.new(144, 240, 144) + def initialize(name, is_enemy) @hp = 10 @name = name @@ -33,9 +40,13 @@ class DuelWindow < Window_AdvancedTextPokemon end def duel_refresh - name_color = @is_enemy ? "" : "" - hp_color = "" - self.text = _INTL("{1}{2}\r\n{3}HP: {4}", name_color, fmtescape(@name), hp_color, @hp) + if @is_enemy + name_tag = shadowc3tag(ENEMY_TEXT_BASE, ENEMY_TEXT_SHADOW) + else + name_tag = shadowc3tag(PLAYER_TEXT_BASE, PLAYER_TEXT_SHADOW) + end + hp_tag = shadowc3tag(HP_TEXT_BASE, HP_TEXT_SHADOW) + self.text = name_tag + fmtescape(@name) + "\r\n" + hp_tag + _INTL("HP: {1}", @hp) end end diff --git a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb index 41abbe4cf..13f193a0f 100644 --- a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb +++ b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb @@ -2,6 +2,9 @@ # #=============================================================================== class BattleSwapScene + RED_TEXT_BASE = Color.new(232, 32, 16) + RED_TEXT_SHADOW = Color.new(248, 168, 184) + def pbStartRentScene(rentals) @rentals = rentals @mode = 0 # rental (pick 3 out of 6 initial Pokémon) @@ -78,12 +81,13 @@ class BattleSwapScene end def pbGetCommands(list, choices) + red_text_tag = shadowc3tag(RED_TEXT_BASE, RED_TEXT_SHADOW) commands = [] list.length.times do |i| pkmn = list[i] category = pkmn.species_data.category cmd = _INTL("{1} - {2} Pokémon", pkmn.speciesName, category) - cmd = "" + cmd if choices.include?(i) # Red text + cmd = red_text_tag + cmd if choices.include?(i) # Red text commands.push(cmd) end return commands From 956a511ec5e7a61c187cc15e9839aff88b50102d Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Fri, 7 Apr 2023 12:43:24 +0100 Subject: [PATCH 9/9] Fixed some errors when converting code in old trainer events to new code --- .../021_Compiler/004_Compiler_MapsAndEvents.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb index c23c5eb22..f03ee0ec9 100644 --- a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb @@ -1012,13 +1012,13 @@ module Compiler list[index].parameters[1] = sprintf("WildBattle.start(#{pkmn1}, #{pkmn2})") old_indent = list[index].indent new_events = [] - if battle_params[3] && battle_params[5][/false/] + if battle_params[5] && battle_params[5][/false/] push_script(new_events, "setBattleRule(\"cannotRun\")", old_indent) end - if battle_params[4] && battle_params[6][/true/] + if battle_params[6] && battle_params[6][/true/] push_script(new_events, "setBattleRule(\"canLose\")", old_indent) end - if battle_params[2] && battle_params[4] != "1" + if battle_params[4] && battle_params[4] != "1" push_script(new_events, "setBattleRule(\"outcome\", #{battle_params[4]})", old_indent) end list[index, 0] = new_events if new_events.length > 0 @@ -1031,13 +1031,13 @@ module Compiler list[index].parameters[1] = sprintf("WildBattle.start(#{pkmn1}, #{pkmn2}, #{pkmn3})") old_indent = list[index].indent new_events = [] - if battle_params[3] && battle_params[7][/false/] + if battle_params[7] && battle_params[7][/false/] push_script(new_events, "setBattleRule(\"cannotRun\")", old_indent) end - if battle_params[4] && battle_params[8][/true/] + if battle_params[8] && battle_params[8][/true/] push_script(new_events, "setBattleRule(\"canLose\")", old_indent) end - if battle_params[2] && battle_params[6] != "1" + if battle_params[6] && battle_params[6] != "1" push_script(new_events, "setBattleRule(\"outcome\", #{battle_params[6]})", old_indent) end list[index, 0] = new_events if new_events.length > 0 @@ -1108,7 +1108,7 @@ module Compiler speech = battle_params[7].gsub(/^\s*_I\(\s*"\s*/, "").gsub(/\"\s*\)\s*$/, "") push_comment(new_events, "EndSpeech2: #{speech.strip}", old_indent) end - if battle_params[7] && !battle_params[7].empty? && battle_params[11] != "nil" + if battle_params[11] && !battle_params[11].empty? && battle_params[11] != "nil" speech = battle_params[11].gsub(/^\s*_I\(\s*"\s*/, "").gsub(/\"\s*\)\s*$/, "") push_comment(new_events, "EndSpeech3: #{speech.strip}", old_indent) end