Black_Mage icon

Max Resolution Addon RMVXA Script

Black_Mage | PRO | 06/27/19 02:04:54 PM UTC | 0 ⭐ | 7374 👁️ | Never ⏰ | []
Ruby |

5.75 KB

|

None

|

0 👍

/

0 👎

#==============================================================================
# Some stuff to enhance Max Resolution Script. Put this script below it.
# By Black Mage
# Version 1.3
#
# This script required Max Resolution Script to function properly. You can get
# the script at:
# https://pastebin.com/FyLyMzis
#
# You can add Tsukihime's Map Screenshot Script on your project to have a 
# better transition when changing into a higher resolution. The original script
# function will be disabled, but you can turn it on through a setting below if
# you wan to use it. 
# You can ge the script at:
# http://himeworks.com/2013/02/map-screenshot/
# 
# -----------------------------------------------------------------------------
# What this script actualy do?
#
# Well, there's this black bar occupying the window if you change into a higher
# resolution from map. When you access the menu, and back to the map again, the
# black bar is gone, and you can freely change the resolution back and forth
# without have to worry that the black bar will appear, unless you're changing
# into a new higher resolution compared to the last resolution where the black
# bar appeared.
#
# This script run a dummy scene to simulate the menu access in order to fix the
# black bar problem when a higher resolution change is happened.
# -----------------------------------------------------------------------------
# Note that the Max Resolution Script has a memory dependancy. If somehow your
# project crashes when doing a playtest, just do some other stuff and hope that 
# when you playtest and changing resolution again, nothing wrong happened. XD
#
# Don't immediately playtest when a crashes occured!
# -----------------------------------------------------------------------------
# Stuff that's not fixed yet from Max Resolution Script:
# If you're on a big map, and you change resolution from the right corner of 
# the map, your map camera might shot a wrong part of the map for a few seconds, 
# or until you move your character to left for a bit.
#
# I'm not sure when I'll fix this in the future. If you somehow able to fix it,
# let me know.
#==============================================================================
 
#==============================================================================
# Changelog
# Version 1.3
# - Add Hime Map Screenshot integration for a better transition.
#
# Version 1.2
# - Fix some bugs that made it unable to change resolution through other scene
#   except Scene_Map.
#
# Version 1.1
# - Add Game_Temp initialize, in case the resolution is changed when it's not 
#   initialized yet.
#
# Version 1.0
# - Initial Version.
#==============================================================================
 
module BLACK
  # Set this to true if you have Hime Map Screenshot script on your project and 
  # want to use it's original feature on your game.
  HIME_MAPSHOT = false
end
 
$imported = {} if $imported.nil?
$imported["BM_MaxResoAddon"] = true
 
class Game_Temp; attr_accessor :b_size; end
 
module Graphics
  class << self; alias :b_r_s :resize_screen; end
  attr_reader :b_width; attr_reader :b_height
  def self.resize_screen(width, height)
    if SceneManager.scene_is?(Scene_Map)
      (save_w_h(width, height); return) if (!@b_width && !@b_height)
      (save_w_h(width, height); return) if (@b_width < width) && (@b_height < height)
    end
    b_r_s(width, height)
  end
  def self.save_w_h(width, height)
    $game_temp = Game_Temp.new if !$game_temp
    $game_temp.b_size = [width, height]
    SceneManager.call(Black_Scene)
    Window_MenuCommand::init_command_position
    @b_width = width; @b_height = height
  end
end
 
class Black_Scene < Scene_MenuBase
  def update
    super; a = $game_temp.b_size
    Graphics.resize_screen(a[0], a[1])
    SceneManager.return
  end
  def create_background
    @background_sprite = Sprite.new
    @background_sprite.bitmap = SceneManager.reso_bmp
    
    # Hime Mapshot integration
    if $imported["TH_MapSaver"]
      w, h = [Graphics.width, Graphics.height]
      m_s1 = [($game_map.width * 32) - w, ($game_map.height * 32) - h]
      m_s2 = [$game_player.x * 32 - w/2 + 16, $game_player.y * 32 - h/2 + 32]
      error = [w/2 - $game_player.screen_x, h/2 - $game_player.screen_y]
      m_s2 = [m_s2[0] + error[0], m_s2[1] + error[1]]
      cor = [[[m_s2[0], 0].max, m_s1[0]].min, [[m_s2[1], 0].max, m_s1[1]].min]
      @background_sprite.x = -cor[0]
      @background_sprite.y = -cor[1]
    end
    
  end
end
 
module SceneManager
  @reso_bmp = nil
  class << self; alias :black_s_f_b :snapshot_for_background; end
  def self.snapshot_for_background
    black_s_f_b
    @reso_bmp.dispose if @reso_bmp
    
    # Hime Mapshot integration
    if $imported["TH_MapSaver"] && $game_map.map_id != 0
      s = Map_Saver.new($game_map.map_id)
      s.set_scale(TH::Map_Saver::Mapshot_Scale)        
      @reso_bmp = s.blackshot
    else
      @reso_bmp = Graphics.snap_to_bitmap
    end
    
  end
  def self.reso_bmp; @reso_bmp; end
end
 
if $imported["TH_MapSaver"] && BLACK::HIME_MAPSHOT
#==============================================================================
# This will disable Tsukihime's Map Screenshot Script from triggering, as we 
# don't want it to do so.
#==============================================================================
class Game_Player < Game_Character; def update; th_mapsaver_update; end; end
end
 
if $imported["TH_MapSaver"]
#==============================================================================
# New function for Hime Map_Saver
#==============================================================================
class Map_Saver
  def blackshot; @screen_local = false; redraw; return @map_image; end
end
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