Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # [XP] Drago Smooth Scroller
- # Version: 2.02
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- ($imported ||= {})[:drg_smooth_scroller] = 2.02
- module LiTTleDRAgo
- DISABLE_SMOOTH_SW = 1
- SMOOTH_FACTOR = 16.0
- end
- #==============================================================================
- # ** Game_Player
- #------------------------------------------------------------------------------
- # This class handles the player. Its functions include event starting
- # determinants and map scrolling. Refer to "$game_player" for the one
- # instance of this class.
- #==============================================================================
- ModPlayer = $BlizzABS ? BlizzABS::Controller : Game_Player
- class ModPlayer
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- @@smooth_scroller_update = $BlizzABS ? :update_moving : :update
- $@ || alias_method(:smooth_scroller_update, @@smooth_scroller_update)
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- define_method(:"#{@@smooth_scroller_update}") do |*args|
- if (switch = LiTTleDRAgo::DISABLE_SMOOTH_SW) && $game_switches[switch]
- $game_temp.instance_variable_set(:@prevent_map_scroll,false)
- return smooth_scroller_update(*args)
- end
- $game_temp.instance_variable_set(:@prevent_map_scroll,true)
- smooth_scroller_update(*args)
- $game_temp.instance_variable_set(:@prevent_map_scroll,false)
- if $BlizzABS
- scroll_map_update(player.real_x,player.real_y) if args.at(0) != nil
- else
- scroll_map_update(@real_x, @real_y)
- end
- end unless $xrxs_xas
- #--------------------------------------------------------------------------
- # * Scroll Map Update
- #--------------------------------------------------------------------------
- def scroll_map_update(real_x,real_y)
- real_x, real_y = @real_x, @real_y if $xrxs_xas
- sf = LiTTleDRAgo::SMOOTH_FACTOR
- if real_y - $game_map.display_y > (tile_y = ($BlizzABS ? CY : CENTER_Y))
- $game_map.scroll_down(real_y > $game_map.height*128 - tile_y ?
- (($game_map.height - (tile_y/64))*128 - $game_map.display_y) / sf :
- ((real_y - $game_map.display_y - tile_y) / sf))
- end
- if real_x - $game_map.display_x < (tile_x = ($BlizzABS ? CX : CENTER_X))
- $game_map.scroll_left(real_x < tile_x ? $game_map.display_x / sf :
- (($game_map.display_x + tile_x - real_x)/sf))
- end
- if real_x - $game_map.display_x > tile_x
- $game_map.scroll_right(real_x > $game_map.width*128 - tile_x ?
- (($game_map.width - (tile_x/64))*128 - $game_map.display_x)/sf :
- (real_x - $game_map.display_x - tile_x )/sf)
- end
- if real_y - $game_map.display_y < tile_y
- $game_map.scroll_up(real_y < tile_y ? $game_map.display_y / sf :
- (($game_map.display_y + tile_y - real_y)/sf))
- end
- end
- end
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # This class handles the map. It includes scrolling and passable determining
- # functions. Refer to "$game_map" for the instance of this class.
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Display X, Display Y (rounded value)
- #--------------------------------------------------------------------------
- [:x,:y].each do |m|
- $@ || alias_method(:"ss_display_#{m}",:"display_#{m}")
- define_method(:"display_#{m}") { send(:"ss_display_#{m}").round }
- end
- #--------------------------------------------------------------------------
- # * Scroll Down, Scroll Up, Scroll Left, Scroll Right
- #--------------------------------------------------------------------------
- [:down,:up,:left,:right].each do |m|
- $@ || alias_method(:"ss_scroll_#{m}", :"scroll_#{m}")
- define_method(:"scroll_#{m}") do |*args|
- return if $game_temp.instance_variable_get(:@prevent_map_scroll)
- send(:"ss_scroll_#{m}",*args)
- end
- end unless $xrxs_xas
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement