From 9657eca3d721bf72bc50c0f88184efe6a4b15ad0 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 14 Nov 2021 16:40:55 +0000 Subject: [PATCH] Fixed panoramas/fogs/other AnimatedPlanes not animating properly --- .../003_Game processing/002_Scene_Map.rb | 6 +- Data/Scripts/005_Sprites/007_Spriteset_Map.rb | 8 +- .../007_Objects and windows/009_Planes.rb | 220 +++--------------- 3 files changed, 35 insertions(+), 199 deletions(-) diff --git a/Data/Scripts/003_Game processing/002_Scene_Map.rb b/Data/Scripts/003_Game processing/002_Scene_Map.rb index 9d3608c61..4d087d3ff 100644 --- a/Data/Scripts/003_Game processing/002_Scene_Map.rb +++ b/Data/Scripts/003_Game processing/002_Scene_Map.rb @@ -140,6 +140,9 @@ class Scene_Map def updateSpritesets @spritesets = {} if !@spritesets + for map in $map_factory.maps + @spritesets[map.map_id] = Spriteset_Map.new(map) if !@spritesets[map.map_id] + end keys = @spritesets.keys.clone for i in keys if !$map_factory.hasMap?(i) @@ -151,9 +154,6 @@ class Scene_Map end end @spritesetGlobal.update - for map in $map_factory.maps - @spritesets[map.map_id] = Spriteset_Map.new(map) if !@spritesets[map.map_id] - end pbDayNightTint(@map_renderer) @map_renderer.update Events.onMapUpdate.trigger(self) diff --git a/Data/Scripts/005_Sprites/007_Spriteset_Map.rb b/Data/Scripts/005_Sprites/007_Spriteset_Map.rb index ccfc733fc..4e07d4b36 100644 --- a/Data/Scripts/005_Sprites/007_Spriteset_Map.rb +++ b/Data/Scripts/005_Sprites/007_Spriteset_Map.rb @@ -92,15 +92,15 @@ class Spriteset_Map if @panorama_name!=@map.panorama_name || @panorama_hue!=@map.panorama_hue @panorama_name = @map.panorama_name @panorama_hue = @map.panorama_hue - @panorama.setPanorama(nil) if @panorama.bitmap!=nil - @panorama.setPanorama(@panorama_name,@panorama_hue) if @panorama_name!="" + @panorama.set_panorama(nil) if !@panorama.bitmap.nil? + @panorama.set_panorama(@panorama_name, @panorama_hue) if !nil_or_empty?(@panorama_name) Graphics.frame_reset end if @fog_name!=@map.fog_name || @fog_hue!=@map.fog_hue @fog_name = @map.fog_name @fog_hue = @map.fog_hue - @fog.setFog(nil) if @fog.bitmap!=nil - @fog.setFog(@fog_name,@fog_hue) if @fog_name!="" + @fog.set_fog(nil) if !@fog.bitmap.nil? + @fog.set_fog(@fog_name, @fog_hue) if !nil_or_empty?(@fog_name) Graphics.frame_reset end tmox = (@map.display_x/Game_Map::X_SUBPIXELS).round diff --git a/Data/Scripts/007_Objects and windows/009_Planes.rb b/Data/Scripts/007_Objects and windows/009_Planes.rb index 7820fe138..b245e7f8e 100644 --- a/Data/Scripts/007_Objects and windows/009_Planes.rb +++ b/Data/Scripts/007_Objects and windows/009_Planes.rb @@ -6,167 +6,14 @@ class Plane def refresh; end end - - -#=============================================================================== -# This class works around a limitation that planes are always -# 640 by 480 pixels in size regardless of the window's size. -#=============================================================================== -class LargePlane < Plane - attr_accessor :borderX - attr_accessor :borderY - - def initialize(viewport=nil) - @__sprite=Sprite.new(viewport) - @__disposed=false - @__ox=0 - @__oy=0 - @__bitmap=nil - @__visible=true - @__sprite.visible=false - @borderX=0 - @borderY=0 - end - - def disposed? - return @__disposed - end - - def dispose - if !@__disposed - @__sprite.bitmap.dispose if @__sprite.bitmap - @__sprite.dispose - @__sprite=nil - @__bitmap=nil - @__disposed=true - end - #super - end - - def ox; @__ox; end - def oy; @__oy; end - - def ox=(value) - return if @__ox==value - @__ox = value - refresh - end - - def oy=(value) - return if @__oy==value - @__oy = value - refresh - end - - def bitmap - return @__bitmap - end - - def bitmap=(value) - if value==nil - if @__bitmap!=nil - @__bitmap=nil - @__sprite.visible=(@__visible && !@__bitmap.nil?) - end - elsif @__bitmap!=value && !value.disposed? - @__bitmap=value - refresh - elsif value.disposed? - if @__bitmap!=nil - @__bitmap=nil - @__sprite.visible=(@__visible && !@__bitmap.nil?) - end - end - end - - def viewport; @__sprite.viewport; end - def zoom_x; @__sprite.zoom_x; end - def zoom_y; @__sprite.zoom_y; end - def opacity; @__sprite.opacity; end - def blend_type; @__sprite.blend_type; end - def visible; @__visible; end - def z; @__sprite.z; end - def color; @__sprite.color; end - def tone; @__sprite.tone; end - - def zoom_x=(v) - return if @__sprite.zoom_x==v - @__sprite.zoom_x = v - refresh - end - - def zoom_y=(v) - return if @__sprite.zoom_y==v - @__sprite.zoom_y = v - refresh - end - - def opacity=(v); @__sprite.opacity=(v); end - def blend_type=(v); @__sprite.blend_type=(v); end - def visible=(v); @__visible=v; @__sprite.visible=(@__visible && !@__bitmap.nil?); end - def z=(v); @__sprite.z=(v); end - def color=(v); @__sprite.color=(v); end - def tone=(v); @__sprite.tone=(v); end - def update; end - - def refresh - @__sprite.visible = (@__visible && !@__bitmap.nil?) - if @__bitmap - if !@__bitmap.disposed? - @__ox += @__bitmap.width*@__sprite.zoom_x if @__ox<0 - @__oy += @__bitmap.height*@__sprite.zoom_y if @__oy<0 - @__ox -= @__bitmap.width*@__sprite.zoom_x if @__ox>@__bitmap.width - @__oy -= @__bitmap.height*@__sprite.zoom_y if @__oy>@__bitmap.height - dwidth = (Graphics.width/@__sprite.zoom_x+@borderX).to_i # +2 - dheight = (Graphics.height/@__sprite.zoom_y+@borderY).to_i # +2 - @__sprite.bitmap = ensureBitmap(@__sprite.bitmap,dwidth,dheight) - @__sprite.bitmap.clear - tileBitmap(@__sprite.bitmap,@__bitmap,@__bitmap.rect) - else - @__sprite.visible = false - end - end - end - - private - - def ensureBitmap(bitmap,dwidth,dheight) - if !bitmap || bitmap.disposed? || bitmap.width0; left -= srcbitmap.width; end - while top>0; top -= srcbitmap.height; end - y = top - while y