Changes to how the game handles quitting

With these changes the game technically never "allows" you to quit, and
instead the input is handled by Scene_Map.  This lets us run an event
before they quit.
This commit is contained in:
Michael Shirt 2016-10-17 15:34:45 -06:00
parent d403608189
commit 1750dc7c98
4 changed files with 25 additions and 10 deletions

View file

@ -24,12 +24,14 @@ begin
$GDC = false
# Make scene object (title screen)
$scene = Scene_Title.new
Oneshot.allow_exit false
# Call main method as long as $scene is effective
while $scene != nil
$scene.main
end
# Fade out
Graphics.transition(20)
Oneshot.allow_exit true
rescue Errno::ENOENT
# Supplement Errno::ENOENT exception
# If unable to open file, display message and end

View file

@ -38,11 +38,11 @@ module Graphics
class << self
alias_method :update_native, :update
def update
if $game_map.map_id == 97
Oneshot.allow_exit false
elsif $game_system.map_interpreter
Oneshot.allow_exit !$game_system.map_interpreter.running?
end
#if $game_map.map_id == 97
# Oneshot.allow_exit false
#elsif $game_system.map_interpreter
# Oneshot.allow_exit ($scene == nil)
#end
update_native
end
end

View file

@ -70,7 +70,7 @@ def real_load
# Restore BGM and BGS
# switch 181 or 183 or 186 means its time for a dream, so no BGM
if !($game_switches[181] || $game_switches[183] || $game_switches[186] || $game_switches[188])
if !($game_switches[181] || $game_switches[183] || $game_switches[186] || $game_switches[188] || $game_switches[190])
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
end
@ -92,6 +92,5 @@ end
def quit_game_bed
$game_system.map_interpreter.index += 1
save
Oneshot.allow_exit true
exit
$scene = nil
end

View file

@ -89,8 +89,16 @@ class Scene_Map
# * Frame Update
#--------------------------------------------------------------------------
def update
if Input.quit? && $game_map.map_id == 97
$game_temp.common_event_id = 33
if Input.quit?
# put in dialogue boxes here for player
# either telling them they can't quit during a cutscene
# or telling them they're saving and quitting
if $game_system.map_interpreter.running?
EdText.info("You cannot perform this action during cutscenes.")
return
else
$game_temp.common_event_id = 35
end
end
# Loop
loop do
@ -100,6 +108,9 @@ class Scene_Map
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
if $scene == nil
return
end
$game_system.map_interpreter.update
$game_player.update if !@menu.visible && !@item_menu.visible && !@fast_travel.visible
$game_followers.each{|f| f.update}
@ -463,6 +474,9 @@ class Scene_Map
def new_footsplash(direction, x, y)
@spriteset.new_footsplash(direction, x, y)
end
def fix_footsplashes(xDelt, yDelt)
@spriteset.fix_footsplashes(xDelt, yDelt)
end
def menu_open?
@menu.visible || @item_menu.visible
end