mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Removed Graphics.delta_s and the usage thereof, tweaked credits screen code
This commit is contained in:
@@ -64,8 +64,8 @@ def pbPrintException(e)
|
|||||||
# output message
|
# output message
|
||||||
print("#{message}\r\nThis exception was logged in #{errorlogline}.\r\nHold Ctrl when closing this message to copy it to the clipboard.")
|
print("#{message}\r\nThis exception was logged in #{errorlogline}.\r\nHold Ctrl when closing this message to copy it to the clipboard.")
|
||||||
# Give a ~500ms coyote time to start holding Control
|
# Give a ~500ms coyote time to start holding Control
|
||||||
t = System.delta
|
t = System.uptime
|
||||||
until (System.delta - t) >= 500_000
|
until System.uptime - t >= 0.5
|
||||||
Input.update
|
Input.update
|
||||||
if Input.press?(Input::CTRL)
|
if Input.press?(Input::CTRL)
|
||||||
Input.clipboard = message
|
Input.clipboard = message
|
||||||
|
|||||||
@@ -27,12 +27,6 @@ class Bitmap
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module Graphics
|
|
||||||
def self.delta_s
|
|
||||||
return self.delta
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbSetResizeFactor(factor)
|
def pbSetResizeFactor(factor)
|
||||||
if !$ResizeInitialized
|
if !$ResizeInitialized
|
||||||
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
|
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
|
||||||
|
|||||||
@@ -395,8 +395,8 @@ module PluginManager
|
|||||||
# output message
|
# output message
|
||||||
print("#{message}\r\nThis exception was logged in #{errorlogline}.\r\nHold Ctrl when closing this message to copy it to the clipboard.")
|
print("#{message}\r\nThis exception was logged in #{errorlogline}.\r\nHold Ctrl when closing this message to copy it to the clipboard.")
|
||||||
# Give a ~500ms coyote time to start holding Control
|
# Give a ~500ms coyote time to start holding Control
|
||||||
t = System.delta
|
t = System.uptime
|
||||||
until (System.delta - t) >= 500_000
|
until System.uptime - t >= 0.5
|
||||||
Input.update
|
Input.update
|
||||||
if Input.press?(Input::CTRL)
|
if Input.press?(Input::CTRL)
|
||||||
Input.clipboard = message
|
Input.clipboard = message
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ module Game
|
|||||||
pbMapInterpreter&.setup(nil, 0, 0)
|
pbMapInterpreter&.setup(nil, 0, 0)
|
||||||
$scene = Scene_Map.new
|
$scene = Scene_Map.new
|
||||||
SaveData.load_new_game_values
|
SaveData.load_new_game_values
|
||||||
|
$game_temp.last_uptime_refreshed_play_time = System.uptime
|
||||||
$stats.play_sessions += 1
|
$stats.play_sessions += 1
|
||||||
$map_factory = PokemonMapFactory.new($data_system.start_map_id)
|
$map_factory = PokemonMapFactory.new($data_system.start_map_id)
|
||||||
$game_player.moveto($data_system.start_x, $data_system.start_y)
|
$game_player.moveto($data_system.start_x, $data_system.start_y)
|
||||||
@@ -62,6 +63,7 @@ module Game
|
|||||||
def self.load(save_data)
|
def self.load(save_data)
|
||||||
validate save_data => Hash
|
validate save_data => Hash
|
||||||
SaveData.load_all_values(save_data)
|
SaveData.load_all_values(save_data)
|
||||||
|
$game_temp.last_uptime_refreshed_play_time = System.uptime
|
||||||
$stats.play_sessions += 1
|
$stats.play_sessions += 1
|
||||||
self.load_map
|
self.load_map
|
||||||
pbAutoplayOnSave
|
pbAutoplayOnSave
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ class Scene_Map
|
|||||||
dispose
|
dispose
|
||||||
if $game_temp.title_screen_calling
|
if $game_temp.title_screen_calling
|
||||||
pbMapInterpreter.command_end if pbMapInterpreterRunning?
|
pbMapInterpreter.command_end if pbMapInterpreterRunning?
|
||||||
|
$game_temp.last_uptime_refreshed_play_time = nil
|
||||||
$game_temp.title_screen_calling = false
|
$game_temp.title_screen_calling = false
|
||||||
pbBGMFade(1.0)
|
pbBGMFade(1.0)
|
||||||
Graphics.transition
|
Graphics.transition
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class GameStats
|
|||||||
attr_accessor :safari_pokemon_caught, :most_captures_per_safari_game
|
attr_accessor :safari_pokemon_caught, :most_captures_per_safari_game
|
||||||
attr_accessor :bug_contest_count, :bug_contest_wins
|
attr_accessor :bug_contest_count, :bug_contest_wins
|
||||||
# Play
|
# Play
|
||||||
attr_accessor :play_time # In seconds
|
attr_writer :play_time # In seconds; the reader also updates the value
|
||||||
attr_accessor :play_sessions
|
attr_accessor :play_sessions
|
||||||
attr_accessor :time_last_saved # In seconds
|
attr_accessor :time_last_saved # In seconds
|
||||||
|
|
||||||
@@ -161,38 +161,37 @@ class GameStats
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_time_to_badge(number)
|
def set_time_to_badge(number)
|
||||||
@times_to_get_badges[number] = @play_time
|
@times_to_get_badges[number] = play_time
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_time_to_hall_of_fame
|
def set_time_to_hall_of_fame
|
||||||
@time_to_enter_hall_of_fame = @play_time if @time_to_enter_hall_of_fame == 0
|
@time_to_enter_hall_of_fame = play_time if @time_to_enter_hall_of_fame == 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def play_time
|
||||||
|
if $game_temp&.last_uptime_refreshed_play_time
|
||||||
|
@play_time += System.uptime - $game_temp.last_uptime_refreshed_play_time
|
||||||
|
$game_temp.last_uptime_refreshed_play_time = System.uptime
|
||||||
|
end
|
||||||
|
return @play_time
|
||||||
end
|
end
|
||||||
|
|
||||||
def play_time_per_session
|
def play_time_per_session
|
||||||
return @play_time / @play_sessions
|
return play_time / @play_sessions
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_time_last_saved
|
def set_time_last_saved
|
||||||
@time_last_saved = @play_time
|
@time_last_saved = play_time
|
||||||
end
|
end
|
||||||
|
|
||||||
def time_since_last_save
|
def time_since_last_save
|
||||||
return @play_time - @time_last_saved
|
return play_time - @time_last_saved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
module Graphics
|
class Game_Temp
|
||||||
unless defined?(update_stats_play_time)
|
attr_accessor :last_uptime_refreshed_play_time
|
||||||
class << Graphics
|
|
||||||
alias update_stats_play_time update
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.update
|
|
||||||
update_stats_play_time
|
|
||||||
$stats.play_time += self.delta_s if $stats && $PokemonEncounters
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class TilemapRenderer
|
|||||||
@frame_counts = {} # Number of frames in each autotile
|
@frame_counts = {} # Number of frames in each autotile
|
||||||
@frame_durations = {} # How long each frame lasts per autotile
|
@frame_durations = {} # How long each frame lasts per autotile
|
||||||
@current_frames = {} # Which frame each autotile is currently showing
|
@current_frames = {} # Which frame each autotile is currently showing
|
||||||
@timer = 0.0
|
@timer_start = System.uptime
|
||||||
end
|
end
|
||||||
|
|
||||||
def []=(filename, value)
|
def []=(filename, value)
|
||||||
@@ -193,7 +193,7 @@ class TilemapRenderer
|
|||||||
if frames < 2
|
if frames < 2
|
||||||
@current_frames[filename] = 0
|
@current_frames[filename] = 0
|
||||||
else
|
else
|
||||||
@current_frames[filename] = (@timer / @frame_durations[filename]).floor % frames
|
@current_frames[filename] = ((System.uptime - @timer_start) / @frame_durations[filename]).floor % frames
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -219,7 +219,6 @@ class TilemapRenderer
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
super
|
super
|
||||||
@timer += Graphics.delta_s
|
|
||||||
# Update the current frame for each autotile
|
# Update the current frame for each autotile
|
||||||
@bitmaps.each_key do |filename|
|
@bitmaps.each_key do |filename|
|
||||||
next if !@bitmaps[filename] || @bitmaps[filename].disposed?
|
next if !@bitmaps[filename] || @bitmaps[filename].disposed?
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ module Transitions
|
|||||||
end
|
end
|
||||||
@duration = self.class::DURATION || duration
|
@duration = self.class::DURATION || duration
|
||||||
@parameters = args
|
@parameters = args
|
||||||
@timer = 0.0
|
@timer_start = System.uptime
|
||||||
@overworld_bitmap = $game_temp.background_bitmap
|
@overworld_bitmap = $game_temp.background_bitmap
|
||||||
initialize_bitmaps
|
initialize_bitmaps
|
||||||
return if disposed?
|
return if disposed?
|
||||||
@@ -138,6 +138,10 @@ module Transitions
|
|||||||
return s
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def timer
|
||||||
|
return System.uptime - @timer_start
|
||||||
|
end
|
||||||
|
|
||||||
def dispose
|
def dispose
|
||||||
return if disposed?
|
return if disposed?
|
||||||
dispose_all
|
dispose_all
|
||||||
@@ -153,8 +157,7 @@ module Transitions
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
return if disposed?
|
return if disposed?
|
||||||
@timer += Graphics.delta_s
|
if timer >= @duration
|
||||||
if @timer >= @duration
|
|
||||||
dispose
|
dispose
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -201,7 +204,7 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
proportion = @timer / @duration
|
proportion = timer / @duration
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
sprite.y = @start_y[i] + (Graphics.height * @timings[i] * proportion * proportion)
|
sprite.y = @start_y[i] + (Graphics.height * @timings[i] * proportion * proportion)
|
||||||
sprite.opacity = 255 * (1 - proportion)
|
sprite.opacity = 255 * (1 - proportion)
|
||||||
@@ -232,7 +235,7 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
proportion = @timer / @duration
|
proportion = timer / @duration
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
sprite.zoom_x = (1 - proportion).to_f
|
sprite.zoom_x = (1 - proportion).to_f
|
||||||
sprite.zoom_y = sprite.zoom_x
|
sprite.zoom_y = sprite.zoom_x
|
||||||
@@ -298,7 +301,7 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
proportion = @timer / @duration
|
proportion = timer / @duration
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
sprite.x = @start_positions[i][0] + (@move_vectors[i][0] * proportion)
|
sprite.x = @start_positions[i][0] + (@move_vectors[i][0] * proportion)
|
||||||
sprite.y = @start_positions[i][1] + (@move_vectors[i][1] * proportion)
|
sprite.y = @start_positions[i][1] + (@move_vectors[i][1] * proportion)
|
||||||
@@ -353,7 +356,7 @@ module Transitions
|
|||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
next if @timings[i] < 0 || @timer < @timings[i]
|
next if @timings[i] < 0 || timer < @timings[i]
|
||||||
sprite.visible = false
|
sprite.visible = false
|
||||||
@timings[i] = -1
|
@timings[i] = -1
|
||||||
end
|
end
|
||||||
@@ -372,7 +375,7 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
proportion = @timer / @duration
|
proportion = timer / @duration
|
||||||
@overworld_sprite.zoom_x = 1 + (7 * proportion)
|
@overworld_sprite.zoom_x = 1 + (7 * proportion)
|
||||||
@overworld_sprite.zoom_y = @overworld_sprite.zoom_x
|
@overworld_sprite.zoom_y = @overworld_sprite.zoom_x
|
||||||
@overworld_sprite.opacity = 255 * (1 - proportion)
|
@overworld_sprite.opacity = 255 * (1 - proportion)
|
||||||
@@ -384,7 +387,7 @@ module Transitions
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
class ScrollScreen < Transition_Base
|
class ScrollScreen < Transition_Base
|
||||||
def update_anim
|
def update_anim
|
||||||
proportion = @timer / @duration
|
proportion = timer / @duration
|
||||||
if (@parameters[0] % 3) != 2
|
if (@parameters[0] % 3) != 2
|
||||||
@overworld_sprite.x = [1, -1, 0][@parameters[0] % 3] * Graphics.width * proportion
|
@overworld_sprite.x = [1, -1, 0][@parameters[0] % 3] * Graphics.width * proportion
|
||||||
end
|
end
|
||||||
@@ -415,7 +418,7 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
proportion = @timer / @duration
|
proportion = timer / @duration
|
||||||
inv_proportion = 1 / (1 + (proportion * (MAX_PIXELLATION_FACTOR - 1)))
|
inv_proportion = 1 / (1 + (proportion * (MAX_PIXELLATION_FACTOR - 1)))
|
||||||
new_size_rect = Rect.new(0, 0, @overworld_bitmap.width * inv_proportion,
|
new_size_rect = Rect.new(0, 0, @overworld_bitmap.width * inv_proportion,
|
||||||
@overworld_bitmap.height * inv_proportion)
|
@overworld_bitmap.height * inv_proportion)
|
||||||
@@ -425,8 +428,8 @@ module Transitions
|
|||||||
# Take shrunken area from buffer_temp and stretch it into buffer
|
# Take shrunken area from buffer_temp and stretch it into buffer
|
||||||
@overworld_bitmap.stretch_blt(Rect.new(0, 0, @overworld_bitmap.width, @overworld_bitmap.height),
|
@overworld_bitmap.stretch_blt(Rect.new(0, 0, @overworld_bitmap.width, @overworld_bitmap.height),
|
||||||
@buffer_temp, new_size_rect)
|
@buffer_temp, new_size_rect)
|
||||||
if @timer >= @start_black_fade
|
if timer >= @start_black_fade
|
||||||
@overworld_sprite.opacity = 255 * (1 - ((@timer - @start_black_fade) / (@duration - @start_black_fade)))
|
@overworld_sprite.opacity = 255 * (1 - ((timer - @start_black_fade) / (@duration - @start_black_fade)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -436,7 +439,7 @@ module Transitions
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
class FadeToBlack < Transition_Base
|
class FadeToBlack < Transition_Base
|
||||||
def update_anim
|
def update_anim
|
||||||
@overworld_sprite.opacity = 255 * (1 - (@timer / @duration))
|
@overworld_sprite.opacity = 255 * (1 - (timer / @duration))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -445,7 +448,7 @@ module Transitions
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
class FadeFromBlack < Transition_Base
|
class FadeFromBlack < Transition_Base
|
||||||
def update_anim
|
def update_anim
|
||||||
@overworld_sprite.opacity = 255 * @timer / @duration
|
@overworld_sprite.opacity = 255 * timer / @duration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -504,9 +507,9 @@ module Transitions
|
|||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
next if @timings[i] < 0 || @timer < @timings[i]
|
next if @timings[i] < 0 || timer < @timings[i]
|
||||||
sprite.visible = true
|
sprite.visible = true
|
||||||
sprite.zoom_x = @zoom_x_target * (@timer - @timings[i]) / TIME_TO_ZOOM
|
sprite.zoom_x = @zoom_x_target * (timer - @timings[i]) / TIME_TO_ZOOM
|
||||||
if sprite.zoom_x >= @zoom_x_target
|
if sprite.zoom_x >= @zoom_x_target
|
||||||
sprite.zoom_x = @zoom_x_target
|
sprite.zoom_x = @zoom_x_target
|
||||||
@timings[i] = -1
|
@timings[i] = -1
|
||||||
@@ -573,9 +576,9 @@ module Transitions
|
|||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
next if @timings[i] < 0 || @timer < @timings[i]
|
next if @timings[i] < 0 || timer < @timings[i]
|
||||||
sprite.visible = true
|
sprite.visible = true
|
||||||
size = (@timer - @timings[i]) / TIME_TO_ZOOM
|
size = (timer - @timings[i]) / TIME_TO_ZOOM
|
||||||
sprite.zoom_x = @zoom_x_target * size
|
sprite.zoom_x = @zoom_x_target * size
|
||||||
sprite.zoom_y = @zoom_y_target * size
|
sprite.zoom_y = @zoom_y_target * size
|
||||||
next if size < 1.0
|
next if size < 1.0
|
||||||
@@ -644,22 +647,22 @@ module Transitions
|
|||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
# Make overworld wave strips oscillate
|
# Make overworld wave strips oscillate
|
||||||
amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds
|
amplitude = MAX_WAVE_AMPLITUDE * [timer / 0.1, 1].min # Build up to max in 0.1 seconds
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
sprite.x = amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING))
|
sprite.x = amplitude * Math.sin((timer * WAVE_SPEED) + (i * WAVE_SPACING))
|
||||||
end
|
end
|
||||||
# Move bubbles sprite up and oscillate side to side
|
# Move bubbles sprite up and oscillate side to side
|
||||||
@bubbles_sprite.x = (Graphics.width - @bubble_bitmap.width) / 2
|
@bubbles_sprite.x = (Graphics.width - @bubble_bitmap.width) / 2
|
||||||
@bubbles_sprite.x += MAX_BUBBLE_AMPLITUDE * Math.sin(@timer * BUBBLES_WAVE_SPEED)
|
@bubbles_sprite.x += MAX_BUBBLE_AMPLITUDE * Math.sin(timer * BUBBLES_WAVE_SPEED)
|
||||||
@bubbles_sprite.y = Graphics.height * (1 - (@timer * 1.2))
|
@bubbles_sprite.y = Graphics.height * (1 - (timer * 1.2))
|
||||||
# Move splash sprite up
|
# Move splash sprite up
|
||||||
if @timer >= @splash_rising_start
|
if timer >= @splash_rising_start
|
||||||
proportion = (@timer - @splash_rising_start) / (@duration - @splash_rising_start)
|
proportion = (timer - @splash_rising_start) / (@duration - @splash_rising_start)
|
||||||
@splash_sprite.y = Graphics.height * (1 - (proportion * 2))
|
@splash_sprite.y = Graphics.height * (1 - (proportion * 2))
|
||||||
end
|
end
|
||||||
# Move black sprite up
|
# Move black sprite up
|
||||||
if @timer >= @black_rising_start
|
if timer >= @black_rising_start
|
||||||
proportion = (@timer - @black_rising_start) / (@duration - @black_rising_start)
|
proportion = (timer - @black_rising_start) / (@duration - @black_rising_start)
|
||||||
@black_sprite.y = Graphics.height * (1 - proportion)
|
@black_sprite.y = Graphics.height * (1 - proportion)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -718,16 +721,16 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
if @timer <= @ball_roll_end
|
if timer <= @ball_roll_end
|
||||||
# Roll ball sprites across screen
|
# Roll ball sprites across screen
|
||||||
proportion = @timer / @ball_roll_end
|
proportion = timer / @ball_roll_end
|
||||||
total_distance = Graphics.width + @ball_bitmap.width
|
total_distance = Graphics.width + @ball_bitmap.width
|
||||||
@ball_sprites.each_with_index do |sprite, i|
|
@ball_sprites.each_with_index do |sprite, i|
|
||||||
sprite.x = @ball_start_x[i] + (((2 * i) - 1) * (total_distance * proportion))
|
sprite.x = @ball_start_x[i] + (((2 * i) - 1) * (total_distance * proportion))
|
||||||
sprite.angle = ((2 * i) - 1) * 360 * proportion * 2
|
sprite.angle = ((2 * i) - 1) * 360 * proportion * 2
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
proportion = (@timer - @ball_roll_end) / (@duration - @ball_roll_end)
|
proportion = (timer - @ball_roll_end) / (@duration - @ball_roll_end)
|
||||||
# Hide ball sprites
|
# Hide ball sprites
|
||||||
if @ball_sprites[0].visible
|
if @ball_sprites[0].visible
|
||||||
@ball_sprites.each { |s| s.visible = false }
|
@ball_sprites.each { |s| s.visible = false }
|
||||||
@@ -804,13 +807,13 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
if @timer < @ball_spin_end
|
if timer < @ball_spin_end
|
||||||
# Ball spin
|
# Ball spin
|
||||||
proportion = @timer / @ball_spin_end
|
proportion = timer / @ball_spin_end
|
||||||
@ball_sprites[0].zoom_x = proportion
|
@ball_sprites[0].zoom_x = proportion
|
||||||
@ball_sprites[0].zoom_y = proportion
|
@ball_sprites[0].zoom_y = proportion
|
||||||
@ball_sprites[0].angle = 360 * (1 - proportion)
|
@ball_sprites[0].angle = 360 * (1 - proportion)
|
||||||
elsif @timer < @slide_start
|
elsif timer < @slide_start
|
||||||
# Fix zoom/angle of ball sprites
|
# Fix zoom/angle of ball sprites
|
||||||
if @ball_sprites[0].src_rect.height == @ball_bitmap.height
|
if @ball_sprites[0].src_rect.height == @ball_bitmap.height
|
||||||
@ball_sprites.each_with_index do |sprite, i|
|
@ball_sprites.each_with_index do |sprite, i|
|
||||||
@@ -823,7 +826,7 @@ module Transitions
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Split overworld/ball apart, move blackness in following them
|
# Split overworld/ball apart, move blackness in following them
|
||||||
proportion = (@timer - @slide_start) / (@duration - @slide_start)
|
proportion = (timer - @slide_start) / (@duration - @slide_start)
|
||||||
@overworld_sprites.each_with_index do |sprite, i|
|
@overworld_sprites.each_with_index do |sprite, i|
|
||||||
sprite.x = (0.5 + (((i * 2) - 1) * proportion * proportion)) * Graphics.width
|
sprite.x = (0.5 + (((i * 2) - 1) * proportion * proportion)) * Graphics.width
|
||||||
sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom
|
sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom
|
||||||
@@ -906,9 +909,9 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
if @timer < @black_appear_start
|
if timer < @black_appear_start
|
||||||
# Balls drop down screen while spinning
|
# Balls drop down screen while spinning
|
||||||
proportion = @timer / @black_appear_start
|
proportion = timer / @black_appear_start
|
||||||
@ball_sprites.each_with_index do |sprite, i|
|
@ball_sprites.each_with_index do |sprite, i|
|
||||||
sprite.y = -@ball_bitmap.height - BALL_START_Y_OFFSETS[i]
|
sprite.y = -@ball_bitmap.height - BALL_START_Y_OFFSETS[i]
|
||||||
sprite.y += (Graphics.height + BALL_START_Y_OFFSETS.max + (@ball_bitmap.height * 2)) * proportion
|
sprite.y += (Graphics.height + BALL_START_Y_OFFSETS.max + (@ball_bitmap.height * 2)) * proportion
|
||||||
@@ -920,12 +923,12 @@ module Transitions
|
|||||||
end
|
end
|
||||||
# Black squares appear
|
# Black squares appear
|
||||||
@timings.each_with_index do |timing, i|
|
@timings.each_with_index do |timing, i|
|
||||||
next if timing < 0 || @timer < timing
|
next if timing < 0 || timer < timing
|
||||||
@sprites[i].visible = true
|
@sprites[i].visible = true
|
||||||
@timings[i] = -1
|
@timings[i] = -1
|
||||||
end
|
end
|
||||||
# Zoom in overworld sprite
|
# Zoom in overworld sprite
|
||||||
proportion = (@timer - @black_appear_start) / (@duration - @black_appear_start)
|
proportion = (timer - @black_appear_start) / (@duration - @black_appear_start)
|
||||||
@overworld_sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom
|
@overworld_sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom
|
||||||
@overworld_sprite.zoom_y = @overworld_sprite.zoom_x
|
@overworld_sprite.zoom_y = @overworld_sprite.zoom_x
|
||||||
end
|
end
|
||||||
@@ -979,9 +982,9 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
if @timer <= @ball_appear_end
|
if timer <= @ball_appear_end
|
||||||
# Make ball drop down and zoom in
|
# Make ball drop down and zoom in
|
||||||
proportion = @timer / @ball_appear_end
|
proportion = timer / @ball_appear_end
|
||||||
@ball_sprite.y = (-@ball_bitmap.height / 2) + ((Graphics.height + (@ball_bitmap.height * 3)) * proportion * proportion)
|
@ball_sprite.y = (-@ball_bitmap.height / 2) + ((Graphics.height + (@ball_bitmap.height * 3)) * proportion * proportion)
|
||||||
@ball_sprite.angle = -1.5 * 360 * proportion
|
@ball_sprite.angle = -1.5 * 360 * proportion
|
||||||
@ball_sprite.zoom_x = 3 * proportion * proportion
|
@ball_sprite.zoom_x = 3 * proportion * proportion
|
||||||
@@ -989,7 +992,7 @@ module Transitions
|
|||||||
else
|
else
|
||||||
@ball_sprite.visible = false
|
@ball_sprite.visible = false
|
||||||
# Black curve and blackness descends
|
# Black curve and blackness descends
|
||||||
proportion = (@timer - @ball_appear_end) / (@duration - @ball_appear_end)
|
proportion = (timer - @ball_appear_end) / (@duration - @ball_appear_end)
|
||||||
@sprites.each do |sprite|
|
@sprites.each do |sprite|
|
||||||
sprite.y = -@curve_bitmap.height + ((Graphics.height + @curve_bitmap.height) * proportion)
|
sprite.y = -@curve_bitmap.height + ((Graphics.height + @curve_bitmap.height) * proportion)
|
||||||
end
|
end
|
||||||
@@ -1065,13 +1068,13 @@ module Transitions
|
|||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
# Make overworld wave strips oscillate
|
# Make overworld wave strips oscillate
|
||||||
amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds
|
amplitude = MAX_WAVE_AMPLITUDE * [timer / 0.1, 1].min # Build up to max in 0.1 seconds
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
sprite.x = (1 - ((i % 2) * 2)) * amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING))
|
sprite.x = (1 - ((i % 2) * 2)) * amplitude * Math.sin((timer * WAVE_SPEED) + (i * WAVE_SPACING))
|
||||||
end
|
end
|
||||||
# Move balls and trailing blackness up
|
# Move balls and trailing blackness up
|
||||||
if @timer >= @ball_rising_start
|
if timer >= @ball_rising_start
|
||||||
proportion = (@timer - @ball_rising_start) / (@duration - @ball_rising_start)
|
proportion = (timer - @ball_rising_start) / (@duration - @ball_rising_start)
|
||||||
@ball_sprites.each_with_index do |sprite, i|
|
@ball_sprites.each_with_index do |sprite, i|
|
||||||
sprite.y = (BALL_OFFSETS[i] * Graphics.height) - (Graphics.height * 3.5 * proportion)
|
sprite.y = (BALL_OFFSETS[i] * Graphics.height) - (Graphics.height * 3.5 * proportion)
|
||||||
sprite.angle = [-1, -1, 1][i] * 360 * 2 * proportion
|
sprite.angle = [-1, -1, 1][i] * 360 * 2 * proportion
|
||||||
@@ -1136,22 +1139,22 @@ module Transitions
|
|||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
# Make overworld wave strips oscillate
|
# Make overworld wave strips oscillate
|
||||||
amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds
|
amplitude = MAX_WAVE_AMPLITUDE * [timer / 0.1, 1].min # Build up to max in 0.1 seconds
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
sprite.x = (1 - ((i % 2) * 2)) * amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING))
|
sprite.x = (1 - ((i % 2) * 2)) * amplitude * Math.sin((timer * WAVE_SPEED) + (i * WAVE_SPACING))
|
||||||
end
|
end
|
||||||
if @timer <= @ball_appear_end
|
if timer <= @ball_appear_end
|
||||||
# Fade in ball while spinning
|
# Fade in ball while spinning
|
||||||
proportion = @timer / @ball_appear_end
|
proportion = timer / @ball_appear_end
|
||||||
@ball_sprite.opacity = 255 * proportion
|
@ball_sprite.opacity = 255 * proportion
|
||||||
@ball_sprite.angle = -360 * proportion
|
@ball_sprite.angle = -360 * proportion
|
||||||
elsif @timer <= @black_appear_start
|
elsif timer <= @black_appear_start
|
||||||
# Fix opacity/angle of ball sprite
|
# Fix opacity/angle of ball sprite
|
||||||
@ball_sprite.opacity = 255
|
@ball_sprite.opacity = 255
|
||||||
@ball_sprite.angle = 0
|
@ball_sprite.angle = 0
|
||||||
else
|
else
|
||||||
# Spread blackness from centre
|
# Spread blackness from centre
|
||||||
proportion = (@timer - @black_appear_start) / (@duration - @black_appear_start)
|
proportion = (timer - @black_appear_start) / (@duration - @black_appear_start)
|
||||||
@black_sprite.zoom_x = proportion
|
@black_sprite.zoom_x = proportion
|
||||||
@black_sprite.zoom_y = proportion * 2
|
@black_sprite.zoom_y = proportion * 2
|
||||||
end
|
end
|
||||||
@@ -1210,9 +1213,9 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
if @timer <= @ball_appear_end
|
if timer <= @ball_appear_end
|
||||||
# Balls fly out from centre of screen
|
# Balls fly out from centre of screen
|
||||||
proportion = @timer / @ball_appear_end
|
proportion = timer / @ball_appear_end
|
||||||
ball_travel_x = (Graphics.width + (@ball_bitmap.width * 2)) / 2
|
ball_travel_x = (Graphics.width + (@ball_bitmap.width * 2)) / 2
|
||||||
ball_travel_y = (Graphics.height + (@ball_bitmap.height * 2)) / 2
|
ball_travel_y = (Graphics.height + (@ball_bitmap.height * 2)) / 2
|
||||||
@ball_sprites.each_with_index do |sprite, i|
|
@ball_sprites.each_with_index do |sprite, i|
|
||||||
@@ -1221,7 +1224,7 @@ module Transitions
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Black wedges expand to fill screen
|
# Black wedges expand to fill screen
|
||||||
proportion = (@timer - @ball_appear_end) / (@duration - @ball_appear_end)
|
proportion = (timer - @ball_appear_end) / (@duration - @ball_appear_end)
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
sprite.visible = true
|
sprite.visible = true
|
||||||
sprite.zoom_x = proportion if i.even?
|
sprite.zoom_x = proportion if i.even?
|
||||||
@@ -1349,27 +1352,29 @@ module Transitions
|
|||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
# Bar scrolling
|
# Bar scrolling
|
||||||
@bar_x -= Graphics.delta_s * BAR_SCROLL_SPEED
|
@bar_x = -timer * BAR_SCROLL_SPEED
|
||||||
@bar_x += @bar_bitmap.width if @bar_x <= -@bar_bitmap.width
|
while @bar_x <= -@bar_bitmap.width
|
||||||
|
@bar_x += @bar_bitmap.width
|
||||||
|
end
|
||||||
@sprites.each_with_index { |spr, i| spr.x = @bar_x + (i * @bar_bitmap.width) }
|
@sprites.each_with_index { |spr, i| spr.x = @bar_x + (i * @bar_bitmap.width) }
|
||||||
# Vibrate VS sprite
|
# Vibrate VS sprite
|
||||||
vs_phase = (@timer * 30).to_i % 3
|
vs_phase = (timer * 30).to_i % 3
|
||||||
@vs_main_sprite.x = @vs_x + [0, 4, 0][vs_phase]
|
@vs_main_sprite.x = @vs_x + [0, 4, 0][vs_phase]
|
||||||
@vs_main_sprite.y = @vs_y + [0, 0, -4][vs_phase]
|
@vs_main_sprite.y = @vs_y + [0, 0, -4][vs_phase]
|
||||||
if @timer >= @fade_to_black_start
|
if timer >= @fade_to_black_start
|
||||||
# Fade to black
|
# Fade to black
|
||||||
@black_sprite.visible = true
|
@black_sprite.visible = true
|
||||||
proportion = (@timer - @fade_to_black_start) / (@duration - @fade_to_black_start)
|
proportion = (timer - @fade_to_black_start) / (@duration - @fade_to_black_start)
|
||||||
@flash_viewport.color.alpha = 255 * (1 - proportion)
|
@flash_viewport.color.alpha = 255 * (1 - proportion)
|
||||||
elsif @timer >= @fade_to_white_start
|
elsif timer >= @fade_to_white_start
|
||||||
# Slowly fade to white
|
# Slowly fade to white
|
||||||
proportion = (@timer - @fade_to_white_start) / (@fade_to_white_end - @fade_to_white_start)
|
proportion = (timer - @fade_to_white_start) / (@fade_to_white_end - @fade_to_white_start)
|
||||||
@flash_viewport.color.alpha = 255 * proportion
|
@flash_viewport.color.alpha = 255 * proportion
|
||||||
elsif @timer >= @flash_start + @flash_duration
|
elsif timer >= @flash_start + @flash_duration
|
||||||
@flash_viewport.color.alpha = 0
|
@flash_viewport.color.alpha = 0
|
||||||
elsif @timer >= @flash_start
|
elsif timer >= @flash_start
|
||||||
# Flash the screen white
|
# Flash the screen white
|
||||||
proportion = (@timer - @flash_start) / @flash_duration
|
proportion = (timer - @flash_start) / @flash_duration
|
||||||
if proportion >= 0.5
|
if proportion >= 0.5
|
||||||
@flash_viewport.color.alpha = 320 * 2 * (1 - proportion)
|
@flash_viewport.color.alpha = 320 * 2 * (1 - proportion)
|
||||||
@rear_black_sprite.visible = true
|
@rear_black_sprite.visible = true
|
||||||
@@ -1378,41 +1383,41 @@ module Transitions
|
|||||||
else
|
else
|
||||||
@flash_viewport.color.alpha = 320 * 2 * proportion
|
@flash_viewport.color.alpha = 320 * 2 * proportion
|
||||||
end
|
end
|
||||||
elsif @timer >= @foe_appear_end
|
elsif timer >= @foe_appear_end
|
||||||
@foe_sprite.x = FOE_SPRITE_X
|
@foe_sprite.x = FOE_SPRITE_X
|
||||||
elsif @timer >= @foe_appear_start
|
elsif timer >= @foe_appear_start
|
||||||
# Foe sprite appears
|
# Foe sprite appears
|
||||||
proportion = (@timer - @foe_appear_start) / (@foe_appear_end - @foe_appear_start)
|
proportion = (timer - @foe_appear_start) / (@foe_appear_end - @foe_appear_start)
|
||||||
start_x = Graphics.width + (@foe_bitmap.width / 2)
|
start_x = Graphics.width + (@foe_bitmap.width / 2)
|
||||||
@foe_sprite.x = start_x + ((FOE_SPRITE_X_LIMIT - start_x) * proportion)
|
@foe_sprite.x = start_x + ((FOE_SPRITE_X_LIMIT - start_x) * proportion)
|
||||||
elsif @timer >= @vs_appear_final
|
elsif timer >= @vs_appear_final
|
||||||
@vs_1_sprite.visible = false
|
@vs_1_sprite.visible = false
|
||||||
elsif @timer >= @vs_appear_start_2
|
elsif timer >= @vs_appear_start_2
|
||||||
# Temp VS sprites enlarge and shrink again
|
# Temp VS sprites enlarge and shrink again
|
||||||
if @vs_2_sprite.visible
|
if @vs_2_sprite.visible
|
||||||
@vs_2_sprite.zoom_x = 1.6 - (0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time)
|
@vs_2_sprite.zoom_x = 1.6 - (0.8 * (timer - @vs_appear_start_2) / @vs_shrink_time)
|
||||||
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
|
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
|
||||||
if @vs_2_sprite.zoom_x <= 1.2
|
if @vs_2_sprite.zoom_x <= 1.2
|
||||||
@vs_2_sprite.visible = false
|
@vs_2_sprite.visible = false
|
||||||
@vs_main_sprite.visible = true
|
@vs_main_sprite.visible = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time)
|
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (timer - @vs_appear_start_2) / @vs_shrink_time)
|
||||||
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
|
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
|
||||||
elsif @timer >= @vs_appear_start
|
elsif timer >= @vs_appear_start
|
||||||
# Temp VS sprites appear and start shrinking
|
# Temp VS sprites appear and start shrinking
|
||||||
@vs_2_sprite.visible = true
|
@vs_2_sprite.visible = true
|
||||||
@vs_2_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start) / @vs_shrink_time)
|
@vs_2_sprite.zoom_x = 2.0 - (0.8 * (timer - @vs_appear_start) / @vs_shrink_time)
|
||||||
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
|
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
|
||||||
if @vs_1_sprite.visible || @vs_2_sprite.zoom_x <= 1.6 # Halfway between 2.0 and 1.2
|
if @vs_1_sprite.visible || @vs_2_sprite.zoom_x <= 1.6 # Halfway between 2.0 and 1.2
|
||||||
@vs_1_sprite.visible = true
|
@vs_1_sprite.visible = true
|
||||||
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start - (@vs_shrink_time / 2)) / @vs_shrink_time)
|
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (timer - @vs_appear_start - (@vs_shrink_time / 2)) / @vs_shrink_time)
|
||||||
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
|
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
|
||||||
end
|
end
|
||||||
elsif @timer >= @bar_appear_end
|
elsif timer >= @bar_appear_end
|
||||||
@bar_mask_sprite.visible = false
|
@bar_mask_sprite.visible = false
|
||||||
else
|
else
|
||||||
start_x = Graphics.width * (1 - (@timer / @bar_appear_end))
|
start_x = Graphics.width * (1 - (timer / @bar_appear_end))
|
||||||
color = Color.new(0, 0, 0, 0) # Transparent
|
color = Color.new(0, 0, 0, 0) # Transparent
|
||||||
(@sprites[0].height / 2).times do |i|
|
(@sprites[0].height / 2).times do |i|
|
||||||
x = start_x - (BAR_MASK[i % BAR_MASK.length] * 4)
|
x = start_x - (BAR_MASK[i % BAR_MASK.length] * 4)
|
||||||
@@ -1564,15 +1569,15 @@ module Transitions
|
|||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
# Bars/trainer sprites slide in
|
# Bars/trainer sprites slide in
|
||||||
if @timer > @bar_appear_end
|
if timer > @bar_appear_end
|
||||||
@player_bar_sprite.x = @player_bar_x
|
@player_bar_sprite.x = @player_bar_x
|
||||||
@player_sprite.x = @player_bar_sprite.x + TRAINER_X_OFFSET
|
@player_sprite.x = @player_bar_sprite.x + TRAINER_X_OFFSET
|
||||||
@foe_bar_sprite.x = @foe_bar_x
|
@foe_bar_sprite.x = @foe_bar_x
|
||||||
@foe_sprite.x = @foe_bar_sprite.x + (@bar_bitmap.width / 2) - TRAINER_X_OFFSET
|
@foe_sprite.x = @foe_bar_sprite.x + (@bar_bitmap.width / 2) - TRAINER_X_OFFSET
|
||||||
@text_sprite.x = @foe_bar_sprite.x
|
@text_sprite.x = @foe_bar_sprite.x
|
||||||
elsif @timer > @bar_appear_start
|
elsif timer > @bar_appear_start
|
||||||
# Bars/trainer sprites slide in
|
# Bars/trainer sprites slide in
|
||||||
proportion = (@timer - @bar_appear_start) / (@bar_appear_end - @bar_appear_start)
|
proportion = (timer - @bar_appear_start) / (@bar_appear_end - @bar_appear_start)
|
||||||
sqrt_proportion = Math.sqrt(proportion)
|
sqrt_proportion = Math.sqrt(proportion)
|
||||||
@player_bar_sprite.x = @player_bar_start_x + ((@player_bar_x + BAR_OVERSHOOT - @player_bar_start_x) * sqrt_proportion)
|
@player_bar_sprite.x = @player_bar_start_x + ((@player_bar_x + BAR_OVERSHOOT - @player_bar_start_x) * sqrt_proportion)
|
||||||
@player_sprite.x = @player_bar_sprite.x + TRAINER_X_OFFSET
|
@player_sprite.x = @player_bar_sprite.x + TRAINER_X_OFFSET
|
||||||
@@ -1581,47 +1586,47 @@ module Transitions
|
|||||||
@text_sprite.x = @foe_bar_sprite.x
|
@text_sprite.x = @foe_bar_sprite.x
|
||||||
end
|
end
|
||||||
# Animate bars
|
# Animate bars
|
||||||
if @timer >= @flash_start + (0.33 * @flash_duration)
|
if timer >= @flash_start + (0.33 * @flash_duration)
|
||||||
bar_phase = (@timer * 30).to_i % @num_bar_frames
|
bar_phase = (timer * 30).to_i % @num_bar_frames
|
||||||
@player_bar_sprite.src_rect.y = bar_phase * BAR_HEIGHT
|
@player_bar_sprite.src_rect.y = bar_phase * BAR_HEIGHT
|
||||||
@foe_bar_sprite.src_rect.y = bar_phase * BAR_HEIGHT
|
@foe_bar_sprite.src_rect.y = bar_phase * BAR_HEIGHT
|
||||||
end
|
end
|
||||||
# Vibrate VS sprite
|
# Vibrate VS sprite
|
||||||
vs_phase = (@timer * 30).to_i % 3
|
vs_phase = (timer * 30).to_i % 3
|
||||||
@vs_main_sprite.x = (Graphics.width / 2) + [0, 4, 0][vs_phase]
|
@vs_main_sprite.x = (Graphics.width / 2) + [0, 4, 0][vs_phase]
|
||||||
@vs_main_sprite.y = (Graphics.height / 2) + [0, 0, -4][vs_phase]
|
@vs_main_sprite.y = (Graphics.height / 2) + [0, 0, -4][vs_phase]
|
||||||
# VS sprites appearing
|
# VS sprites appearing
|
||||||
if @timer >= @vs_appear_final
|
if timer >= @vs_appear_final
|
||||||
@vs_1_sprite.visible = false
|
@vs_1_sprite.visible = false
|
||||||
elsif @timer >= @vs_appear_start_2
|
elsif timer >= @vs_appear_start_2
|
||||||
# Temp VS sprites enlarge and shrink again
|
# Temp VS sprites enlarge and shrink again
|
||||||
if @vs_2_sprite.visible
|
if @vs_2_sprite.visible
|
||||||
@vs_2_sprite.zoom_x = 1.6 - (0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time)
|
@vs_2_sprite.zoom_x = 1.6 - (0.8 * (timer - @vs_appear_start_2) / @vs_shrink_time)
|
||||||
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
|
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
|
||||||
if @vs_2_sprite.zoom_x <= 1.2
|
if @vs_2_sprite.zoom_x <= 1.2
|
||||||
@vs_2_sprite.visible = false
|
@vs_2_sprite.visible = false
|
||||||
@vs_main_sprite.visible = true
|
@vs_main_sprite.visible = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time)
|
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (timer - @vs_appear_start_2) / @vs_shrink_time)
|
||||||
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
|
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
|
||||||
elsif @timer >= @vs_appear_start
|
elsif timer >= @vs_appear_start
|
||||||
# Temp VS sprites appear and start shrinking
|
# Temp VS sprites appear and start shrinking
|
||||||
@vs_2_sprite.visible = true
|
@vs_2_sprite.visible = true
|
||||||
@vs_2_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start) / @vs_shrink_time)
|
@vs_2_sprite.zoom_x = 2.0 - (0.8 * (timer - @vs_appear_start) / @vs_shrink_time)
|
||||||
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
|
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
|
||||||
if @vs_1_sprite.visible || @vs_2_sprite.zoom_x <= 1.6 # Halfway between 2.0 and 1.2
|
if @vs_1_sprite.visible || @vs_2_sprite.zoom_x <= 1.6 # Halfway between 2.0 and 1.2
|
||||||
@vs_1_sprite.visible = true
|
@vs_1_sprite.visible = true
|
||||||
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start - (@vs_shrink_time / 2)) / @vs_shrink_time)
|
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (timer - @vs_appear_start - (@vs_shrink_time / 2)) / @vs_shrink_time)
|
||||||
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
|
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Flash white (two flashes)
|
# Flash white (two flashes)
|
||||||
if @timer >= @flash_start + @flash_duration
|
if timer >= @flash_start + @flash_duration
|
||||||
@flash_viewport.color.alpha = 0
|
@flash_viewport.color.alpha = 0
|
||||||
elsif @timer >= @flash_start
|
elsif timer >= @flash_start
|
||||||
# Flash the screen white (coming from white lasts twice as long as going to white)
|
# Flash the screen white (coming from white lasts twice as long as going to white)
|
||||||
proportion = (@timer - @flash_start) / @flash_duration
|
proportion = (timer - @flash_start) / @flash_duration
|
||||||
if proportion >= 0.33 # Coming from white
|
if proportion >= 0.33 # Coming from white
|
||||||
@flash_viewport.color.alpha = 320 * 3 * (1 - proportion) / 2
|
@flash_viewport.color.alpha = 320 * 3 * (1 - proportion) / 2
|
||||||
@player_sprite.color.alpha = 0
|
@player_sprite.color.alpha = 0
|
||||||
@@ -1629,11 +1634,11 @@ module Transitions
|
|||||||
else # Going to white
|
else # Going to white
|
||||||
@flash_viewport.color.alpha = 320 * 3 * proportion
|
@flash_viewport.color.alpha = 320 * 3 * proportion
|
||||||
end
|
end
|
||||||
elsif @timer >= @flash_1_start + @flash_1_duration
|
elsif timer >= @flash_1_start + @flash_1_duration
|
||||||
@flash_viewport.color.alpha = 0
|
@flash_viewport.color.alpha = 0
|
||||||
elsif @timer >= @flash_1_start
|
elsif timer >= @flash_1_start
|
||||||
# Flash the screen white
|
# Flash the screen white
|
||||||
proportion = (@timer - @flash_1_start) / @flash_1_duration
|
proportion = (timer - @flash_1_start) / @flash_1_duration
|
||||||
if proportion >= 0.5 # Coming from white
|
if proportion >= 0.5 # Coming from white
|
||||||
@flash_viewport.color.alpha = 320 * 2 * (1 - proportion)
|
@flash_viewport.color.alpha = 320 * 2 * (1 - proportion)
|
||||||
@rear_black_sprite.visible = true
|
@rear_black_sprite.visible = true
|
||||||
@@ -1642,15 +1647,15 @@ module Transitions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Fade to white at end
|
# Fade to white at end
|
||||||
if @timer >= @fade_to_black_start
|
if timer >= @fade_to_black_start
|
||||||
# Fade to black
|
# Fade to black
|
||||||
@black_sprite.visible = true
|
@black_sprite.visible = true
|
||||||
proportion = (@timer - @fade_to_black_start) / (@duration - @fade_to_black_start)
|
proportion = (timer - @fade_to_black_start) / (@duration - @fade_to_black_start)
|
||||||
@flash_viewport.color.alpha = 255 * (1 - proportion)
|
@flash_viewport.color.alpha = 255 * (1 - proportion)
|
||||||
elsif @timer >= @fade_to_white_start
|
elsif timer >= @fade_to_white_start
|
||||||
@text_sprite.visible = false
|
@text_sprite.visible = false
|
||||||
# Slowly fade to white
|
# Slowly fade to white
|
||||||
proportion = (@timer - @fade_to_white_start) / (@fade_to_white_end - @fade_to_white_start)
|
proportion = (timer - @fade_to_white_start) / (@fade_to_white_end - @fade_to_white_start)
|
||||||
@flash_viewport.color.alpha = 255 * proportion
|
@flash_viewport.color.alpha = 255 * proportion
|
||||||
# Move bars and trainer sprites off-screen
|
# Move bars and trainer sprites off-screen
|
||||||
dist = BAR_Y_INDENT + BAR_HEIGHT
|
dist = BAR_Y_INDENT + BAR_HEIGHT
|
||||||
@@ -1724,9 +1729,9 @@ module Transitions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_anim
|
def update_anim
|
||||||
if @timer <= @rocket_appear_end
|
if timer <= @rocket_appear_end
|
||||||
# Rocket logos fly in from edges of screen
|
# Rocket logos fly in from edges of screen
|
||||||
proportion = @timer / @rocket_appear_end
|
proportion = timer / @rocket_appear_end
|
||||||
@rocket_sprites.each_with_index do |sprite, i|
|
@rocket_sprites.each_with_index do |sprite, i|
|
||||||
next if !sprite.visible
|
next if !sprite.visible
|
||||||
start_time = i * @rocket_appear_delay
|
start_time = i * @rocket_appear_delay
|
||||||
@@ -1743,7 +1748,7 @@ module Transitions
|
|||||||
else
|
else
|
||||||
@rocket_sprites.last.visible = false
|
@rocket_sprites.last.visible = false
|
||||||
# Black wedges expand to fill screen
|
# Black wedges expand to fill screen
|
||||||
proportion = (@timer - @rocket_appear_end) / (@duration - @rocket_appear_end)
|
proportion = (timer - @rocket_appear_end) / (@duration - @rocket_appear_end)
|
||||||
@sprites.each_with_index do |sprite, i|
|
@sprites.each_with_index do |sprite, i|
|
||||||
sprite.visible = true
|
sprite.visible = true
|
||||||
sprite.zoom_x = proportion if i.even?
|
sprite.zoom_x = proportion if i.even?
|
||||||
@@ -1848,64 +1853,66 @@ module Transitions
|
|||||||
def update_anim
|
def update_anim
|
||||||
# Strobes scrolling
|
# Strobes scrolling
|
||||||
if @sprites[0].visible
|
if @sprites[0].visible
|
||||||
@strobes_x -= Graphics.delta_s * STROBE_SCROLL_SPEED
|
@strobes_x = -timer * STROBE_SCROLL_SPEED
|
||||||
@strobes_x += @strobes_bitmap.width if @strobes_x <= -@strobes_bitmap.width
|
while @strobes_x <= -@strobes_bitmap.width
|
||||||
|
@strobes_x += @strobes_bitmap.width
|
||||||
|
end
|
||||||
@sprites.each_with_index { |spr, i| spr.x = @strobes_x + (i * @strobes_bitmap.width) }
|
@sprites.each_with_index { |spr, i| spr.x = @strobes_x + (i * @strobes_bitmap.width) }
|
||||||
end
|
end
|
||||||
if @timer >= @fade_to_black_start
|
if timer >= @fade_to_black_start
|
||||||
# Fade to black
|
# Fade to black
|
||||||
proportion = (@timer - @fade_to_black_start) / (@duration - @fade_to_black_start)
|
proportion = (timer - @fade_to_black_start) / (@duration - @fade_to_black_start)
|
||||||
@flash_viewport.color.alpha = 255 * (1 - proportion)
|
@flash_viewport.color.alpha = 255 * (1 - proportion)
|
||||||
elsif @timer >= @fade_to_white_end
|
elsif timer >= @fade_to_white_end
|
||||||
@flash_viewport.color.alpha = 255 # Ensure screen is white
|
@flash_viewport.color.alpha = 255 # Ensure screen is white
|
||||||
@black_sprite.visible = true # Make black overlay visible
|
@black_sprite.visible = true # Make black overlay visible
|
||||||
elsif @timer >= @foe_disappear_end
|
elsif timer >= @foe_disappear_end
|
||||||
@foe_sprite.visible = false # Ensure foe sprite has vanished
|
@foe_sprite.visible = false # Ensure foe sprite has vanished
|
||||||
@text_sprite.visible = false # Ensure name sprite has vanished
|
@text_sprite.visible = false # Ensure name sprite has vanished
|
||||||
# Slowly fade to white
|
# Slowly fade to white
|
||||||
proportion = (@timer - @foe_disappear_end) / (@fade_to_white_end - @foe_disappear_end)
|
proportion = (timer - @foe_disappear_end) / (@fade_to_white_end - @foe_disappear_end)
|
||||||
@flash_viewport.color.alpha = 255 * proportion
|
@flash_viewport.color.alpha = 255 * proportion
|
||||||
elsif @timer >= @foe_disappear_start
|
elsif timer >= @foe_disappear_start
|
||||||
# Slide foe sprite/name off-screen
|
# Slide foe sprite/name off-screen
|
||||||
proportion = (@timer - @foe_disappear_start) / (@foe_disappear_end - @foe_disappear_start)
|
proportion = (timer - @foe_disappear_start) / (@foe_disappear_end - @foe_disappear_start)
|
||||||
start_x = Graphics.width / 2
|
start_x = Graphics.width / 2
|
||||||
@foe_sprite.x = start_x - ((@foe_bitmap.width + start_x) * proportion * proportion)
|
@foe_sprite.x = start_x - ((@foe_bitmap.width + start_x) * proportion * proportion)
|
||||||
@text_sprite.x = @foe_sprite.x - (Graphics.width / 2)
|
@text_sprite.x = @foe_sprite.x - (Graphics.width / 2)
|
||||||
elsif @timer >= @flash_end
|
elsif timer >= @flash_end
|
||||||
@flash_viewport.color.alpha = 0 # Ensure flash has ended
|
@flash_viewport.color.alpha = 0 # Ensure flash has ended
|
||||||
elsif @timer >= @bg_2_appear_end
|
elsif timer >= @bg_2_appear_end
|
||||||
@bg_2_sprite.opacity = 255 # Ensure BG 2 sprite is fully opaque
|
@bg_2_sprite.opacity = 255 # Ensure BG 2 sprite is fully opaque
|
||||||
@foe_sprite.x = Graphics.width / 2 # Ensure foe sprite is in the right place
|
@foe_sprite.x = Graphics.width / 2 # Ensure foe sprite is in the right place
|
||||||
@text_sprite.x = 0 # Ensure name sprite is in the right place
|
@text_sprite.x = 0 # Ensure name sprite is in the right place
|
||||||
# Flash screen
|
# Flash screen
|
||||||
proportion = (@timer - @bg_2_appear_end) / (@flash_end - @bg_2_appear_end)
|
proportion = (timer - @bg_2_appear_end) / (@flash_end - @bg_2_appear_end)
|
||||||
@flash_viewport.color.alpha = 320 * (1 - proportion)
|
@flash_viewport.color.alpha = 320 * (1 - proportion)
|
||||||
elsif @timer >= @bg_2_appear_start
|
elsif timer >= @bg_2_appear_start
|
||||||
# BG 2 sprite appears
|
# BG 2 sprite appears
|
||||||
proportion = (@timer - @bg_2_appear_start) / (@bg_2_appear_end - @bg_2_appear_start)
|
proportion = (timer - @bg_2_appear_start) / (@bg_2_appear_end - @bg_2_appear_start)
|
||||||
@bg_2_sprite.opacity = 255 * proportion
|
@bg_2_sprite.opacity = 255 * proportion
|
||||||
# Foe sprite/name appear
|
# Foe sprite/name appear
|
||||||
start_x = Graphics.width + (@foe_bitmap.width / 2)
|
start_x = Graphics.width + (@foe_bitmap.width / 2)
|
||||||
@foe_sprite.x = start_x + (((Graphics.width / 2) - start_x) * Math.sqrt(proportion))
|
@foe_sprite.x = start_x + (((Graphics.width / 2) - start_x) * Math.sqrt(proportion))
|
||||||
@text_sprite.x = @foe_sprite.x - (Graphics.width / 2)
|
@text_sprite.x = @foe_sprite.x - (Graphics.width / 2)
|
||||||
@text_sprite.visible = true
|
@text_sprite.visible = true
|
||||||
elsif @timer >= @bg_1_appear_end
|
elsif timer >= @bg_1_appear_end
|
||||||
@bg_1_sprite.oy = Graphics.height / 2
|
@bg_1_sprite.oy = Graphics.height / 2
|
||||||
@bg_1_sprite.src_rect.y = 0
|
@bg_1_sprite.src_rect.y = 0
|
||||||
@bg_1_sprite.src_rect.height = @bg_1_bitmap.height
|
@bg_1_sprite.src_rect.height = @bg_1_bitmap.height
|
||||||
@sprites.each { |sprite| sprite.visible = false } # Hide strobes
|
@sprites.each { |sprite| sprite.visible = false } # Hide strobes
|
||||||
elsif @timer >= @bg_1_appear_start
|
elsif timer >= @bg_1_appear_start
|
||||||
@flash_viewport.color.alpha = 0 # Ensure flash has ended
|
@flash_viewport.color.alpha = 0 # Ensure flash has ended
|
||||||
# BG 1 sprite appears
|
# BG 1 sprite appears
|
||||||
proportion = (@timer - @bg_1_appear_start) / (@bg_1_appear_end - @bg_1_appear_start)
|
proportion = (timer - @bg_1_appear_start) / (@bg_1_appear_end - @bg_1_appear_start)
|
||||||
half_height = ((proportion * @bg_1_bitmap.height) / 2).to_i
|
half_height = ((proportion * @bg_1_bitmap.height) / 2).to_i
|
||||||
@bg_1_sprite.src_rect.height = half_height * 2
|
@bg_1_sprite.src_rect.height = half_height * 2
|
||||||
@bg_1_sprite.src_rect.y = (@bg_1_bitmap.height / 2) - half_height
|
@bg_1_sprite.src_rect.y = (@bg_1_bitmap.height / 2) - half_height
|
||||||
@bg_1_sprite.oy = half_height
|
@bg_1_sprite.oy = half_height
|
||||||
elsif @timer >= @strobe_appear_end
|
elsif timer >= @strobe_appear_end
|
||||||
@sprites.each { |sprite| sprite.opacity = 255 } # Ensure strobes are fully opaque
|
@sprites.each { |sprite| sprite.opacity = 255 } # Ensure strobes are fully opaque
|
||||||
# Flash the screen white
|
# Flash the screen white
|
||||||
proportion = (@timer - @strobe_appear_end) / (@bg_1_appear_start - @strobe_appear_end)
|
proportion = (timer - @strobe_appear_end) / (@bg_1_appear_start - @strobe_appear_end)
|
||||||
if proportion >= 0.5
|
if proportion >= 0.5
|
||||||
@flash_viewport.color.alpha = 320 * 2 * (1 - proportion)
|
@flash_viewport.color.alpha = 320 * 2 * (1 - proportion)
|
||||||
else
|
else
|
||||||
@@ -1914,7 +1921,7 @@ module Transitions
|
|||||||
else
|
else
|
||||||
# Strobes fade in
|
# Strobes fade in
|
||||||
@sprites.each do |sprite|
|
@sprites.each do |sprite|
|
||||||
sprite.opacity = 255 * (@timer / @strobe_appear_end)
|
sprite.opacity = 255 * (timer / @strobe_appear_end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -172,10 +172,9 @@ class Battle::Scene
|
|||||||
return if !@briefMessage
|
return if !@briefMessage
|
||||||
pbShowWindow(MESSAGE_BOX)
|
pbShowWindow(MESSAGE_BOX)
|
||||||
cw = @sprites["messageWindow"]
|
cw = @sprites["messageWindow"]
|
||||||
timer = 0.0
|
timer_start = System.uptime
|
||||||
while timer < MESSAGE_PAUSE_TIME
|
while System.uptime - timer_start < MESSAGE_PAUSE_TIME
|
||||||
pbUpdate(cw)
|
pbUpdate(cw)
|
||||||
timer += Graphics.delta_s
|
|
||||||
end
|
end
|
||||||
cw.text = ""
|
cw.text = ""
|
||||||
cw.visible = false
|
cw.visible = false
|
||||||
@@ -191,7 +190,7 @@ class Battle::Scene
|
|||||||
cw.setText(msg)
|
cw.setText(msg)
|
||||||
PBDebug.log_message(msg)
|
PBDebug.log_message(msg)
|
||||||
yielded = false
|
yielded = false
|
||||||
timer = 0.0
|
timer_start = System.uptime
|
||||||
loop do
|
loop do
|
||||||
pbUpdate(cw)
|
pbUpdate(cw)
|
||||||
if !cw.busy?
|
if !cw.busy?
|
||||||
@@ -205,12 +204,11 @@ class Battle::Scene
|
|||||||
@briefMessage = true
|
@briefMessage = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if timer >= MESSAGE_PAUSE_TIME # Autoclose after 1 second
|
if System.uptime - timer_start >= MESSAGE_PAUSE_TIME # Autoclose after 1 second
|
||||||
cw.text = ""
|
cw.text = ""
|
||||||
cw.visible = false
|
cw.visible = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
timer += Graphics.delta_s
|
|
||||||
end
|
end
|
||||||
if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) || @abortable
|
if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) || @abortable
|
||||||
if cw.busy?
|
if cw.busy?
|
||||||
@@ -237,7 +235,7 @@ class Battle::Scene
|
|||||||
cw.text = msg + "\1"
|
cw.text = msg + "\1"
|
||||||
PBDebug.log_message(msg)
|
PBDebug.log_message(msg)
|
||||||
yielded = false
|
yielded = false
|
||||||
timer = 0.0
|
timer_start = System.uptime
|
||||||
loop do
|
loop do
|
||||||
pbUpdate(cw)
|
pbUpdate(cw)
|
||||||
if !cw.busy?
|
if !cw.busy?
|
||||||
@@ -246,12 +244,11 @@ class Battle::Scene
|
|||||||
yielded = true
|
yielded = true
|
||||||
end
|
end
|
||||||
if !@battleEnd
|
if !@battleEnd
|
||||||
if timer >= MESSAGE_PAUSE_TIME * 3 # Autoclose after 3 seconds
|
if System.uptime - timer_start >= MESSAGE_PAUSE_TIME * 3 # Autoclose after 3 seconds
|
||||||
cw.text = ""
|
cw.text = ""
|
||||||
cw.visible = false
|
cw.visible = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
timer += Graphics.delta_s
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) || @abortable
|
if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) || @abortable
|
||||||
|
|||||||
@@ -345,11 +345,10 @@ class Battle::Scene
|
|||||||
return if @battle.opponent
|
return if @battle.opponent
|
||||||
@briefMessage = false
|
@briefMessage = false
|
||||||
pbMEPlay(pbGetWildCaptureME)
|
pbMEPlay(pbGetWildCaptureME)
|
||||||
timer = 0.0
|
timer_start = System.uptime
|
||||||
loop do
|
loop do
|
||||||
pbUpdate
|
pbUpdate
|
||||||
timer += Graphics.delta_s
|
break if System.uptime - timer_start >= 3.5
|
||||||
break if timer >= 3.5
|
|
||||||
end
|
end
|
||||||
pbMEStop
|
pbMEStop
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ module RPG
|
|||||||
|
|
||||||
def update_sprite_position(sprite, index, is_new_sprite = false)
|
def update_sprite_position(sprite, index, is_new_sprite = false)
|
||||||
return if !sprite || !sprite.bitmap || !sprite.visible
|
return if !sprite || !sprite.bitmap || !sprite.visible
|
||||||
delta_t = Graphics.delta_s
|
delta_t = Graphics.delta
|
||||||
lifetimes = (is_new_sprite) ? @new_sprite_lifetimes : @sprite_lifetimes
|
lifetimes = (is_new_sprite) ? @new_sprite_lifetimes : @sprite_lifetimes
|
||||||
if lifetimes[index] >= 0
|
if lifetimes[index] >= 0
|
||||||
lifetimes[index] -= delta_t
|
lifetimes[index] -= delta_t
|
||||||
@@ -310,7 +310,7 @@ module RPG
|
|||||||
end
|
end
|
||||||
|
|
||||||
def recalculate_tile_positions
|
def recalculate_tile_positions
|
||||||
delta_t = Graphics.delta_s
|
delta_t = Graphics.delta
|
||||||
weather_type = @type
|
weather_type = @type
|
||||||
if @fading && @fade_time >= [FADE_OLD_TONE_END - @time_shift, 0].max
|
if @fading && @fade_time >= [FADE_OLD_TONE_END - @time_shift, 0].max
|
||||||
weather_type = @target_type
|
weather_type = @target_type
|
||||||
@@ -411,7 +411,7 @@ module RPG
|
|||||||
@sun_magnitude = weather_max if @sun_magnitude != weather_max && @sun_magnitude != -weather_max
|
@sun_magnitude = weather_max if @sun_magnitude != weather_max && @sun_magnitude != -weather_max
|
||||||
@sun_magnitude *= -1 if (@sun_magnitude > 0 && @sun_strength > @sun_magnitude) ||
|
@sun_magnitude *= -1 if (@sun_magnitude > 0 && @sun_strength > @sun_magnitude) ||
|
||||||
(@sun_magnitude < 0 && @sun_strength < 0)
|
(@sun_magnitude < 0 && @sun_strength < 0)
|
||||||
@sun_strength += @sun_magnitude.to_f * Graphics.delta_s / 0.4 # 0.4 seconds per half flash
|
@sun_strength += @sun_magnitude.to_f * Graphics.delta / 0.4 # 0.4 seconds per half flash
|
||||||
tone_red += @sun_strength
|
tone_red += @sun_strength
|
||||||
tone_green += @sun_strength
|
tone_green += @sun_strength
|
||||||
tone_blue += @sun_strength / 2
|
tone_blue += @sun_strength / 2
|
||||||
@@ -424,7 +424,7 @@ module RPG
|
|||||||
def update_fading
|
def update_fading
|
||||||
return if !@fading
|
return if !@fading
|
||||||
old_fade_time = @fade_time
|
old_fade_time = @fade_time
|
||||||
@fade_time += Graphics.delta_s
|
@fade_time += Graphics.delta
|
||||||
# Change tile bitmaps
|
# Change tile bitmaps
|
||||||
if @type != @target_type
|
if @type != @target_type
|
||||||
tile_change_threshold = [FADE_OLD_TONE_END - @time_shift, 0].max
|
tile_change_threshold = [FADE_OLD_TONE_END - @time_shift, 0].max
|
||||||
@@ -483,7 +483,7 @@ module RPG
|
|||||||
# Storm flashes
|
# Storm flashes
|
||||||
if @type == :Storm && !@fading
|
if @type == :Storm && !@fading
|
||||||
if @time_until_flash > 0
|
if @time_until_flash > 0
|
||||||
@time_until_flash -= Graphics.delta_s
|
@time_until_flash -= Graphics.delta
|
||||||
if @time_until_flash <= 0
|
if @time_until_flash <= 0
|
||||||
@viewport.flash(Color.new(255, 255, 255, 230), rand(2..4) * 20)
|
@viewport.flash(Color.new(255, 255, 255, 230), rand(2..4) * 20)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -139,13 +139,12 @@ def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil)
|
|||||||
$PokemonEncounters.reset_step_count
|
$PokemonEncounters.reset_step_count
|
||||||
# Fade back to the overworld in 0.4 seconds
|
# Fade back to the overworld in 0.4 seconds
|
||||||
viewport.color = Color.black
|
viewport.color = Color.black
|
||||||
timer = 0.0
|
timer_start = System.uptime
|
||||||
loop do
|
loop do
|
||||||
Graphics.update
|
Graphics.update
|
||||||
Input.update
|
Input.update
|
||||||
pbUpdateSceneMap
|
pbUpdateSceneMap
|
||||||
timer += Graphics.delta_s
|
viewport.color.alpha = 255 * (1 - ((System.uptime - timer_start) / 0.4))
|
||||||
viewport.color.alpha = 255 * (1 - (timer / 0.4))
|
|
||||||
break if viewport.color.alpha <= 0
|
break if viewport.color.alpha <= 0
|
||||||
end
|
end
|
||||||
viewport.dispose
|
viewport.dispose
|
||||||
@@ -159,17 +158,16 @@ def pbBattleAnimationCore(anim, viewport, location, num_flashes = 2)
|
|||||||
viewport.color = Color.new(c, c, c) # Fade to black/white a few times
|
viewport.color = Color.new(c, c, c) # Fade to black/white a few times
|
||||||
half_flash_time = 0.2 # seconds
|
half_flash_time = 0.2 # seconds
|
||||||
num_flashes.times do # 2 flashes
|
num_flashes.times do # 2 flashes
|
||||||
timer = 0.0
|
timer_start = System.uptime
|
||||||
loop do
|
loop do
|
||||||
if timer < half_flash_time
|
if System.uptime - timer_start < half_flash_time
|
||||||
viewport.color.alpha = 255 * timer / half_flash_time
|
viewport.color.alpha = 255 * (System.uptime - timer_start) / half_flash_time
|
||||||
else
|
else
|
||||||
viewport.color.alpha = 255 * (2 - (timer / half_flash_time))
|
viewport.color.alpha = 255 * (2 - ((System.uptime - timer_start) / half_flash_time))
|
||||||
end
|
end
|
||||||
timer += Graphics.delta_s
|
|
||||||
Graphics.update
|
Graphics.update
|
||||||
pbUpdateSceneMap
|
pbUpdateSceneMap
|
||||||
break if timer >= half_flash_time * 2
|
break if System.uptime - timer_start >= half_flash_time * 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
viewport.color.alpha = 0
|
viewport.color.alpha = 0
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ EventHandlers.add(:on_frame_update, :phone_call_counter,
|
|||||||
if $PokemonGlobal.phone.time_to_next_call <= 0
|
if $PokemonGlobal.phone.time_to_next_call <= 0
|
||||||
$PokemonGlobal.phone.time_to_next_call = rand(20...40) * 60.0 # 20-40 minutes
|
$PokemonGlobal.phone.time_to_next_call = rand(20...40) * 60.0 # 20-40 minutes
|
||||||
end
|
end
|
||||||
$PokemonGlobal.phone.time_to_next_call -= Graphics.delta_s
|
$PokemonGlobal.phone.time_to_next_call -= Graphics.delta
|
||||||
next if $PokemonGlobal.phone.time_to_next_call > 0
|
next if $PokemonGlobal.phone.time_to_next_call > 0
|
||||||
# Time for a random phone call; generate one
|
# Time for a random phone call; generate one
|
||||||
Phone::Call.make_incoming
|
Phone::Call.make_incoming
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class IntroEventScene < EventScene
|
|||||||
# fade to opacity 255 in FADE_TICKS ticks after waiting 0 frames
|
# fade to opacity 255 in FADE_TICKS ticks after waiting 0 frames
|
||||||
@pic.moveOpacity(0, FADE_TICKS, 255)
|
@pic.moveOpacity(0, FADE_TICKS, 255)
|
||||||
pictureWait
|
pictureWait
|
||||||
@timer = 0.0 # reset the timer
|
@timer = System.uptime # reset the timer
|
||||||
onUpdate.set(method(:splash_update)) # called every frame
|
onUpdate.set(method(:splash_update)) # called every frame
|
||||||
onCTrigger.set(method(:close_splash)) # called when C key is pressed
|
onCTrigger.set(method(:close_splash)) # called when C key is pressed
|
||||||
end
|
end
|
||||||
@@ -52,8 +52,7 @@ class IntroEventScene < EventScene
|
|||||||
end
|
end
|
||||||
|
|
||||||
def splash_update(scene, args)
|
def splash_update(scene, args)
|
||||||
@timer += Graphics.delta_s
|
close_splash(scene, args) if System.uptime - @timer >= SECONDS_PER_SPLASH
|
||||||
close_splash(scene, args) if @timer > SECONDS_PER_SPLASH
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def open_title_screen(_scene, *args)
|
def open_title_screen(_scene, *args)
|
||||||
|
|||||||
@@ -539,13 +539,12 @@ class PokemonEvolutionScene
|
|||||||
pbPlayDecisionSE
|
pbPlayDecisionSE
|
||||||
@pokemon.play_cry
|
@pokemon.play_cry
|
||||||
@sprites["msgwindow"].text = _INTL("{1} is evolving!", @pokemon.name)
|
@sprites["msgwindow"].text = _INTL("{1} is evolving!", @pokemon.name)
|
||||||
timer = 0.0
|
timer_start = System.uptime
|
||||||
loop do
|
loop do
|
||||||
Graphics.update
|
Graphics.update
|
||||||
Input.update
|
Input.update
|
||||||
pbUpdate
|
pbUpdate
|
||||||
timer += Graphics.delta_s
|
break if System.uptime - timer_start >= 1
|
||||||
break if timer >= 1.0
|
|
||||||
end
|
end
|
||||||
oldstate = pbSaveSpriteState(@sprites["rsprite1"])
|
oldstate = pbSaveSpriteState(@sprites["rsprite1"])
|
||||||
oldstate2 = pbSaveSpriteState(@sprites["rsprite2"])
|
oldstate2 = pbSaveSpriteState(@sprites["rsprite2"])
|
||||||
|
|||||||
@@ -101,10 +101,11 @@ class Scene_Credits
|
|||||||
# Stop Editing
|
# Stop Editing
|
||||||
|
|
||||||
def main
|
def main
|
||||||
|
@quit = false
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
# Animated Background Setup
|
# Animated Background Setup
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
@counter = 0.0 # Counts time elapsed since the background image changed
|
@timer_start = System.uptime # Time when the credits started
|
||||||
@bg_index = 0
|
@bg_index = 0
|
||||||
@bitmap_height = Graphics.height # For a single credits text bitmap
|
@bitmap_height = Graphics.height # For a single credits text bitmap
|
||||||
@trim = Graphics.height / 10
|
@trim = Graphics.height / 10
|
||||||
@@ -198,55 +199,46 @@ class Scene_Credits
|
|||||||
Graphics.update
|
Graphics.update
|
||||||
Input.update
|
Input.update
|
||||||
update
|
update
|
||||||
break if $scene != self
|
break if @quit
|
||||||
end
|
end
|
||||||
pbBGMFade(2.0)
|
|
||||||
$game_temp.background_bitmap = Graphics.snap_to_bitmap
|
$game_temp.background_bitmap = Graphics.snap_to_bitmap
|
||||||
|
pbBGMFade(2.0)
|
||||||
Graphics.freeze
|
Graphics.freeze
|
||||||
viewport.color = Color.black # Ensure screen is black
|
viewport.color = Color.black # Ensure screen is black
|
||||||
|
text_viewport.color = Color.black # Ensure screen is black
|
||||||
Graphics.transition(8, "fadetoblack")
|
Graphics.transition(8, "fadetoblack")
|
||||||
$game_temp.background_bitmap.dispose
|
$game_temp.background_bitmap.dispose
|
||||||
@background_sprite.dispose
|
@background_sprite.dispose
|
||||||
@credit_sprites.each { |s| s&.dispose }
|
@credit_sprites.each { |s| s&.dispose }
|
||||||
text_viewport.dispose
|
|
||||||
viewport.dispose
|
viewport.dispose
|
||||||
|
text_viewport.dispose
|
||||||
$PokemonGlobal.creditsPlayed = true
|
$PokemonGlobal.creditsPlayed = true
|
||||||
pbBGMPlay(previousBGM)
|
pbBGMPlay(previousBGM)
|
||||||
|
$scene = ($game_map) ? Scene_Map.new : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if the credits should be cancelled
|
# Check if the credits should be cancelled
|
||||||
def cancel?
|
def cancel?
|
||||||
if Input.trigger?(Input::USE) && $PokemonGlobal.creditsPlayed
|
@quit = true if Input.trigger?(Input::USE) && $PokemonGlobal.creditsPlayed
|
||||||
$scene = Scene_Map.new
|
return @quit
|
||||||
pbBGMFade(1.0)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks if credits bitmap has reached its ending point
|
# Checks if credits bitmap has reached its ending point
|
||||||
def last?
|
def last?
|
||||||
if @realOY > @total_height + @trim
|
@quit = true if @realOY > @total_height + @trim
|
||||||
$scene = ($game_map) ? Scene_Map.new : nil
|
return @quit
|
||||||
pbBGMFade(2.0)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
delta = Graphics.delta_s
|
|
||||||
@counter += delta
|
|
||||||
# Go to next slide
|
# Go to next slide
|
||||||
if @counter >= SECONDS_PER_BACKGROUND
|
new_bg_index = ((System.uptime - @timer_start) / SECONDS_PER_BACKGROUND) % BACKGROUNDS_LIST.length
|
||||||
@counter -= SECONDS_PER_BACKGROUND
|
if @bg_index != new_bg_index
|
||||||
@bg_index += 1
|
@bg_index = new_bg_index
|
||||||
@bg_index = 0 if @bg_index >= BACKGROUNDS_LIST.length
|
|
||||||
@background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[@bg_index])
|
@background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[@bg_index])
|
||||||
end
|
end
|
||||||
return if cancel?
|
return if cancel?
|
||||||
return if last?
|
return if last?
|
||||||
@realOY += SCROLL_SPEED * delta
|
@realOY = SCROLL_SPEED * (System.uptime - @timer_start) - Graphics.height + @trim
|
||||||
@credit_sprites.each_with_index { |s, i| s.oy = @realOY - (@bitmap_height * i) }
|
@credit_sprites.each_with_index { |s, i| s.oy = @realOY - (@bitmap_height * i) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -221,13 +221,12 @@ class TriadScene
|
|||||||
|
|
||||||
def pbDisplay(text)
|
def pbDisplay(text)
|
||||||
@sprites["helpwindow"].text = text
|
@sprites["helpwindow"].text = text
|
||||||
timer = 0.0
|
timer_start = System.uptime
|
||||||
loop do
|
loop do
|
||||||
Graphics.update
|
Graphics.update
|
||||||
Input.update
|
Input.update
|
||||||
pbUpdate
|
pbUpdate
|
||||||
timer += Graphics.delta_s
|
break if System.uptime - timer_start >= 1.5
|
||||||
break if timer >= 1.5
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user