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:
parent
d403608189
commit
1750dc7c98
|
|
@ -24,12 +24,14 @@ begin
|
||||||
$GDC = false
|
$GDC = false
|
||||||
# Make scene object (title screen)
|
# Make scene object (title screen)
|
||||||
$scene = Scene_Title.new
|
$scene = Scene_Title.new
|
||||||
|
Oneshot.allow_exit false
|
||||||
# Call main method as long as $scene is effective
|
# Call main method as long as $scene is effective
|
||||||
while $scene != nil
|
while $scene != nil
|
||||||
$scene.main
|
$scene.main
|
||||||
end
|
end
|
||||||
# Fade out
|
# Fade out
|
||||||
Graphics.transition(20)
|
Graphics.transition(20)
|
||||||
|
Oneshot.allow_exit true
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
# Supplement Errno::ENOENT exception
|
# Supplement Errno::ENOENT exception
|
||||||
# If unable to open file, display message and end
|
# If unable to open file, display message and end
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ module Graphics
|
||||||
class << self
|
class << self
|
||||||
alias_method :update_native, :update
|
alias_method :update_native, :update
|
||||||
def update
|
def update
|
||||||
if $game_map.map_id == 97
|
#if $game_map.map_id == 97
|
||||||
Oneshot.allow_exit false
|
# Oneshot.allow_exit false
|
||||||
elsif $game_system.map_interpreter
|
#elsif $game_system.map_interpreter
|
||||||
Oneshot.allow_exit !$game_system.map_interpreter.running?
|
# Oneshot.allow_exit ($scene == nil)
|
||||||
end
|
#end
|
||||||
update_native
|
update_native
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ def real_load
|
||||||
# Restore BGM and BGS
|
# Restore BGM and BGS
|
||||||
# switch 181 or 183 or 186 means its time for a dream, so no BGM
|
# 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.bgm_play($game_system.playing_bgm)
|
||||||
$game_system.bgs_play($game_system.playing_bgs)
|
$game_system.bgs_play($game_system.playing_bgs)
|
||||||
end
|
end
|
||||||
|
|
@ -92,6 +92,5 @@ end
|
||||||
def quit_game_bed
|
def quit_game_bed
|
||||||
$game_system.map_interpreter.index += 1
|
$game_system.map_interpreter.index += 1
|
||||||
save
|
save
|
||||||
Oneshot.allow_exit true
|
$scene = nil
|
||||||
exit
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,16 @@ class Scene_Map
|
||||||
# * Frame Update
|
# * Frame Update
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
def update
|
def update
|
||||||
if Input.quit? && $game_map.map_id == 97
|
if Input.quit?
|
||||||
$game_temp.common_event_id = 33
|
# 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
|
end
|
||||||
# Loop
|
# Loop
|
||||||
loop do
|
loop do
|
||||||
|
|
@ -100,6 +108,9 @@ class Scene_Map
|
||||||
# to run any event, and the player isn't provided the opportunity to
|
# to run any event, and the player isn't provided the opportunity to
|
||||||
# move in an instant)
|
# move in an instant)
|
||||||
$game_map.update
|
$game_map.update
|
||||||
|
if $scene == nil
|
||||||
|
return
|
||||||
|
end
|
||||||
$game_system.map_interpreter.update
|
$game_system.map_interpreter.update
|
||||||
$game_player.update if !@menu.visible && !@item_menu.visible && !@fast_travel.visible
|
$game_player.update if !@menu.visible && !@item_menu.visible && !@fast_travel.visible
|
||||||
$game_followers.each{|f| f.update}
|
$game_followers.each{|f| f.update}
|
||||||
|
|
@ -463,6 +474,9 @@ class Scene_Map
|
||||||
def new_footsplash(direction, x, y)
|
def new_footsplash(direction, x, y)
|
||||||
@spriteset.new_footsplash(direction, x, y)
|
@spriteset.new_footsplash(direction, x, y)
|
||||||
end
|
end
|
||||||
|
def fix_footsplashes(xDelt, yDelt)
|
||||||
|
@spriteset.fix_footsplashes(xDelt, yDelt)
|
||||||
|
end
|
||||||
def menu_open?
|
def menu_open?
|
||||||
@menu.visible || @item_menu.visible
|
@menu.visible || @item_menu.visible
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue