#========================================================================
# ** Crossfader, by: KilloZapit
#------------------------------------------------------------------------
# Just a script to tweak the fades to use fancy crossfades like the
# battle transition screens for all fades.
# https://www.rpgmakercentral.com/topic/32575-fancy-pants-crossfade-script/
#------------------------------------------------------------------------
module KZFadeConfig
# FADE_IMAGE: Transition image used for fades.
# Works the battle transition image, use "" to use no image.
FADE_IMAGE = "Graphics/System/Fade"
# FADE_EDGE: Effects how smooth image fades are.
FADE_EDGE = 100
# FADE_TIME: Set to a number to set how long fades take or leave nil for
# a default value based on the transition_speed method.
FADE_TIME = 45
# FADE_TIME_FACTOR: Multiplier for default fade times.
FADE_TIME_FACTOR = 2
end
class Scene_Base
def crossfade_time
KZFadeConfig::FADE_TIME || transition_speed * KZFadeConfig::FADE_TIME_FACTOR
end
def perform_cross_transition
Graphics.transition(crossfade_time, KZFadeConfig::FADE_IMAGE,
KZFadeConfig::FADE_EDGE)
end
def crossfade_to_black
Graphics.freeze
sprite = Sprite.new
sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
color = Color.new(0, 0, 0)
sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, color)
sprite.x = 0
sprite.y = 0
sprite.z = 10000
perform_cross_transition
Graphics.freeze
sprite.dispose
end
end
class Scene_Menu < Scene_MenuBase
alias r2_create_command_window_exit_fade create_command_window
def create_command_window
r2_create_command_window_exit_fade
@command_window.set_handler(:cancel, method(:exit_menu))
end
def exit_menu
case $game_temp.fade_type
when 0
crossfade_to_black
when 1
white_fadeout(fadeout_speed)
end
return_scene
end
end