Rewrote party screen debug code, misc code changes

This commit is contained in:
Maruno17
2024-10-01 19:10:34 +01:00
parent fc538a09f7
commit 61b6bb5aeb
14 changed files with 731 additions and 854 deletions

View File

@@ -248,23 +248,23 @@ def pbUseItem(bag, item, bag_screen = nil)
end
# Only called when in the party screen and having chosen an item to be used on
# the selected Pokémon.
# TODO: Replace all pbMessage and so on in here. scene is the party screen.
def pbUseItemOnPokemon(item, pkmn, scene)
# the selected Pokémon. screen is the party screen.
def pbUseItemOnPokemon(item, pkmn, screen)
item_data = GameData::Item.get(item)
# TM or HM
if item_data.is_machine?
machine = item_data.move
return false if !machine
movename = GameData::Move.get(machine).name
move = item_data.move
return false if !move
move_name = GameData::Move.get(move).name
if pkmn.shadowPokemon?
pbMessage(_INTL("Shadow Pokémon can't be taught any moves.")) { scene.pbUpdate }
elsif !pkmn.compatible_with_move?(machine)
pbMessage(_INTL("{1} can't learn {2}.", pkmn.name, movename)) { scene.pbUpdate }
screen.show_message(_INTL("Shadow Pokémon can't be taught any moves."))
elsif !pkmn.compatible_with_move?(move)
screen.show_message(_INTL("{1} can't learn {2}.", pkmn.name, move_name))
else
pbMessage("\\se[PC access]" + _INTL("You booted up the {1}.", item_data.portion_name) + "\1") { scene.pbUpdate }
if pbConfirmMessage(_INTL("Do you want to teach {1} to {2}?", movename, pkmn.name)) { scene.pbUpdate }
if pbLearnMove(pkmn, machine, false, true) { scene.pbUpdate }
pbSEPlay("PC access")
screen.show_message(_INTL("You booted up the {1}.", item_data.portion_name) + "\1")
if screen.show_confirm_message(_INTL("Do you want to teach {1} to {2}?", move_name, pkmn.name))
if pbLearnMove(pkmn, move, false, true) { screen.update }
$bag.remove(item) if item_data.consumed_after_use?
return true
end
@@ -277,19 +277,19 @@ def pbUseItemOnPokemon(item, pkmn, scene)
max_at_once = ItemHandlers.triggerUseOnPokemonMaximum(item, pkmn)
max_at_once = [max_at_once, $bag.quantity(item)].min
if max_at_once > 1
qty = scene.scene.pbChooseNumber(
qty = screen.choose_number(
_INTL("How many {1} do you want to use?", item_data.portion_name_plural), max_at_once
)
scene.set_help_text("") if scene.is_a?(UI::Party)
screen.set_help_text("")
end
return false if qty <= 0
ret = ItemHandlers.triggerUseOnPokemon(item, qty, pkmn, scene)
scene.clear_annotations
scene.refresh
ret = ItemHandlers.triggerUseOnPokemon(item, qty, pkmn, screen)
screen.clear_annotations
screen.refresh
if ret && item_data.consumed_after_use?
$bag.remove(item, qty)
if !$bag.has?(item)
pbMessage(_INTL("You used your last {1}.", item_data.portion_name)) { scene.pbUpdate }
screen.show_message(_INTL("You used your last {1}.", item_data.portion_name))
end
end
return ret
@@ -317,80 +317,91 @@ end
#===============================================================================
# Give an item to a Pokémon to hold, and take a held item from a Pokémon.
#===============================================================================
# TODO: Replace all pbDisplay and so on in here.
def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0)
# screen is either the party screen or the summary screen.
def pbGiveItemToPokemon(item, pkmn, screen, pkmnid = 0)
return false if item.nil?
newitemname = GameData::Item.get(item).portion_name
# Check if the Pokémon can hold the item, or have its item removed if it's
# already holding one
if pkmn.egg?
scene.pbDisplay(_INTL("Eggs can't hold items."))
screen.show_message(_INTL("Eggs can't hold items."))
return false
elsif pkmn.mail
scene.pbDisplay(_INTL("{1}'s mail must be removed before giving it an item.", pkmn.name))
return false if !pbTakeItemFromPokemon(pkmn, scene)
screen.show_message(_INTL("{1}'s mail must be removed before giving it an item.", pkmn.name))
return false if !pbTakeItemFromPokemon(pkmn, screen)
end
new_item_name = GameData::Item.get(item).portion_name
if pkmn.hasItem?
olditemname = pkmn.item.portion_name
if olditemname.starts_with_vowel?
scene.pbDisplay(_INTL("{1} is already holding an {2}.", pkmn.name, olditemname) + "\1")
# Swap existing held item with the new item
old_item_name = pkmn.item.portion_name
if old_item_name.starts_with_vowel?
screen.show_message(_INTL("{1} is already holding an {2}.", pkmn.name, old_item_name) + "\1")
else
scene.pbDisplay(_INTL("{1} is already holding a {2}.", pkmn.name, olditemname) + "\1")
screen.show_message(_INTL("{1} is already holding a {2}.", pkmn.name, old_item_name) + "\1")
end
if scene.pbConfirm(_INTL("Would you like to switch the two items?"))
if screen.show_confirm_message(_INTL("Would you like to switch the two items?"))
$bag.remove(item)
if !$bag.add(pkmn.item)
raise _INTL("Couldn't re-store deleted item in Bag somehow") if !$bag.add(item)
scene.pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed."))
screen.show_message(_INTL("The Bag is full. The Pokémon's item could not be removed."))
elsif GameData::Item.get(item).is_mail?
if pbWriteMail(item, pkmn, pkmnid, scene)
if pbWriteMail(item, pkmn, pkmnid, screen)
pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname))
screen.show_message(_INTL("Took the {1} from {2} and gave it the {3}.", old_item_name, pkmn.name, new_item_name))
return true
elsif !$bag.add(item)
raise _INTL("Couldn't re-store deleted item in Bag somehow")
end
else
pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname))
screen.show_message(_INTL("Took the {1} from {2} and gave it the {3}.", old_item_name, pkmn.name, new_item_name))
return true
end
end
elsif !GameData::Item.get(item).is_mail? || pbWriteMail(item, pkmn, pkmnid, scene)
elsif !GameData::Item.get(item).is_mail? || pbWriteMail(item, pkmn, pkmnid, screen)
# Give the new item
$bag.remove(item)
pkmn.item = item
scene.pbDisplay(_INTL("{1} is now holding the {2}.", pkmn.name, newitemname))
screen.show_message(_INTL("{1} is now holding the {2}.", pkmn.name, new_item_name))
return true
end
return false
end
# TODO: Replace all pbDisplay and so on in here.
def pbTakeItemFromPokemon(pkmn, scene)
# screen is either the party screen or the summary screen.
def pbTakeItemFromPokemon(pkmn, screen)
ret = false
# Check if the Pokémon has an item to remove, and whether the item can be put
# in the Bag
if !pkmn.hasItem?
scene.pbDisplay(_INTL("{1} isn't holding anything.", pkmn.name))
screen.show_message(_INTL("{1} isn't holding anything.", pkmn.name))
return false
elsif !$bag.can_add?(pkmn.item)
scene.pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed."))
elsif pkmn.mail
if scene.pbConfirm(_INTL("Save the removed mail in your PC?"))
screen.show_message(_INTL("The Bag is full. The Pokémon's item could not be removed."))
return false
end
if pkmn.mail
# Remove a mail item
if screen.show_confirm_message(_INTL("Save the removed mail in your PC?"))
if pbMoveToMailbox(pkmn)
pkmn.item = nil
scene.pbDisplay(_INTL("The mail was saved in your PC."))
screen.show_message(_INTL("The mail was saved in your PC."))
ret = true
else
scene.pbDisplay(_INTL("Your PC's Mailbox is full."))
screen.show_message(_INTL("Your PC's Mailbox is full."))
end
elsif scene.pbConfirm(_INTL("If the mail is removed, its message will be lost. OK?"))
elsif screen.show_confirm_message(_INTL("If the mail is removed, its message will be lost. OK?"))
item_name = pkmn.item.portion_name
$bag.add(pkmn.item)
pkmn.item = nil
scene.pbDisplay(_INTL("Received the {1} from {2}.", item_name, pkmn.name))
screen.show_message(_INTL("Received the {1} from {2}.", item_name, pkmn.name))
ret = true
end
else
# Remove a regular item
item_name = pkmn.item.portion_name
$bag.add(pkmn.item)
pkmn.item = nil
scene.pbDisplay(_INTL("Received the {1} from {2}.", item_name, pkmn.name))
screen.show_message(_INTL("Received the {1} from {2}.", item_name, pkmn.name))
ret = true
end
return ret

