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