Makes quit game option return to menu instead of rebooting

This commit is contained in:
infinitefusion
2022-07-21 10:19:20 -04:00
parent d3a7454930
commit 92bd2a3cf7

View File

@@ -3,15 +3,15 @@
#=============================================================================== #===============================================================================
class PokemonPauseMenu_Scene class PokemonPauseMenu_Scene
def pbStartScene def pbStartScene
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height) @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999 @viewport.z = 99999
@sprites = {} @sprites = {}
@sprites["cmdwindow"] = Window_CommandPokemon.new([]) @sprites["cmdwindow"] = Window_CommandPokemon.new([])
@sprites["cmdwindow"].visible = false @sprites["cmdwindow"].visible = false
@sprites["cmdwindow"].viewport = @viewport @sprites["cmdwindow"].viewport = @viewport
@sprites["infowindow"] = Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport) @sprites["infowindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
@sprites["infowindow"].visible = false @sprites["infowindow"].visible = false
@sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport) @sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
@sprites["helpwindow"].visible = false @sprites["helpwindow"].visible = false
@infostate = false @infostate = false
@helpstate = false @helpstate = false
@@ -19,15 +19,15 @@ class PokemonPauseMenu_Scene
end end
def pbShowInfo(text) def pbShowInfo(text)
@sprites["infowindow"].resizeToFit(text,Graphics.height) @sprites["infowindow"].resizeToFit(text, Graphics.height)
@sprites["infowindow"].text = text @sprites["infowindow"].text = text
@sprites["infowindow"].visible = true @sprites["infowindow"].visible = true
@infostate = true @infostate = true
end end
def pbShowHelp(text) def pbShowHelp(text)
@sprites["helpwindow"].resizeToFit(text,Graphics.height) @sprites["helpwindow"].resizeToFit(text, Graphics.height)
@sprites["helpwindow"].text = text @sprites["helpwindow"].text = text
@sprites["helpwindow"].visible = true @sprites["helpwindow"].visible = true
pbBottomLeft(@sprites["helpwindow"]) pbBottomLeft(@sprites["helpwindow"])
@helpstate = true @helpstate = true
@@ -49,11 +49,11 @@ class PokemonPauseMenu_Scene
ret = -1 ret = -1
cmdwindow = @sprites["cmdwindow"] cmdwindow = @sprites["cmdwindow"]
cmdwindow.commands = commands cmdwindow.commands = commands
cmdwindow.index = $PokemonTemp.menuLastChoice cmdwindow.index = $PokemonTemp.menuLastChoice
cmdwindow.resizeToFit(commands) cmdwindow.resizeToFit(commands)
cmdwindow.x = Graphics.width-cmdwindow.width cmdwindow.x = Graphics.width - cmdwindow.width
cmdwindow.y = 0 cmdwindow.y = 0
cmdwindow.visible = true cmdwindow.visible = true
loop do loop do
cmdwindow.update cmdwindow.update
Graphics.update Graphics.update
@@ -103,50 +103,50 @@ class PokemonPauseMenu
@scene.pbStartScene @scene.pbStartScene
endscene = true endscene = true
commands = [] commands = []
cmdPokedex = -1 cmdPokedex = -1
cmdPokemon = -1 cmdPokemon = -1
cmdBag = -1 cmdBag = -1
cmdTrainer = -1 cmdTrainer = -1
cmdSave = -1 cmdSave = -1
cmdOption = -1 cmdOption = -1
cmdPokegear = -1 cmdPokegear = -1
cmdDebug = -1 cmdDebug = -1
cmdQuit = -1 cmdQuit = -1
cmdEndGame = -1 cmdEndGame = -1
if $Trainer.has_pokedex && $Trainer.pokedex.accessible_dexes.length > 0 if $Trainer.has_pokedex && $Trainer.pokedex.accessible_dexes.length > 0
commands[cmdPokedex = commands.length] = _INTL("Pokédex") commands[cmdPokedex = commands.length] = _INTL("Pokédex")
end end
commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $Trainer.party_count > 0 commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $Trainer.party_count > 0
commands[cmdBag = commands.length] = _INTL("Bag") if !pbInBugContest? commands[cmdBag = commands.length] = _INTL("Bag") if !pbInBugContest?
commands[cmdPokegear = commands.length] = _INTL("Pokégear") if $Trainer.has_pokegear commands[cmdPokegear = commands.length] = _INTL("Pokégear") if $Trainer.has_pokegear
commands[cmdTrainer = commands.length] = $Trainer.name commands[cmdTrainer = commands.length] = $Trainer.name
if pbInSafari? if pbInSafari?
if Settings::SAFARI_STEPS <= 0 if Settings::SAFARI_STEPS <= 0
@scene.pbShowInfo(_INTL("Balls: {1}",pbSafariState.ballcount)) @scene.pbShowInfo(_INTL("Balls: {1}", pbSafariState.ballcount))
else else
@scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}", @scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount)) pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
end end
commands[cmdQuit = commands.length] = _INTL("Quit") commands[cmdQuit = commands.length] = _INTL("Quit")
elsif pbInBugContest? elsif pbInBugContest?
if pbBugContestState.lastPokemon if pbBugContestState.lastPokemon
@scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}", @scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
pbBugContestState.lastPokemon.speciesName, pbBugContestState.lastPokemon.speciesName,
pbBugContestState.lastPokemon.level, pbBugContestState.lastPokemon.level,
pbBugContestState.ballcount)) pbBugContestState.ballcount))
else else
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}",pbBugContestState.ballcount)) @scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount))
end end
commands[cmdQuit = commands.length] = _INTL("Quit Contest") commands[cmdQuit = commands.length] = _INTL("Quit Contest")
else else
commands[cmdSave = commands.length] = _INTL("Save") if $game_system && !$game_system.save_disabled commands[cmdSave = commands.length] = _INTL("Save") if $game_system && !$game_system.save_disabled
end end
commands[cmdOption = commands.length] = _INTL("Options") commands[cmdOption = commands.length] = _INTL("Options")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
commands[cmdEndGame = commands.length] = _INTL("Quit Game") commands[cmdEndGame = commands.length] = _INTL("Quit Game")
loop do loop do
command = @scene.pbShowCommands(commands) command = @scene.pbShowCommands(commands)
if cmdPokedex>=0 && command==cmdPokedex if cmdPokedex >= 0 && command == cmdPokedex
pbPlayDecisionSE pbPlayDecisionSE
if Settings::USE_CURRENT_REGION_DEX if Settings::USE_CURRENT_REGION_DEX
pbFadeOutIn { pbFadeOutIn {
@@ -157,13 +157,13 @@ class PokemonPauseMenu
} }
else else
#if $Trainer.pokedex.accessible_dexes.length == 1 #if $Trainer.pokedex.accessible_dexes.length == 1
$PokemonGlobal.pokedexDex = $Trainer.pokedex.accessible_dexes[0] $PokemonGlobal.pokedexDex = $Trainer.pokedex.accessible_dexes[0]
pbFadeOutIn { pbFadeOutIn {
scene = PokemonPokedex_Scene.new scene = PokemonPokedex_Scene.new
screen = PokemonPokedexScreen.new(scene) screen = PokemonPokedexScreen.new(scene)
screen.pbStartScreen screen.pbStartScreen
@scene.pbRefresh @scene.pbRefresh
} }
# else # else
# pbFadeOutIn { # pbFadeOutIn {
# scene = PokemonPokedexMenu_Scene.new # scene = PokemonPokedexMenu_Scene.new
@@ -173,26 +173,26 @@ class PokemonPauseMenu
# } # }
# end # end
end end
elsif cmdPokemon>=0 && command==cmdPokemon elsif cmdPokemon >= 0 && command == cmdPokemon
pbPlayDecisionSE pbPlayDecisionSE
hiddenmove = nil hiddenmove = nil
pbFadeOutIn { pbFadeOutIn {
sscene = PokemonParty_Scene.new sscene = PokemonParty_Scene.new
sscreen = PokemonPartyScreen.new(sscene,$Trainer.party) sscreen = PokemonPartyScreen.new(sscene, $Trainer.party)
hiddenmove = sscreen.pbPokemonScreen hiddenmove = sscreen.pbPokemonScreen
(hiddenmove) ? @scene.pbEndScene : @scene.pbRefresh (hiddenmove) ? @scene.pbEndScene : @scene.pbRefresh
} }
if hiddenmove if hiddenmove
$game_temp.in_menu = false $game_temp.in_menu = false
pbUseHiddenMove(hiddenmove[0],hiddenmove[1]) pbUseHiddenMove(hiddenmove[0], hiddenmove[1])
return return
end end
elsif cmdBag>=0 && command==cmdBag elsif cmdBag >= 0 && command == cmdBag
pbPlayDecisionSE pbPlayDecisionSE
item = nil item = nil
pbFadeOutIn { pbFadeOutIn {
scene = PokemonBag_Scene.new scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag) screen = PokemonBagScreen.new(scene, $PokemonBag)
item = screen.pbStartScreen item = screen.pbStartScreen
(item) ? @scene.pbEndScene : @scene.pbRefresh (item) ? @scene.pbEndScene : @scene.pbRefresh
} }
@@ -201,7 +201,7 @@ class PokemonPauseMenu
pbUseKeyItemInField(item) pbUseKeyItemInField(item)
return return
end end
elsif cmdPokegear>=0 && command==cmdPokegear elsif cmdPokegear >= 0 && command == cmdPokegear
pbPlayDecisionSE pbPlayDecisionSE
pbFadeOutIn { pbFadeOutIn {
scene = PokemonPokegear_Scene.new scene = PokemonPokegear_Scene.new
@@ -209,7 +209,7 @@ class PokemonPauseMenu
screen.pbStartScreen screen.pbStartScreen
@scene.pbRefresh @scene.pbRefresh
} }
elsif cmdTrainer>=0 && command==cmdTrainer elsif cmdTrainer >= 0 && command == cmdTrainer
pbPlayDecisionSE pbPlayDecisionSE
pbFadeOutIn { pbFadeOutIn {
scene = PokemonTrainerCard_Scene.new scene = PokemonTrainerCard_Scene.new
@@ -217,7 +217,7 @@ class PokemonPauseMenu
screen.pbStartScreen screen.pbStartScreen
@scene.pbRefresh @scene.pbRefresh
} }
elsif cmdQuit>=0 && command==cmdQuit elsif cmdQuit >= 0 && command == cmdQuit
@scene.pbHideMenu @scene.pbHideMenu
if pbInSafari? if pbInSafari?
if pbConfirmMessage(_INTL("Would you like to leave the Safari Game right now?")) if pbConfirmMessage(_INTL("Would you like to leave the Safari Game right now?"))
@@ -237,7 +237,7 @@ class PokemonPauseMenu
pbShowMenu pbShowMenu
end end
end end
elsif cmdSave>=0 && command==cmdSave elsif cmdSave >= 0 && command == cmdSave
@scene.pbHideMenu @scene.pbHideMenu
scene = PokemonSave_Scene.new scene = PokemonSave_Scene.new
screen = PokemonSaveScreen.new(scene) screen = PokemonSaveScreen.new(scene)
@@ -248,7 +248,7 @@ class PokemonPauseMenu
else else
pbShowMenu pbShowMenu
end end
elsif cmdOption>=0 && command==cmdOption elsif cmdOption >= 0 && command == cmdOption
pbPlayDecisionSE pbPlayDecisionSE
pbFadeOutIn { pbFadeOutIn {
scene = PokemonOption_Scene.new scene = PokemonOption_Scene.new
@@ -257,22 +257,20 @@ class PokemonPauseMenu
pbUpdateSceneMap pbUpdateSceneMap
@scene.pbRefresh @scene.pbRefresh
} }
elsif cmdDebug>=0 && command==cmdDebug elsif cmdDebug >= 0 && command == cmdDebug
pbPlayDecisionSE pbPlayDecisionSE
pbFadeOutIn { pbFadeOutIn {
pbDebugMenu pbDebugMenu
@scene.pbRefresh @scene.pbRefresh
} }
elsif cmdEndGame>=0 && command==cmdEndGame elsif cmdEndGame >= 0 && command == cmdEndGame
@scene.pbHideMenu @scene.pbHideMenu
if pbConfirmMessage(_INTL("Are you sure you want to quit the game?")) if pbConfirmMessage(_INTL("Are you sure you want to quit the game and return to the main menu?"))
scene = PokemonSave_Scene.new scene = PokemonSave_Scene.new
screen = PokemonSaveScreen.new(scene) screen = PokemonSaveScreen.new(scene)
if screen.pbSaveScreen screen.pbSaveScreen
@scene.pbEndScene resetPlayerPosition
end $game_temp.to_title = true
@scene.pbEndScene
$scene = nil
return return
else else
pbShowMenu pbShowMenu