View File

@@ -368,7 +368,8 @@ ItemHandlers::UseFromBag.addIf(:move_machines,
item_data = GameData::Item.get(item)
move = item_data.move
next 0 if !move
pbMessage("\\se[PC access]" + _INTL("You booted up the {1}.", item_data.name) + "\1")
pbSEPlay("PC access")
pbMessage(_INTL("You booted up the {1}.", item_data.portion_name) + "\1")
next 0 if !pbConfirmMessage(_INTL("Do you want to teach {1} to a Pokémon?",
GameData::Move.get(move).name))
next 1 if pbMoveTutorChoose(move, nil, true, item_data.is_TR?)

View File

@@ -59,6 +59,14 @@ class Pokemon
@gender = new_gender
end
def male?
return @gender == 0
end
def female?
return @gender == 1
end
# @param new_language [Integer] new owner language
def language=(new_language)
validate new_language => Integer

View File

@@ -226,7 +226,7 @@ def pbRefreshMGCommands(master, online)
elsif gift[1] > 0
itemname = GameData::Item.get(gift[2]).name + sprintf(" x%d", gift[1])
end
ontext = ["[ ]", "[X]"][(online.include?(gift[0])) ? 1 : 0]
ontext = ["[ ]", "[Y]"][(online.include?(gift[0])) ? 1 : 0]
commands.push(_INTL("{1} {2}: {3} ({4})", ontext, gift[0], gift[3], itemname))
end
commands.push(_INTL("Export selected to file"))

View File

@@ -361,11 +361,15 @@ module UI
#---------------------------------------------------------------------------
def fade_in
pbFadeInAndShow(@sprites)# { update_visuals }
# TODO: pbFadeInAndShow changes the colour of all sprites. Make it instead
# change the opacity of @viewport like def pbFadeOutIn.
pbFadeInAndShow(@sprites)
end
def fade_out
pbFadeOutAndHide(@sprites)# { update_visuals }
# TODO: pbFadeOutAndHide changes the colour of all sprites. Make it
# instead change the opacity of @viewport like def pbFadeOutIn.
pbFadeOutAndHide(@sprites)
end
def dispose
@@ -490,7 +494,9 @@ module UI
end
end
@sprites[:speech_box].visible = false
ret = options.keys[ret] if options.is_a?(Hash)
if options.is_a?(Hash)
ret = (ret < 0) ? nil : options.keys[ret]
end
return ret
end

View File

@@ -1,6 +1,6 @@
# TODO: Rewrite def pbUseItemOnPokemon and all the ItemHandlers to stop using
# pbDisplay and whatnot, and ensure they do whatever is appropriate when
# being called with a screen of UI::Party.
# TODO: Rewrite all the ItemHandlers to stop using pbDisplay and whatnot, and
# ensure they do whatever is appropriate when being called with a screen
# of UI::Party.
#===============================================================================
#
#===============================================================================
@@ -223,6 +223,7 @@ class UI::PartyVisualsPanel < UI::SpriteContainer
bar_total_width = 96
bar_width = [@pokemon.hp * bar_total_width / @pokemon.totalhp.to_f, 1.0].max
bar_width = ((bar_width / 2).round) * 2 # Make the bar's length a multiple of 2 pixels
bar_width -= 2 if bar_width == bar_total_width && @pokemon.hp < @pokemon.totalhp
hp_zone = 0 # Green
hp_zone = 1 if @pokemon.hp <= (@pokemon.totalhp / 2).floor # Yellow
hp_zone = 2 if @pokemon.hp <= (@pokemon.totalhp / 4).floor # Red
@@ -344,8 +345,8 @@ class UI::PartyVisuals < UI::BaseVisuals
def initialize_message_box
super
@sprites[:help_window] = Window_AdvancedTextPokemon.new("")
@sprites[:help_window].viewport = @viewport
@sprites[:help_window].z = 1500
@sprites[:help_window].viewport = @viewport
@sprites[:help_window].z = 1500
@sprites[:help_window].setSkin(MessageConfig.pbGetSpeechFrame)
pbBottomLeftLines(@sprites[:help_window], 1, 396)
end
@@ -657,13 +658,9 @@ class UI::PartyVisuals < UI::BaseVisuals
pbPlayCloseMenuSE
return :quit
elsif @sub_mode == :switch_pokemon
pbPlayDecisionSE
return :switch_pokemon_start
elsif @sub_mode == :switch_items
if @party[@index].hasItem?
pbPlayDecisionSE
return :item_move
end
return :item_move if @party[@index].hasItem?
end
pbPlayDecisionSE
return :interact_menu
@@ -673,13 +670,8 @@ class UI::PartyVisuals < UI::BaseVisuals
return :screen_menu
end
when Input::BACK
if switching?
pbPlayCancelSE
return :switch_pokemon_cancel
elsif (@sub_mode || :normal) != :normal
pbPlayCancelSE
return :clear_sub_mode
end
return :switch_pokemon_cancel if switching?
return :clear_sub_mode if (@sub_mode || :normal) != :normal
pbPlayCloseMenuSE
return :quit
end
@@ -714,13 +706,9 @@ class UI::PartyVisuals < UI::BaseVisuals
case input
when Input::USE
if @index == Settings::MAX_PARTY_SIZE
if @multi_select # Confirm
pbPlayDecisionSE
return :confirm
else # Cancel
(switching?) ? pbPlayCancelSE : pbPlayCloseMenuSE
return :quit
end
return :confirm if @multi_select # Confirm
(switching?) ? pbPlayCancelSE : pbPlayCloseMenuSE
return :quit
elsif @index == Settings::MAX_PARTY_SIZE + 1 # Cancel
(switching?) ? pbPlayCancelSE : pbPlayCloseMenuSE
return :quit
@@ -764,8 +752,6 @@ class UI::Party < UI::BaseScreen
# :battle_use_item For battle.
# :use_item Like :choose_pokemon but with a different help text
# :teach_pokemon Like :choose_pokemon but with a different help text
# :choose_entry_order Battle Frontier thing
def initialize(party, mode: :normal)
@party = (party.is_a?(Array)) ? party : [party]
@@ -1002,7 +988,6 @@ class UI::Party < UI::BaseScreen
end
if (@able_proc && !@able_proc.call(pokemon)) ||
(@able_proc2 && !@able_proc2.call(pokemon))
pbPlayDecisionSE
if pokemon.egg?
show_message(_INTL("This egg can't be chosen."))
else
@@ -1063,7 +1048,6 @@ class UI::Party < UI::BaseScreen
command = @visuals.navigate_choose_pokemon
case command
when :chosen
pbPlayDecisionSE
commands = {}
commands[:enter] = _INTL("Entry") if (statuses[index] || 0) == 1 # Not entered yet
commands[:not_enter] = _INTL("No Entry") if (statuses[index] || 0) > 2 # Already entered
@@ -1153,6 +1137,7 @@ UIActionHandlers.add(UI::Party::SCREEN_ID, :debug, {
UIActionHandlers.add(UI::Party::SCREEN_ID, :switch_pokemon_start, {
:effect => proc { |screen|
pbPlayDecisionSE
screen.start_switching
}
})
@@ -1165,6 +1150,7 @@ UIActionHandlers.add(UI::Party::SCREEN_ID, :switch_pokemon_end, {
UIActionHandlers.add(UI::Party::SCREEN_ID, :switch_pokemon_cancel, {
:effect => proc { |screen|
pbPlayCancelSE
screen.end_switching
}
})
@@ -1225,8 +1211,7 @@ UIActionHandlers.add(UI::Party::SCREEN_ID, :item_give, {
UIActionHandlers.add(UI::Party::SCREEN_ID, :item_take, {
:effect => proc { |screen|
pkmn = screen.pokemon
next if !pbTakeItemFromPokemon(pkmn, screen)
screen.refresh
screen.refresh if pbTakeItemFromPokemon(pkmn, screen)
}
})
@@ -1234,6 +1219,7 @@ UIActionHandlers.add(UI::Party::SCREEN_ID, :item_take, {
# (here) has the whole switching process in this handler. Be consistent.
UIActionHandlers.add(UI::Party::SCREEN_ID, :item_move, {
:effect => proc { |screen|
pbPlayDecisionSE
old_pkmn = screen.pokemon
old_item = old_pkmn.item
old_item_name = old_item.name
@@ -1248,7 +1234,6 @@ UIActionHandlers.add(UI::Party::SCREEN_ID, :item_move, {
screen.end_switching
break
end
pbPlayDecisionSE
new_pkmn = screen.party[new_party_idx]
if new_pkmn.egg?
screen.show_message(_INTL("Eggs can't hold items."))
@@ -1307,14 +1292,13 @@ UIActionHandlers.add(UI::Party::SCREEN_ID, :mail_read, {
UIActionHandlers.add(UI::Party::SCREEN_ID, :mail_take, {
:effect => proc { |screen|
if pbTakeItemFromPokemon(screen.pokemon, screen)
screen.refresh
end
screen.refresh if pbTakeItemFromPokemon(screen.pokemon, screen)
}
})
UIActionHandlers.add(UI::Party::SCREEN_ID, :clear_sub_mode, {
:effect => proc { |screen|
pbPlayCancelSE
screen.set_sub_mode(:normal)
}
})

View File

@@ -358,10 +358,13 @@ class UI::PokemonSummaryVisuals < UI::BaseVisuals
break if i == @party_index
@visible_index += 1
end
# Want to stay on the nth page, or the closest available one
# Want to stay on the same page, or the nth page if that no longer exists,
# or the closest available one
pages = all_pages
new_page_index = old_page_index.clamp(0, pages.length - 1)
@page = pages[new_page_index]
if !pages.include?(@page)
new_page_index = old_page_index.clamp(0, pages.length - 1)
@page = pages[new_page_index]
end
# Set the Pokémon's sprite
@sprites[:pokemon].setPokemonBitmap(@pokemon)
@ribbon_offset = 0
@@ -568,6 +571,7 @@ class UI::PokemonSummaryVisuals < UI::BaseVisuals
bar_total_width = 128
bar_width = [@pokemon.hp * bar_total_width / @pokemon.totalhp.to_f, 1.0].max
bar_width = ((bar_width / 2).round) * 2 # Make the bar's length a multiple of 2 pixels
bar_width -= 2 if bar_width == bar_total_width && @pokemon.hp < @pokemon.totalhp
hp_zone = 0 # Green
hp_zone = 1 if @pokemon.hp <= (@pokemon.totalhp / 2).floor # Yellow
hp_zone = 2 if @pokemon.hp <= (@pokemon.totalhp / 4).floor # Red
@@ -1075,13 +1079,9 @@ class UI::PokemonSummaryVisuals < UI::BaseVisuals
pbPlayDecisionSE
return :navigate_moves
when :ribbons
pbPlayDecisionSE
return :navigate_ribbons
else
if @mode != :in_battle
pbPlayDecisionSE
return :interact_menu
end
return :interact_menu if @mode != :in_battle
end
when Input::ACTION
@pokemon.play_cry if !@pokemon.egg?
@@ -1459,6 +1459,8 @@ UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :go_to_next_pokemon, {
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :navigate_moves, {
:returns_value => true,
:effect => proc { |screen|
# NOTE: Doesn't have pbPlayDecisionSE here because this is also called by
# def choose_move, which plays its own SE at the same time.
move_index = screen.visuals.navigate_moves
next move_index if screen.mode == :choose_move
screen.refresh
@@ -1468,6 +1470,7 @@ UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :navigate_moves, {
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :navigate_ribbons, {
:effect => proc { |screen|
pbPlayDecisionSE
screen.visuals.navigate_ribbons
screen.refresh
}

View File

@@ -648,13 +648,9 @@ class UI::BagVisuals < UI::BaseVisuals
def update_interaction(input)
case input
when Input::USE
if switching?
pbPlayDecisionSE
return :switch_item_end
elsif @sub_mode == :rearrange_items && item && pocket_sortable?
pbPlayDecisionSE
return :switch_item_start
elsif !item # "CLOSE BAG"
return :switch_item_end if switching?
return :switch_item_start if @sub_mode == :rearrange_items && item && pocket_sortable?
if !item # "CLOSE BAG"
pbPlayCloseMenuSE
return :quit
end
@@ -662,10 +658,8 @@ class UI::BagVisuals < UI::BaseVisuals
return :interact_menu
when Input::ACTION
if item
if switching?
pbPlayDecisionSE
return :switch_item_end
elsif @pocket == :Machines
return :switch_item_end if switching?
if @pocket == :Machines
pbPlayDecisionSE
@show_move_details = !@show_move_details
refresh_move_details
@@ -676,13 +670,8 @@ class UI::BagVisuals < UI::BaseVisuals
end
end
when Input::BACK
if switching?
pbPlayCancelSE
return :switch_item_cancel
elsif (@sub_mode || :normal) != :normal && pocket_sortable?
pbPlayCancelSE
return :clear_sub_mode
end
return :switch_item_cancel if switching?
return :clear_sub_mode if (@sub_mode || :normal) != :normal && pocket_sortable?
pbPlayCloseMenuSE
return :quit
end
@@ -719,12 +708,9 @@ class UI::BagVisuals < UI::BaseVisuals
def update_interaction_choose_item(input)
case input
when Input::USE
if !item # "CLOSE BAG"
pbPlayCloseMenuSE
return :quit
end
pbPlayDecisionSE
return :chosen
return :chosen if item
pbPlayCloseMenuSE
return :quit
when Input::ACTION
if item && @pocket == :Machines
pbPlayDecisionSE
@@ -829,8 +815,12 @@ class UI::Bag < UI::BaseScreen
loop do
on_start_main_loop
chosen_item = choose_item_core
if chosen_item && block_given?
next if !yield chosen_item
if chosen_item
if block_given?
next if !yield chosen_item
else
pbPlayDecisionSE
end
end
@result = chosen_item
break
@@ -859,18 +849,21 @@ UIActionHandlers.add(UI::Bag::SCREEN_ID, :screen_menu, {
UIActionHandlers.add(UI::Bag::SCREEN_ID, :switch_item_start, {
:effect => proc { |screen|
pbPlayDecisionSE
screen.start_switching
}
})
UIActionHandlers.add(UI::Bag::SCREEN_ID, :switch_item_end, {
:effect => proc { |screen|
pbPlayDecisionSE
screen.switch_items(screen.switch_index, screen.index)
}
})
UIActionHandlers.add(UI::Bag::SCREEN_ID, :switch_item_cancel, {
:effect => proc { |screen|
pbPlayCancelSE
screen.cancel_switching
}
})
@@ -883,6 +876,7 @@ UIActionHandlers.add(UI::Bag::SCREEN_ID, :rearrange_items_mode, {
UIActionHandlers.add(UI::Bag::SCREEN_ID, :clear_sub_mode, {
:effect => proc { |screen|
pbPlayCancelSE
screen.set_sub_mode(:normal)
}
})

View File

@@ -281,10 +281,6 @@ class PokemonMart_Scene
end
def pbStartSellScene2(bag, adapter)
# TODO: Don't have a subscene. Make a new BagVisuals class for choosing an
# item to sell, and open that. It can inherit from class
# UI::BagVisuals and add the money window (that may be all that needs
# adding).
@subscene = PokemonBag_Scene.new
@adapter = adapter
@viewport2 = Viewport.new(0, 0, Graphics.width, Graphics.height)

View File

@@ -60,6 +60,11 @@ def pbGetLanguage
return 2 # Use 'English' by default
end
def pbChooseLanguage
commands = Settings::LANGUAGES.map { |val| val[0] }
return pbShowCommands(nil, commands)
end
# Converts a Celsius temperature to Fahrenheit.
def toFahrenheit(celsius)
return (celsius * 9.0 / 5.0).round + 32
@@ -595,14 +600,6 @@ def pbLoadRpgxpScene(scene)
Graphics.transition
end
def pbChooseLanguage
commands = []
Settings::LANGUAGES.each do |lang|
commands.push(lang[0])
end
return pbShowCommands(nil, commands)
end
def pbScreenCapture
t = Time.now
filestart = t.strftime("[%Y-%m-%d] %H_%M_%S.%L")

View File

@@ -159,7 +159,7 @@ module PokemonDebugMixin
# Main loop
command = 0
loop do
command = pbShowCommands(_INTL("Do what with {1}?", pkmn.name), commands.list, command)
command = show_menu(_INTL("Do what with {1}?", pkmn.name), commands.list, command)
if command < 0
parent = commands.getParent
break if !parent
@@ -422,8 +422,41 @@ end
#===============================================================================
#
#===============================================================================
class PokemonDebugPartyScreen
class UI::PartyDebugVisuals < UI::BaseVisuals
def initialize_background; end
def initialize_overlay; end
def choose_number(help_text, maximum, init_value = 1)
old_letter_by_letter = @sprites[:speech_box].letterbyletter
@sprites[:speech_box].letterbyletter = false
ret = super
@sprites[:speech_box].letterbyletter = old_letter_by_letter
return ret
end
end
class UI::PartyDebug < UI::BaseScreen
include PokemonDebugMixin
def initialize_visuals
@visuals = UI::PartyDebugVisuals.new
end
def choose_move(pkmn, message, index = 0)
# TODO: The move names can get rather wide, making the message box rather
# thin. It's just about acceptable, but maybe the choice window needs
# to be displayed above the message box instead of to the right of it.
move_names = []
pkmn.moves.each do |move|
next if !move || !move.id
if move.total_pp <= 0
move_names.push(_INTL("{1} (PP: ---)", move.name))
else
move_names.push(_INTL("{1} (PP: {2}/{3})", move.name, move.pp, move.total_pp))
end
end
return show_menu(message, move_names, index)
end
end
#===============================================================================

View File

@@ -354,9 +354,9 @@ MenuHandlers.add(:debug_menu, :test_wild_battle_advanced, {
end
else # Edit a Pokémon
if pbConfirmMessage(_INTL("Change this Pokémon?"))
scr = PokemonDebugPartyScreen.new
scr = UI::PartyDebug.new
scr.pokemon_debug_menu(pkmn[pkmnCmd], -1, nil, true)
scr.pbEndScreen
scr.silent_end_screen
elsif pbConfirmMessage(_INTL("Delete this Pokémon?"))
pkmn.delete_at(pkmnCmd)
size0 = [pkmn.length, 1].max

View File

@@ -762,134 +762,3 @@ def pbCheckTileValidity(tile_id, map, tilesets, passages)
end
return false
end
#===============================================================================
# Pseudo-party screen for editing Pokémon being set up for a wild battle.
# TODO: Rewrite this with the new UI code.
#===============================================================================
class PokemonDebugPartyScreen
def initialize
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@messageBox = Window_AdvancedTextPokemon.new("")
@messageBox.viewport = @viewport
@messageBox.visible = false
@messageBox.letterbyletter = true
pbBottomLeftLines(@messageBox, 2)
@helpWindow = Window_UnformattedTextPokemon.new("")
@helpWindow.viewport = @viewport
@helpWindow.visible = true
pbBottomLeftLines(@helpWindow, 1)
end
def pbEndScreen
@messageBox.dispose
@helpWindow.dispose
@viewport.dispose
end
def pbDisplay(text)
@messageBox.text = text
@messageBox.visible = true
@helpWindow.visible = false
pbPlayDecisionSE
loop do
Graphics.update
Input.update
pbUpdate
if @messageBox.busy?
if Input.trigger?(Input::USE)
pbPlayDecisionSE if @messageBox.pausing?
@messageBox.resume
end
else
if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE)
break
end
end
end
@messageBox.visible = false
@helpWindow.visible = true
end
def pbConfirm(text)
ret = -1
@messageBox.text = text
@messageBox.visible = true
@helpWindow.visible = false
using(cmdwindow = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) do
cmdwindow.visible = false
pbBottomRight(cmdwindow)
cmdwindow.y -= @messageBox.height
cmdwindow.z = @viewport.z + 1
loop do
Graphics.update
Input.update
cmdwindow.visible = true if !@messageBox.busy?
cmdwindow.update
pbUpdate
if !@messageBox.busy?
if Input.trigger?(Input::BACK)
ret = false
break
elsif Input.trigger?(Input::USE) && @messageBox.resume
ret = (cmdwindow.index == 0)
break
end
end
end
end
@messageBox.visible = false
@helpWindow.visible = true
return ret
end
def pbShowCommands(text, commands, index = 0)
ret = -1
@helpWindow.visible = true
using(cmdwindow = Window_CommandPokemonColor.new(commands)) do
cmdwindow.z = @viewport.z + 1
cmdwindow.index = index
pbBottomRight(cmdwindow)
@helpWindow.resizeHeightToFit(text, Graphics.width - cmdwindow.width)
@helpWindow.text = text
pbBottomLeft(@helpWindow)
loop do
Graphics.update
Input.update
cmdwindow.update
pbUpdate
if Input.trigger?(Input::BACK)
pbPlayCancelSE
ret = -1
break
elsif Input.trigger?(Input::USE)
pbPlayDecisionSE
ret = cmdwindow.index
break
end
end
end
return ret
end
def pbChooseMove(pkmn, text, index = 0)
moveNames = []
pkmn.moves.each do |i|
if i.total_pp <= 0
moveNames.push(_INTL("{1} (PP: ---)", i.name))
else
moveNames.push(_INTL("{1} (PP: {2}/{3})", i.name, i.pp, i.total_pp))
end
end
return pbShowCommands(text, moveNames, index)
end
def pbRefreshSingle(index); end
def update
@messageBox.update
@helpWindow.update
end
alias pbUpdate update
end