Fixed some bad usage of sprintf, cleaned up some translatable messages

This commit is contained in:
Maruno17
2023-04-02 00:52:12 +01:00
parent 1ead0a76f5
commit 9d50b27aa0
32 changed files with 87 additions and 84 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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(

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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")

View File

@@ -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")

View File

@@ -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

View File

@@ -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)

View File

@@ -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}%",

View File

@@ -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

View File

@@ -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 = []