Advertisement
Archeia

Viewports/Map Fix for Modified RGSS300.dll File

Sep 11th, 2014
1,594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.14 KB | None | 0 0
  1. #==============================================================================
  2. # ▼ Viewports/Map Fix for Modified RGSS300.dll File
  3. #   Origin of Code: Yanfly Engine Ace - Ace Core Engine v1.06
  4. # -- Last Updated: 2011.12.26
  5. # -- Level: Easy, Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. Graphics.resize_screen(1024,768)
  11.  
  12. #==============================================================================
  13. # ■ Game_Map
  14. #==============================================================================
  15.  
  16. class Game_Map
  17.  
  18.   #--------------------------------------------------------------------------
  19.   # overwrite method: scroll_down
  20.   #--------------------------------------------------------------------------
  21.   def scroll_down(distance)
  22.     if loop_vertical?
  23.       @display_y += distance
  24.       @display_y %= @map.height * 256
  25.       @parallax_y += distance
  26.     else
  27.       last_y = @display_y
  28.       dh = Graphics.height > height * 32 ? height : screen_tile_y
  29.       @display_y = [@display_y + distance, height - dh].min
  30.       @parallax_y += @display_y - last_y
  31.     end
  32.   end
  33.  
  34.   #--------------------------------------------------------------------------
  35.   # overwrite method: scroll_right
  36.   #--------------------------------------------------------------------------
  37.   def scroll_right(distance)
  38.     if loop_horizontal?
  39.       @display_x += distance
  40.       @display_x %= @map.width * 256
  41.       @parallax_x += distance
  42.     else
  43.       last_x = @display_x
  44.       dw = Graphics.width > width * 32 ? width : screen_tile_x
  45.       @display_x = [@display_x + distance, width - dw].min
  46.       @parallax_x += @display_x - last_x
  47.     end
  48.   end
  49.  
  50. end # Game_Map
  51.  
  52. #==============================================================================
  53. # ■ Spriteset_Map
  54. #==============================================================================
  55.  
  56. class Spriteset_Map
  57.  
  58.   #--------------------------------------------------------------------------
  59.   # overwrite method: create_viewports
  60.   #--------------------------------------------------------------------------
  61.   def create_viewports
  62.     if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  63.       dx = (Graphics.width - $game_map.width * 32) / 2
  64.     else
  65.       dx = 0
  66.     end
  67.     dw = [Graphics.width, $game_map.width * 32].min
  68.     dw = Graphics.width if $game_map.loop_horizontal?
  69.     if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  70.       dy = (Graphics.height - $game_map.height * 32) / 2
  71.     else
  72.       dy = 0
  73.     end
  74.     dh = [Graphics.height, $game_map.height * 32].min
  75.     dh = Graphics.height if $game_map.loop_vertical?
  76.     @viewport1 = Viewport.new(dx, dy, dw, dh)
  77.     @viewport2 = Viewport.new(dx, dy, dw, dh)
  78.     @viewport3 = Viewport.new(dx, dy, dw, dh)
  79.     @viewport2.z = 50
  80.     @viewport3.z = 100
  81.   end
  82.  
  83.   #--------------------------------------------------------------------------
  84.   # new method: update_viewport_sizes
  85.   #--------------------------------------------------------------------------
  86.   def update_viewport_sizes
  87.     if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  88.       dx = (Graphics.width - $game_map.width * 32) / 2
  89.     else
  90.       dx = 0
  91.     end
  92.     dw = [Graphics.width, $game_map.width * 32].min
  93.     dw = Graphics.width if $game_map.loop_horizontal?
  94.     if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  95.       dy = (Graphics.height - $game_map.height * 32) / 2
  96.     else
  97.       dy = 0
  98.     end
  99.     dh = [Graphics.height, $game_map.height * 32].min
  100.     dh = Graphics.height if $game_map.loop_vertical?
  101.     rect = Rect.new(dx, dy, dw, dh)
  102.     for viewport in [@viewport1, @viewport2, @viewport3]
  103.       viewport.rect = rect
  104.     end
  105.   end
  106.  
  107. end # Spriteset_Map
  108.  
  109. #==============================================================================
  110. # ■ Scene_Map
  111. #==============================================================================
  112.  
  113. class Scene_Map < Scene_Base
  114.  
  115.   #--------------------------------------------------------------------------
  116.   # alias method: post_transfer
  117.   #--------------------------------------------------------------------------
  118.   alias scene_map_post_transfer_ace post_transfer
  119.   def post_transfer
  120.     @spriteset.update_viewport_sizes
  121.     scene_map_post_transfer_ace
  122.   end
  123.  
  124. end # Scene_Map
  125.  
  126. #==============================================================================
  127. # ■ Game_Event
  128. #==============================================================================
  129.  
  130. class Game_Event < Game_Character
  131.  
  132.   #--------------------------------------------------------------------------
  133.   # overwrite method: near_the_screen?
  134.   #--------------------------------------------------------------------------
  135.   def near_the_screen?(dx = nil, dy = nil)
  136.     dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil?
  137.     dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil?
  138.     ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32
  139.     ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32
  140.     ax >= -dx && ax <= dx && ay >= -dy && ay <= dy
  141.   end
  142.  
  143. end # Game_Event
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement