Fixed overworld weather fading out/in when walking between maps with the same weather, added support for Sprite coordinates being floats

This commit is contained in:
Maruno17
2023-07-30 20:32:39 +01:00
parent 4f14108772
commit 4c25ade184
5 changed files with 113 additions and 80 deletions

View File

@@ -5,8 +5,10 @@ class Spriteset_Global
@@viewport2.z = 200
def initialize
@map_id = $game_map&.map_id || 0
@follower_sprites = FollowerSprites.new(Spriteset_Map.viewport)
@playersprite = Sprite_Character.new(Spriteset_Map.viewport, $game_player)
@weather = RPG::Weather.new(Spriteset_Map.viewport)
@picture_sprites = []
(1..100).each do |i|
@picture_sprites.push(Sprite_Picture.new(@@viewport2, $game_screen.pictures[i]))
@@ -20,6 +22,8 @@ class Spriteset_Global
@follower_sprites = nil
@playersprite.dispose
@playersprite = nil
@weather.dispose
@weather = nil
@picture_sprites.each { |sprite| sprite.dispose }
@picture_sprites.clear
@timer_sprite.dispose
@@ -29,6 +33,23 @@ class Spriteset_Global
def update
@follower_sprites.update
@playersprite.update
if @weather.type != $game_screen.weather_type
@weather.fade_in($game_screen.weather_type, $game_screen.weather_max, $game_screen.weather_duration)
end
if @map_id != $game_map.map_id
offsets = $map_factory.getRelativePos(@map_id, 0, 0, $game_map.map_id, 0, 0)
if offsets == [0, 0]
@weather.ox_offset = 0
@weather.oy_offset = 0
else
@weather.ox_offset += offsets[0] * Game_Map::TILE_WIDTH
@weather.oy_offset += offsets[1] * Game_Map::TILE_HEIGHT
end
@map_id = $game_map.map_id
end
@weather.ox = ($game_map.display_x / Game_Map::X_SUBPIXELS).round
@weather.oy = ($game_map.display_y / Game_Map::Y_SUBPIXELS).round
@weather.update
@picture_sprites.each { |sprite| sprite.update }
@timer_sprite.update
end

View File

@@ -62,7 +62,6 @@ class Spriteset_Map
sprite = Sprite_Character.new(@@viewport1, @map.events[i])
@character_sprites.push(sprite)
end
@weather = RPG::Weather.new(@@viewport1)
EventHandlers.trigger(:on_new_spriteset_map, self, @@viewport1)
update
end
@@ -76,11 +75,9 @@ class Spriteset_Map
@panorama.dispose
@fog.dispose
@character_sprites.each { |sprite| sprite.dispose }
@weather.dispose
@panorama = nil
@fog = nil
@character_sprites.clear
@weather = nil
end
def getAnimations
@@ -126,14 +123,6 @@ class Spriteset_Map
@character_sprites.each do |sprite|
sprite.update
end
if self.map == $game_map
@weather.fade_in($game_screen.weather_type, $game_screen.weather_max, $game_screen.weather_duration)
else
@weather.fade_in(:None, 0, 20)
end
@weather.ox = tmox
@weather.oy = tmoy
@weather.update
@@viewport1.tone = $game_screen.tone
@@viewport3.color = $game_screen.flash_color
@@viewport1.update