Skip to content

Commit

Permalink
Implemented Battle Debug Menu (#130)
Browse files Browse the repository at this point in the history
* initial commit to setup game.ini
* renamed title of masters Game.ini
* reenabled gitignore for Game.ini
* Between Commit
* Finished Battle Debug Menu
* Clean up for pull request
* Manual fixes
* Fixed oversight where numerical min/max wasm't considered
  • Loading branch information
TheNordicOne authored Nov 24, 2021
1 parent a9426b0 commit 7c48148
Show file tree
Hide file tree
Showing 6 changed files with 1,449 additions and 2 deletions.
Binary file modified Data/Scripts.rxdata
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ def pbCallMenu(idxBattler)
end

def pbDebugMenu
# NOTE: This doesn't do anything yet. Maybe you can write your own debugging
# options!
pbBattleDebug(self)
end

#=============================================================================
Expand Down
80 changes: 80 additions & 0 deletions Data/Scripts/020_Debug/003_Debug menus/001_Debug_Menus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,82 @@ def pbPokemonDebug(pkmn, pkmnid, heldpoke = nil, settingUpBattle = false)
end
end

#===============================================================================
#
#===============================================================================
module BattleDebugMixin
def pbBattleDebug(battle,show_all = true)
registerBattlerCommands(battle)
commands = CommandMenuList.new
BattleDebugMenuCommands.each do |option, hash|
commands.add(option, hash) if show_all || hash["always_show"]
end



viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
viewport.z = 99999
sprites = {}
sprites["textbox"] = pbCreateMessageWindow
sprites["textbox"].letterbyletter = false
sprites["cmdwindow"] = Window_CommandPokemonEx.new(commands.list)
cmdwindow = sprites["cmdwindow"]
cmdwindow.x = Graphics.width - cmdwindow.width
cmdwindow.y = Graphics.height-sprites["textbox"].height - cmdwindow.height
cmdwindow.viewport = viewport
cmdwindow.visible = true
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
pbFadeInAndShow(sprites)
ret = -1
refresh = true
loop do
loop do
oldindex = cmdwindow.index
cmdwindow.update
if refresh || cmdwindow.index != oldindex
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
refresh = false
end
Graphics.update
Input.update
if Input.trigger?(Input::BACK)
parent = commands.getParent
if parent
pbPlayCancelSE
commands.currentList = parent[0]
cmdwindow.commands = commands.list
cmdwindow.index = parent[1]
refresh = true
else
ret = -1
break
end
elsif Input.trigger?(Input::USE)
ret = cmdwindow.index
break
end
end
break if ret < 0
cmd = commands.getCommand(ret)
if commands.hasSubMenu?(cmd)
pbPlayDecisionSE
commands.currentList = cmd
cmdwindow.commands = commands.list
cmdwindow.index = 0
refresh = true
else
BattleDebugMenuCommands.call("effect", cmd,battle,sprites)
end
end
pbPlayCloseMenuSE
pbFadeOutAndHide(sprites)
pbDisposeMessageWindow(sprites["textbox"])
pbDisposeSpriteHash(sprites)
viewport.dispose
end

end

#===============================================================================
#
#===============================================================================
Expand All @@ -183,3 +259,7 @@ class PokemonStorageScreen
class PokemonDebugPartyScreen
include PokemonDebugMixin
end

class PokeBattle_Battle
include BattleDebugMixin
end
Loading

0 comments on commit 7c48148

Please sign in to comment.