mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-07-22 07:37:00 +00:00
Update 6.8
This commit is contained in:
@@ -81,7 +81,7 @@ module RPG
|
||||
new_type = GameData::Weather.get(new_type).id
|
||||
new_max = 0 if new_type == :None
|
||||
return if @type == new_type && @max == new_max
|
||||
set_fog(new_type)
|
||||
#set_fog(new_type)
|
||||
if duration > 0
|
||||
@target_type = new_type
|
||||
@target_max = new_max
|
||||
@@ -117,7 +117,7 @@ module RPG
|
||||
@fading = false
|
||||
end
|
||||
@type = type
|
||||
set_fog(type)
|
||||
#set_fog(type)
|
||||
prepare_bitmaps(@type)
|
||||
if GameData::Weather.get(@type).has_tiles?
|
||||
w = @weatherTypes[@type][2][0].width
|
||||
@@ -134,6 +134,7 @@ module RPG
|
||||
end
|
||||
|
||||
def set_fog(weather_type)
|
||||
# return #handled elsewhere
|
||||
weather = GameData::Weather.get(weather_type)
|
||||
return if weather.fog_name.nil?
|
||||
$game_map.fog_name = weather.fog_name
|
||||
@@ -144,6 +145,7 @@ module RPG
|
||||
|
||||
def set_max(value,weather_type)
|
||||
return if @max == value
|
||||
return if get_max_sprites(value,weather_type) <= 0
|
||||
value = value.clamp(0, get_max_sprites(value,weather_type))
|
||||
#echoln "[Weather] Setting max particles to #{value} for type #{@type}" if @max != value
|
||||
@max = value
|
||||
@@ -202,7 +204,7 @@ module RPG
|
||||
end
|
||||
end
|
||||
if @fading && @new_sprites.length < MAX_SPRITES && @weatherTypes[@target_type] &&
|
||||
@weatherTypes[@target_type][1].length > 0
|
||||
@weatherTypes[@target_type][1].length > 0
|
||||
for i in 0...MAX_SPRITES
|
||||
if !@new_sprites[i]
|
||||
sprite = Sprite.new(@origViewport)
|
||||
@@ -369,7 +371,7 @@ module RPG
|
||||
sprite.opacity = 255 * (1 - fraction)
|
||||
end
|
||||
elsif @fade_time >= [FADE_NEW_TILES_START - @time_shift, 0].max &&
|
||||
@fade_time < [FADE_NEW_TILES_END - @time_shift, 0].max
|
||||
@fade_time < [FADE_NEW_TILES_END - @time_shift, 0].max
|
||||
fraction = (@fade_time - [FADE_NEW_TILES_START - @time_shift, 0].max) / (FADE_NEW_TILES_END - FADE_NEW_TILES_START)
|
||||
sprite.opacity = 255 * fraction
|
||||
else
|
||||
@@ -393,7 +395,7 @@ module RPG
|
||||
if @fading
|
||||
if @type == @target_type # Just changing max
|
||||
if @fade_time >= [FADE_NEW_TONE_START - @time_shift, 0].max &&
|
||||
@fade_time < [FADE_NEW_TONE_END - @time_shift, 0].max
|
||||
@fade_time < [FADE_NEW_TONE_END - @time_shift, 0].max
|
||||
weather_max = @target_max
|
||||
fract = (@fade_time - [FADE_NEW_TONE_START - @time_shift, 0].max) / (FADE_NEW_TONE_END - FADE_NEW_TONE_START)
|
||||
tone_red = @target_tone.red + (1 - fract) * (@old_tone.red - @target_tone.red)
|
||||
@@ -434,7 +436,7 @@ module RPG
|
||||
if weather_type == :Sun
|
||||
@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 < 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
|
||||
tone_red += @sun_strength
|
||||
tone_green += @sun_strength
|
||||
@@ -510,7 +512,7 @@ module RPG
|
||||
if @time_until_flash > 0
|
||||
@time_until_flash -= Graphics.delta_s
|
||||
if @time_until_flash <= 0
|
||||
@viewport.flash(Color.new(255, 255, 255, 230), (2 + rand(3)) * 20)
|
||||
@viewport.flash(Color.new(255, 255, 255, 80), (2 + rand(3)) * 20)
|
||||
if rand < 0.1
|
||||
@lightning_overlay.opacity = 255
|
||||
@lightning_overlay_duration = 20 # Lasts ~10 frames
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#===============================================================================
|
||||
class LocationWindow
|
||||
def initialize(name)
|
||||
name = format_location_name(name)
|
||||
@window = Window_AdvancedTextPokemon.new(name)
|
||||
@window.resizeToFit(name,Graphics.width)
|
||||
@window.x = 0
|
||||
@@ -11,8 +12,25 @@ class LocationWindow
|
||||
@window.viewport.z = 99999
|
||||
@currentmap = $game_map.map_id
|
||||
@frames = 0
|
||||
@close_automatically = true
|
||||
end
|
||||
|
||||
#Everything between parentheses gets ignored
|
||||
def format_location_name(name)
|
||||
name = _INTL(name.to_s)
|
||||
formatted = name.split(" (")
|
||||
return formatted[0]
|
||||
end
|
||||
|
||||
def set_close_automatically(value)
|
||||
@close_automatically = value
|
||||
end
|
||||
def text=(text)
|
||||
@window.text = text
|
||||
end
|
||||
def text
|
||||
return @window.text
|
||||
end
|
||||
def disposed?
|
||||
@window.disposed?
|
||||
end
|
||||
@@ -28,7 +46,7 @@ class LocationWindow
|
||||
@window.dispose
|
||||
return
|
||||
end
|
||||
if @frames > Graphics.frame_rate * 2
|
||||
if @frames > Graphics.frame_rate * 2 && @close_automatically
|
||||
@window.y -= 4
|
||||
@window.dispose if @window.y+@window.height<0
|
||||
else
|
||||
|
||||
+73
-45
@@ -3,14 +3,14 @@
|
||||
#===============================================================================
|
||||
def pbCaveEntranceEx(exiting)
|
||||
# Create bitmap
|
||||
sprite = BitmapSprite.new(Graphics.width,Graphics.height)
|
||||
sprite = BitmapSprite.new(Graphics.width, Graphics.height)
|
||||
sprite.z = 100000
|
||||
# Define values used for the animation
|
||||
totalFrames = (Graphics.frame_rate*0.4).floor
|
||||
increment = (255.0/totalFrames).ceil
|
||||
totalFrames = (Graphics.frame_rate * 0.4).floor
|
||||
increment = (255.0 / totalFrames).ceil
|
||||
totalBands = 15
|
||||
bandheight = ((Graphics.height/2.0)-10)/totalBands
|
||||
bandwidth = ((Graphics.width/2.0)-12)/totalBands
|
||||
bandheight = ((Graphics.height / 2.0) - 10) / totalBands
|
||||
bandwidth = ((Graphics.width / 2.0) - 12) / totalBands
|
||||
# Create initial array of band colors (black if exiting, white if entering)
|
||||
grays = Array.new(totalBands) { |i| (exiting) ? 0 : 255 }
|
||||
# Animate bands changing color
|
||||
@@ -19,47 +19,47 @@ def pbCaveEntranceEx(exiting)
|
||||
y = 0
|
||||
# Calculate color of each band
|
||||
for k in 0...totalBands
|
||||
next if k>=totalBands*j/totalFrames
|
||||
next if k >= totalBands * j / totalFrames
|
||||
inc = increment
|
||||
inc *= -1 if exiting
|
||||
grays[k] -= inc
|
||||
grays[k] = 0 if grays[k]<0
|
||||
grays[k] = 0 if grays[k] < 0
|
||||
end
|
||||
# Draw gray rectangles
|
||||
rectwidth = Graphics.width
|
||||
rectwidth = Graphics.width
|
||||
rectheight = Graphics.height
|
||||
for i in 0...totalBands
|
||||
currentGray = grays[i]
|
||||
sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),
|
||||
Color.new(currentGray,currentGray,currentGray))
|
||||
sprite.bitmap.fill_rect(Rect.new(x, y, rectwidth, rectheight),
|
||||
Color.new(currentGray, currentGray, currentGray))
|
||||
x += bandwidth
|
||||
y += bandheight
|
||||
rectwidth -= bandwidth*2
|
||||
rectheight -= bandheight*2
|
||||
rectwidth -= bandwidth * 2
|
||||
rectheight -= bandheight * 2
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
# Set the tone at end of band animation
|
||||
if exiting
|
||||
pbToneChangeAll(Tone.new(255,255,255),0)
|
||||
pbToneChangeAll(Tone.new(255, 255, 255), 0)
|
||||
else
|
||||
pbToneChangeAll(Tone.new(-255,-255,-255),0)
|
||||
pbToneChangeAll(Tone.new(-255, -255, -255), 0)
|
||||
end
|
||||
# Animate fade to white (if exiting) or black (if entering)
|
||||
for j in 0...totalFrames
|
||||
if exiting
|
||||
sprite.color = Color.new(255,255,255,j*increment)
|
||||
sprite.color = Color.new(255, 255, 255, j * increment)
|
||||
else
|
||||
sprite.color = Color.new(0,0,0,j*increment)
|
||||
sprite.color = Color.new(0, 0, 0, j * increment)
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
# Set the tone at end of fading animation
|
||||
pbToneChangeAll(Tone.new(0,0,0),8)
|
||||
pbToneChangeAll(Tone.new(0, 0, 0), 8)
|
||||
# Pause briefly
|
||||
(Graphics.frame_rate/10).times do
|
||||
(Graphics.frame_rate / 10).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
@@ -76,25 +76,41 @@ def pbCaveExit
|
||||
pbCaveEntranceEx(true)
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Blacking out animation
|
||||
#===============================================================================
|
||||
def pbStartOver(gameover=false)
|
||||
$game_variables[VAR_CURRENT_GYM_TYPE]=-1
|
||||
$game_switches[SWITCH_LOCK_PLAYER_MOVEMENT]=false
|
||||
$game_switches[SWITCH_TEAMED_WITH_ERIKA_SEWERS]=false
|
||||
$PokemonTemp.enteredSecretBaseController=nil
|
||||
def handle_no_reviving_defeat
|
||||
pbMessage(_INTL("Your challenge options prevent you from reviving Pokémon, but you need to have at least one Pokémon in your party."))
|
||||
pbMessage(_INTL("The first Pokémon in your party will revived at 1 HP."))
|
||||
pokemon = $Trainer.party[0]
|
||||
$PokemonSystem.no_reviving = false
|
||||
pokemon.hp = 1
|
||||
$PokemonSystem.no_reviving = true
|
||||
end
|
||||
|
||||
def pbStartOver(gameover = false)
|
||||
$game_variables[VAR_CURRENT_GYM_TYPE] = -1
|
||||
$game_switches[SWITCH_LOCK_PLAYER_MOVEMENT] = false
|
||||
$game_switches[SWITCH_TEAMED_WITH_ERIKA_SEWERS] = false
|
||||
if $game_switches[SWITCH_WALLY_CATCHING_POKEMON] || $game_switches[SWITCH_WALLY_GAVE_POKEMON]
|
||||
$game_switches[SWITCH_DIED_WITH_WALLY] = true
|
||||
end
|
||||
pbBridgeOff
|
||||
$PokemonTemp.enteredSecretBaseController = nil
|
||||
clear_all_images()
|
||||
$game_player.set_opacity(255)
|
||||
$game_system.menu_disabled=false
|
||||
$game_system.menu_disabled = false
|
||||
|
||||
if pbInBugContest?
|
||||
pbBugContestStartOver
|
||||
return
|
||||
end
|
||||
$Trainer.heal_party
|
||||
|
||||
if $PokemonSystem.no_reviving
|
||||
handle_no_reviving_defeat
|
||||
else
|
||||
$Trainer.heal_party
|
||||
end
|
||||
if isOnPinkanIsland()
|
||||
if $game_switches[SWITCH_PINKAN_SIDE_POLICE]
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]Hey, are you okay over there? Let me take you back to the dock."))
|
||||
@@ -104,7 +120,7 @@ def pbStartOver(gameover=false)
|
||||
pinkanIslandWarpToStart()
|
||||
return
|
||||
end
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId >= 0
|
||||
if gameover
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back to a Pokémon Center."))
|
||||
else
|
||||
@@ -113,33 +129,45 @@ def pbStartOver(gameover=false)
|
||||
pbCancelVehicles
|
||||
pbRemoveDependencies
|
||||
$game_switches[Settings::STARTING_OVER_SWITCH] = true
|
||||
$game_temp.player_new_map_id = $PokemonGlobal.pokecenterMapId
|
||||
$game_temp.player_new_x = $PokemonGlobal.pokecenterX
|
||||
$game_temp.player_new_y = $PokemonGlobal.pokecenterY
|
||||
$game_temp.player_new_map_id = $PokemonGlobal.pokecenterMapId
|
||||
$game_temp.player_new_x = $PokemonGlobal.pokecenterX
|
||||
$game_temp.player_new_y = $PokemonGlobal.pokecenterY
|
||||
$game_temp.player_new_direction = $PokemonGlobal.pokecenterDirection
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
if $scene.is_a?(Scene_Map)
|
||||
$scene.transfer_player
|
||||
$scene.reset_map(false)
|
||||
end
|
||||
$game_map.refresh
|
||||
else
|
||||
homedata = GameData::Metadata.get.home
|
||||
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata",homedata[0]))
|
||||
if $DEBUG
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
|
||||
if Settings::HOENN
|
||||
if isPlayerMale
|
||||
homedata = [9, 12, 14, DIRECTION_DOWN]
|
||||
else
|
||||
homedata = [9, 22, 14, DIRECTION_DOWN]
|
||||
end
|
||||
$Trainer.heal_party
|
||||
return
|
||||
end
|
||||
if gameover
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back home."))
|
||||
else
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back home, protecting your exhausted Pokémon from any further harm..."))
|
||||
homedata = GameData::Metadata.get.home
|
||||
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata", homedata[0]))
|
||||
if $DEBUG
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.", homedata[0]))
|
||||
end
|
||||
$Trainer.heal_party
|
||||
return
|
||||
end
|
||||
if gameover
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back home."))
|
||||
else
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back home, protecting your exhausted Pokémon from any further harm..."))
|
||||
end
|
||||
end
|
||||
|
||||
if homedata
|
||||
pbCancelVehicles
|
||||
pbRemoveDependencies
|
||||
$game_switches[Settings::STARTING_OVER_SWITCH] = true
|
||||
$game_temp.player_new_map_id = homedata[0]
|
||||
$game_temp.player_new_x = homedata[1]
|
||||
$game_temp.player_new_y = homedata[2]
|
||||
$game_temp.player_new_map_id = homedata[0]
|
||||
$game_temp.player_new_x = homedata[1]
|
||||
$game_temp.player_new_y = homedata[2]
|
||||
$game_temp.player_new_direction = homedata[3]
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
$game_map.refresh
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
Events.onSpritesetCreate += proc { |_sender, e|
|
||||
next unless $game_weather
|
||||
spriteset = e[0]
|
||||
new_map_id = spriteset.map.map_id
|
||||
old_map_id = $Trainer.last_visited_map
|
||||
next unless isOutdoor(new_map_id)
|
||||
|
||||
old_w = old_map_id ? $game_weather.get_map_weather_type(old_map_id) : :None
|
||||
new_w = $game_weather.get_map_weather_type(new_map_id)
|
||||
|
||||
old_int = (old_w == :Fog) ? $game_weather.get_map_weather_intensity(old_map_id) : 0
|
||||
new_int = (new_w == :Fog) ? $game_weather.get_map_weather_intensity(new_map_id) : 0
|
||||
|
||||
if old_int > 0 || new_int > 0
|
||||
spriteset.fade_in_fog(old_int, new_int)
|
||||
end
|
||||
}
|
||||
|
||||
class Spriteset_Map
|
||||
alias fog_fade_init initialize
|
||||
def initialize(*args)
|
||||
@current_fog_opacity = 0 # Track locally to avoid connection stutter
|
||||
@fog_target_opacity = nil
|
||||
@fog_fade_speed = 0
|
||||
fog_fade_init(*args)
|
||||
end
|
||||
|
||||
def fade_in_fog(old_intensity, new_intensity)
|
||||
@fog_target_opacity = (new_intensity * 20).clamp(0, 255)
|
||||
@current_fog_opacity = (old_intensity * 20).clamp(0, 255)
|
||||
fog_weather = GameData::Weather.get(:Fog)
|
||||
@map.fog_name =fog_weather&.fog_name if @map.fog_name == "" && (new_intensity > 0 || old_intensity > 0)
|
||||
@map.fog_sx = fog_weather&.tile_delta_x
|
||||
@map.fog_sy = fog_weather&.tile_delta_y
|
||||
@fog_fade_speed = (@fog_target_opacity > @current_fog_opacity) ? 2 : -5
|
||||
@fog_target_opacity = nil if @current_fog_opacity == @fog_target_opacity
|
||||
end
|
||||
|
||||
alias fog_fade_update update
|
||||
def update
|
||||
update_fog_fade
|
||||
fog_fade_update
|
||||
|
||||
if @fog && (@fog_target_opacity != nil || @current_fog_opacity > 0)
|
||||
@fog.opacity = @current_fog_opacity
|
||||
end
|
||||
end
|
||||
|
||||
def update_fog_fade
|
||||
return if @fog_target_opacity.nil?
|
||||
if @current_fog_opacity < @fog_target_opacity
|
||||
@current_fog_opacity = [@current_fog_opacity + @fog_fade_speed, @fog_target_opacity].min
|
||||
elsif @current_fog_opacity > @fog_target_opacity
|
||||
@current_fog_opacity = [@current_fog_opacity + @fog_fade_speed, @fog_target_opacity].max
|
||||
end
|
||||
|
||||
if @current_fog_opacity == @fog_target_opacity
|
||||
if @current_fog_opacity == 0
|
||||
@map.fog_name = ""
|
||||
end
|
||||
@fog_target_opacity = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user