#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # Blizz-ABS Event Anti-Lag (ABSEAL) by Blizzard # Version: 3.3 # Type: Performance Improving System # Date: 25.10.2006 # Date v2.0: 16.8.2007 # Date v3.0: 6.5.2008 # Date v3.0b: 14.7.2008 # Date v3.1: 31.1.2018 # Date v3.2: 13.3.2018 # Date v3.3: 23.3.2019 #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # # This work is licensed under BSD License 2.0: # # #---------------------------------------------------------------------------- # # # # Copyright (c) Boris "Blizzard" Mikić # # All rights reserved. # # # # Redistribution and use in source and binary forms, with or without # # modification, are permitted provided that the following conditions are met: # # # # 1. Redistributions of source code must retain the above copyright notice, # # this list of conditions and the following disclaimer. # # # # 2. Redistributions in binary form must reproduce the above copyright # # notice, this list of conditions and the following disclaimer in the # # documentation and/or other materials provided with the distribution. # # # # 3. Neither the name of the copyright holder nor the names of its # # contributors may be used to endorse or promote products derived from # # this software without specific prior written permission. # # # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # # POSSIBILITY OF SUCH DAMAGE. # # # #---------------------------------------------------------------------------- # # You may use this script for both non-commercial and commercial products # without limitations as long as you fulfill the conditions presented by the # above license. The "complete" way to give credit is to include the license # somewhere in your product (e.g. in the credits screen), but a "simple" way # is also acceptable. The "simple" way to give credit is as follows: # # Blizz-ABS Event Anti-Lag (ABSEAL) licensed under BSD License 2.0 # Copyright (c) Boris "Blizzard" Mikić # # Alternatively, if your font doesn't support diacritic characters, you may # use this variant: # # Blizz-ABS Event Anti-Lag (ABSEAL) licensed under BSD License 2.0 # Copyright (c) Boris "Blizzard" Mikic # # In general other similar variants are allowed as long as it is clear who # the creator is (e.g. "ABSEAL created by Blizzard" is acceptable). But if # possible, prefer to use one of the two variants listed above. # # If you fail to give credit and/or claim that this work was created by you, # this may result in legal action and/or payment of damages even though this # work is free of charge to use normally. # #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # # IMPORTANT NOTE: # # This EAL is a simplified version of Blizz-ABS's original EAL. If you are # using Blizz-ABS, please remove this script. Blizz-ABS has the full version # of Blizz-ABSEAL built-in. # # # Compatibility: # # 99% compatible with SDK v1.x. 80% compatible with SDK v2.x. Can cause # incompatibility issues with map graphic manipulating scripts. This script # comes UNDER all scripts that manipulate the Sprite_Character class. # Can cause problems with Scripts that manipulate instances of the # Sprite_Character class from the "outside". # # # Advantages compared to other Anti-Lag Systems: # # - much more compatible # - faster and better processing # - about 5 times less code # - built-in option to disable in specific maps # - maximum possible performance # # new in v2.0: # - an incredible performance improvement was achieved through a new system # # new in v3.0: # - increased performance improvement to the highest possible level # - new smart system: no need to configure the strength anymore # # new in v3.0b: # - disallows the usage of this script if Blizz-ABS is already installed # - now beta # # new in v3.1: # - added possibility to disable Blizz-ABSEAL on certain events # # new in v3.2: # - added EXTEND_TILES option # # new in v3.3: # - added new license # - added usage and crediting instructions # # # Explanation: # # This script will decrease the lag caused by events on the map by disabling # the update of events beyond the visible screen when their sprite is not # visible on the screen anymore. All graphical sprites for events are # substituted with a controller that handles those sprites. If an event's # update is disabled, the event's sprite will be disposed and completely # removed from the memory. "Auto-Start" and "Parallel Process" events are NOT # affected by this script. If a character is moving outside of the screen, he # will be updated as event, but not as sprite. # # # Configuration: # # NO_ABSEAL_IDS - Add any map IDs and separate them with commas if you want # to turn off Blizz-ABSEAL in those maps. # EXTEND_TILES - How many tiles the system should extend beyond the screen # without effect. e.g. a negative value would disable # sprites that are within the screen. # to turn off Blizz-ABSEAL in those maps. # AUTO_KILL - If you turn this on, all events without a spriteset will be # stopped updating automatically. If you need invisible # events, use any spriteset with opacity = 0 in this case or # even better a 8x4 pixel-sized empty dummy spriteset. This # does not affect "Auto-Start" and "Parallel Processes". # # # Extras: # # In order to disable Blizz-ABSEAL on certain events, simply include the text # "\noeal" (without quotes) in the event name. # # # If you find any bugs, please report them here: # http://forum.chaos-project.com #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= $BlizzABSEAL = 3.3 #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # START Configuration #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: NO_ABSEAL_IDS = [] EXTEND_TILES = -1 AUTO_KILL = false #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # END Configuration #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: if $BlizzABS raise 'Blizz-ABS was detected! Please remove the additional Blizz-ABSEAL!' end #============================================================================== # Game_Character #============================================================================== class Game_Character attr_accessor :sprite_size alias init_abseal_later initialize def initialize @sprite_size = [0, 1600, 0, 1600] init_abseal_later end end #============================================================================== # Game_Event #============================================================================== class Game_Event alias init_event_abseal_later initialize def initialize(map_id, event) @abseal_active = (event.name.clone.gsub!('\\noeal') {''} == nil) init_event_abseal_later(map_id, event) end alias upd_player_abseal_later update def update upd_player_abseal_later if self.update? || self.moving? end def update? return true if NO_ABSEAL_IDS.include?($game_map.map_id) return true if [3, 4].include?(self.trigger) return true if !@abseal_active return false if AUTO_KILL && @character_name == '' && @tile_id < 384 return false if @real_x >= $game_map.display_x + 20 * 128 - @sprite_size[0] + EXTEND_TILES * 128 return false if @real_x < $game_map.display_x - @sprite_size[1] - EXTEND_TILES * 128 return false if @real_y >= $game_map.display_y + 15 * 128 - @sprite_size[2] + EXTEND_TILES * 128 return false if @real_y < $game_map.display_y - @sprite_size[3] - EXTEND_TILES * 128 return true end end #============================================================================== # Control_Sprite_Character #============================================================================== class Control_Sprite_Character attr_reader :character def initialize(viewport, character = nil) self.character = character @viewport = viewport end def character=(char) @character = char @sprite.character = char unless @sprite == nil end def update if @character != nil && (@character.is_a?(Game_Event) && @character.update? || !@character.is_a?(Game_Event)) if @sprite == nil || @sprite.disposed? @sprite = Sprite_Character_ABSEAL_ed.new(@viewport, @character) else @sprite.update end if @sprite.bitmap != nil @character.sprite_size = [64-@sprite.src_rect.width*2, 60+@sprite.src_rect.width*2, 128-@sprite.src_rect.height*4, 124] if @character.is_a?(Game_Event) && !@character.update? @sprite.dispose unless @sprite.disposed? @sprite = nil end else @character.size = [0, 124, 0, 124] end elsif @sprite != nil @sprite.dispose unless @sprite.disposed? @sprite = nil end end def dispose unless @sprite == nil || @sprite.disposed? @sprite.dispose @sprite = nil end end end #============================================================================== # Sprite_Character_ABSEAL_ed #============================================================================== class Sprite_Character_ABSEAL_ed < Sprite_Character end #============================================================================== # Sprite_Character #============================================================================== class Sprite_Character < Control_Sprite_Character end