Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** Custom Resolution - Map Zoom
- # Version : 1.04
- # Author : LiTTleDRAgo
- #==============================================================================
- #
- # Introduction :
- #
- # As the name stated, this script zooms the map and player in the screen
- #
- # How to Use :
- #
- # Script :
- # zoom(ZOOM) # As an Integer (1-12)
- #
- # Note :
- #
- # Float zoom values will cause some glitch in the map
- #
- #==============================================================================
- ($imported ||= {})[:drg_cr_map_zoom] = 1.04
- core = "This script needs Drago - Core Engine ver 1.43 or above"
- reso = "This script needs F0's Custom Resolution ver 0.97a or above"
- rmxp = "This script only for RMXP"
- ($imported[:drg_core_engine] || 0) >= 1.43 || raise(core)
- $resolution && $resolution.version >= 0.971 || raise(reso)
- LiTTleDRAgo::XP || raise(rmxp)
- #==============================================================================
- # ** Sprite_Character
- #------------------------------------------------------------------------------
- # This sprite is used to display the character.It observes the Game_Character
- # class and automatically changes sprite conditions.
- #==============================================================================
- class Sprite_Character
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias_sec_method(:zoom_update_scrolling, :update)
- #--------------------------------------------------------------------------
- # * Aliased method: update
- #--------------------------------------------------------------------------
- def update(*args)
- zoom_update_scrolling(*args)
- # Update character sprites
- self.zoom_x = $game_map.zoom_x
- self.zoom_y = $game_map.zoom_y
- 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
- #--------------------------------------------------------------------------
- # * New method: zoom
- #--------------------------------------------------------------------------
- def zoom(zoom=1.0)
- @zoom_x = [[zoom, 1].max,12].min.round
- @zoom_y = [[zoom, 1].max,12].min.round
- end
- #--------------------------------------------------------------------------
- # * New method: zoom_in
- #--------------------------------------------------------------------------
- def zoom_in
- zoom(@zoom_x + 1)
- end
- #--------------------------------------------------------------------------
- # * New method: zoom_out
- #--------------------------------------------------------------------------
- def zoom_out
- zoom(@zoom_x - 1)
- end
- end
- #==============================================================================
- # ** Interpreter
- #------------------------------------------------------------------------------
- # This interpreter runs event commands. This class is used within the
- # Game_System class and the Game_Event class.
- #==============================================================================
- class Interpreter
- #--------------------------------------------------------------------------
- # * Redirect Listing
- #--------------------------------------------------------------------------
- redirect_method :zoom, '$game_map.zoom'
- redirect_method :zoom_in, '$game_map.zoom_in'
- redirect_method :zoom_out, '$game_map.zoom_out'
- end
- #==============================================================================
- # ** Game_Character
- #------------------------------------------------------------------------------
- # This class deals with characters. It's used as a superclass for the
- # determinants and map scrolling. Refer to "$game_player" for the one
- # Game_Player and Game_Event classes.
- #==============================================================================
- class Game_Character
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias_sec_method(:screen_x_before_zoom, :screen_x)
- alias_sec_method(:screen_y_before_zoom, :screen_y)
- alias_sec_method(:screen_z_before_zoom, :screen_z)
- #--------------------------------------------------------------------------
- # * Aliased method: screen_x
- #--------------------------------------------------------------------------
- def screen_x(*args)
- # Get screen coordinates from real coordinates and map display position
- screen_x_before_zoom(*args) * $game_map.zoom_x
- end
- #--------------------------------------------------------------------------
- # * Aliased method: screen_y
- #--------------------------------------------------------------------------
- def screen_y(*args)
- # Get screen coordinates from real coordinates and map display position
- screen_y_before_zoom(*args) * $game_map.zoom_y
- end
- #--------------------------------------------------------------------------
- # * Overwriten method: screen_z
- #--------------------------------------------------------------------------
- def screen_z(height = 0)
- # If display flag on closest surface is ON
- if @always_on_top
- # 999, unconditional
- return 999
- end
- # Get screen coordinates from real coordinates and map display position
- z = (@real_y - $game_map.display_y + 3) * $game_map.zoom_y / 4 + 32
- # If tile
- if @tile_id > 0
- # Add tile priority * 32
- return z + $game_map.priorities[@tile_id] * 32
- # If character
- else
- # If height exceeds 32, then add 31
- return z + ((height > 32) ? 31 : 0)
- end
- end
- end
- #==============================================================================
- # ** Spriteset_Map
- #------------------------------------------------------------------------------
- # This class brings together map screen sprites, tilemaps, etc.
- # It's used within the Scene_Map class.
- #==============================================================================
- class Spriteset_Map
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias_sec_method(:zoom_update_scrolling, :update)
- #--------------------------------------------------------------------------
- # * Aliased method: update
- #--------------------------------------------------------------------------
- def update(*args)
- zoom_update_scrolling(*args)
- @fog.zoom_x *= $game_map.zoom_x
- @fog.zoom_y *= $game_map.zoom_y
- @panorama.zoom_x *= $game_map.zoom_x
- @panorama.zoom_y *= $game_map.zoom_y
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement