=begin
================================================================================
Title: Unlimited Resolution
Date: Jun 6, 2014
--------------------------------------------------------------------------------
** Change log
Nov 12, 2025
- Timofey Rusanov: adapted script with overcoming the 640x480 limitation to
make support of non 32 multipile resolutions with borrowed part of Gabz's
code. Updated Esrever's code with borrowed Yanfly's code. Combined
Esrever's code with code from wltr3565 to make bottom of the maps not to
show up some upmost part of the maps. Made right side of the maps not to
show up some leftmost part of the maps with changing part of the code from
wltr3565. Borrowed Yanfly's codes for determining the distance of the
events to the player relative to the center of the screen and for making
battlers centred on the screen. Made blurry battle background dependable
on user's resolution. Made Game Over screen centered. Updated FenixFyre's
Plane code with latest version (1.3.5) of script. Made camera always
centered with custom resolutions.
Jun 6, 2014
- Kaelan: fixed several bugs in the Plane class which prevented the sprite
from being modified correctly. Patched for compatibility with Victor's
Fogs and Overlays script. Include this after his script.
Apr 20, 2014
- added Kaelan's suggestion for disposing the viewport when done with it
Nov 6, 2013
- added some plane modifications to fix parallax images
Oct 24, 2013
- Initial release
--------------------------------------------------------------------------------
** Terms of Use
* Free
--------------------------------------------------------------------------------
** Description
This script modifies Graphics.resize_screen to overcome the 640x480 limitation.
It also includes some code to properly display maps that are smaller than the
screen size.
Now you can have arbitrarily large game resolutions.
--------------------------------------------------------------------------------
** Installation
You should place this script above all custom scripts
--------------------------------------------------------------------------------
** Usage
As usual, simply resize your screen using the script call
Graphics.resize_screen(width, height)
--------------------------------------------------------------------------------
** Credits
Unknown author, for overcoming the 640x480 limitation
Lantier (from RMW forums), for posting the snippet above
Esrever, for handling the viewport (borrowed from Yanfly's script)
Jet, for the custom Graphics code
FenixFyre, for the Plane class fix
Kaelan, for several bug fixes
Tsukihime (known as Hime formerly), for gathering various scripts and fixes
wltr3565, for map scroll glitch fix
Gabz, for some fix from overcoming the 640x480 limitation script
Timofey Rusanov, for updating some old scripts, gathering and combining other
ones and making edit on some scripts.
Yanfly, for their part of Core Engine Ace script
================================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_UnlimitedResolution"] = true
#===============================================================================
# ** Configuration
#===============================================================================
class << SceneManager
alias resolution_run run
def run(*args, &block)
Graphics.ensure_sprite
resolution_run(*args, &block)
end
end
module Graphics
@@super_sprite = Sprite.new
@@super_sprite.z = (2 ** (0.size * 8 - 2) - 1)
class << self
alias :th_large_screen_resize_screen :resize_screen
def freeze(*args, &block)
@@super_sprite.bitmap = snap_to_bitmap
end
def transition(time = 10, filename = nil, vague = nil)
if filename
@@super_sprite.bitmap = Bitmap.new(filename)
end
@@super_sprite.opacity = 255
incs = 255.0 / time
time.times do |i|
@@super_sprite.opacity = 255.0 - incs * i
Graphics.wait(1)
end
@@super_sprite.bitmap.dispose if @@super_sprite.bitmap
reform_sprite_bitmap
Graphics.brightness = 255
end
def reform_sprite_bitmap
@@super_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@@super_sprite.bitmap.fill_rect(@@super_sprite.bitmap.rect, Color.new(0, 0, 0, 255))
end
def fadeout(frames)
incs = 255.0 / frames
frames.times do |i|
i += 1
Graphics.brightness = 255 - incs * i
Graphics.wait(1)
end
end
def fadein(frames)
incs = 255.0 / frames
frames.times do |i|
Graphics.brightness = incs * i
Graphics.wait(1)
end
end
def brightness=(i)
@@super_sprite.opacity = 255.0 - i
end
def brightness
255 - @@super_sprite.opacity
end
def ensure_sprite
if @@super_sprite.disposed?
@@super_sprite = Sprite.new
@@super_sprite.z = (2 ** (0.size * 8 - 2) - 1)
reform_sprite_bitmap
end
end
end
#-----------------------------------------------------------------------------
# Unknown Scripter. Copied from http://pastebin.com/sM2MNJZj
#-----------------------------------------------------------------------------
def self.resize_screen(width, height)
wt, ht = width.divmod(32), height.divmod(32)
#wt.last + ht.last == 0 || fail('Incorrect width or height')
wh = -> w, h, off = 0 { [w + off, h + off].pack('l2').scan /.{4}/ }
w, h = wh.(width, height)
ww, hh = wh.(width, height, 32)
www, hhh = wh.(wt.first.succ, ht.first.succ, 1)
base = 0x10000000 # fixed?
mod = -> adr, val { DL::CPtr.new(base + adr)[0, val.size] = val }
mod.(0x195F, "\x90" * 5) # ???
mod.(0x19A4, h)
mod.(0x19A9, w)
mod.(0x1A56, h)
mod.(0x1A5B, w)
mod.(0x20F6, w)
mod.(0x20FF, w)
mod.(0x2106, h)
mod.(0x210F, h)
# speed up y?
#mod.(0x1C5E3, h)
#mod.(0x1C5E8, w)
zero = [0].pack ?l
mod.(0x1C5E3, zero)
mod.(0x1C5E8, zero)
mod.(0x1F477, h)
mod.(0x1F47C, w)
mod.(0x211FF, hh)
mod.(0x21204, ww)
mod.(0x21D7D, hhh[0])
mod.(0x21E01, www[0])
#mod.(0x10DEA8, h)
#mod.(0x10DEAD, w)
mod.(0x10DEDF, h)
mod.(0x10DEF0, w)
mod.(0x10DF14, h)
mod.(0x10DF18, w)
mod.(0x10DF48, h)
mod.(0x10DF4C, w)
#mod.(0x10E6A7, w)
#mod.(0x10E6C3, h)
mod.(0x10EEA9, w)
mod.(0x10EEB9, h)
th_large_screen_resize_screen(width, height)
end
end
#===============================================================================
# Esrever's code from
# http://www.rpgmakervxace.net/topic/100-any-chance-of-higher-resolution-or-larger-sprite-support/page-2#entry7997
#===============================================================================
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# overwrite method: scroll_down
#--------------------------------------------------------------------------
def scroll_down(distance)
last_y = @display_y
if loop_vertical?
@display_y += distance
@display_y %= @map.height * 256
@parallax_y += distance if @parallax_loop_y
else
dh = Graphics.height > height * 32 ? height : screen_tile_y + Graphics.height % 32 * 1.0 / 32
@display_y = [@display_y + distance, height - dh].min
@parallax_y += @display_y - last_y
end
@fog_y += loop_vertical? ? distance : @display_y - last_y if @fog_y
end
#--------------------------------------------------------------------------
# overwrite method: scroll_right
#--------------------------------------------------------------------------
def scroll_right(distance)
last_x = @display_x
if loop_horizontal?
@display_x += distance
@display_x %= @map.width * 256
@parallax_x += distance if @parallax_loop_x
else
dw = Graphics.width > width * 32 ? width : screen_tile_x + Graphics.width % 32 * 1.0 / 32
@display_x = [@display_x + distance, width - dw].min
@parallax_x += @display_x - last_x
end
@fog_x += loop_horizontal? ? distance : @display_x - last_x if @fog_x
end
#--------------------------------------------------------------------------
# overwrite method: set_display_pos
#--------------------------------------------------------------------------
def set_display_pos(x, y)
x = [0, [x, width - screen_tile_x].min].max unless loop_horizontal?
y = [0, [y, height - screen_tile_y].min].max unless loop_vertical?
@display_x = (x + width) % width
@display_y = (y + height) % height
@display_x = (x + width) % width - (Graphics.width % 32 * 1.0 / 32) if @display_x >= @map.width - 12
@display_y = (y + height) % height - (Graphics.height % 32 * 1.0 / 32) if @display_y >= @map.height - 12
@parallax_x = x
@parallax_y = y
end
end # Game_Map
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# overwrite method: create_viewports
#--------------------------------------------------------------------------
def create_viewports
if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
dx = (Graphics.width - $game_map.width * 32) / 2
else
dx = 0
end
dw = [Graphics.width, $game_map.width * 32].min
dw = Graphics.width if $game_map.loop_horizontal?
if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
dy = (Graphics.height - $game_map.height * 32) / 2
else
dy = 0
end
dh = [Graphics.height, $game_map.height * 32].min
dh = Graphics.height if $game_map.loop_vertical?
@viewport1 = Viewport.new(dx, dy, dw, dh)
@viewport2 = Viewport.new(dx, dy, dw, dh)
@viewport3 = Viewport.new(dx, dy, dw, dh)
@viewport2.z = 50
@viewport3.z = 100
end
#--------------------------------------------------------------------------
# new method: update_viewport_sizes
#--------------------------------------------------------------------------
def update_viewport_sizes
if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
dx = (Graphics.width - $game_map.width * 32) / 2
else
dx = 0
end
dw = [Graphics.width, $game_map.width * 32].min
dw = Graphics.width if $game_map.loop_horizontal?
if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
dy = (Graphics.height - $game_map.height * 32) / 2
else
dy = 0
end
dh = [Graphics.height, $game_map.height * 32].min
dh = Graphics.height if $game_map.loop_vertical?
rect = Rect.new(dx, dy, dw, dh)
for viewport in [@viewport1, @viewport2, @viewport3]
viewport.rect = rect
end
end
end # Spriteset_Map
#-------------------------------------------------------------------------------
# FenixFyre's custom Plane, simply drawing a sprite. It's an updated version
# that have no problems with parallaxes in custom resolutions.
#-------------------------------------------------------------------------------
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# To remove any artifacts / conflicts with the original, we alias it then remove
# the original tie.
RGSS3Plane = Plane
Object.send(:remove_const, :Plane)
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Rect#to_a
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Rect
def to_a
[self.x, self.y, self.width, self.height]
end
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Bitmap
# Saves a bitmap's name, for future reference.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Bitmap
alias fyx_initialize_save_name initialize
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# initialize
# Instantiate a bitmap's name, if given one.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def initialize(*argv, &argb)
@name = ''
if name = argv.find {|arg| arg.is_a?(String) }
@name = name
end
fyx_initialize_save_name(*argv, &argb)
end
attr_reader :name
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Cache
# Add in Plane caching, to speed up processing at the slight cost of memory.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
module Cache
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Cache::plane_cache
# Convenience method, to not have to type it out in the below methods.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def self.plane_cache
@plane_cache ||= {}
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Cache::plane
# Get a cached plane bitmap.
# key : Object ( most likely an Array e.g. [Rect, String] )
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def self.plane(key)
return plane_cache[key]
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Cache::add_plane
# Add a tiled plane bitmap to the cache.
# key : Object ( see above )
# bmp : Bitmap
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def self.add_plane(key, bmp)
plane_cache[key] = bmp
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Cache::has_plane?
# Check for a cached plane bitmap.
# key : Object ( see above )
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def self.has_plane?(key)
plane_cache[key].is_a?(Bitmap) && !plane_cache[key].disposed?
end
class << self; alias clear_b4_fyx_plane_cache clear; end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Cache::clear
# See original documentation.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def self.clear
plane_cache.each_value {|v| v.dispose unless v.nil? || v.disposed? }
plane_cache.clear
clear_b4_fyx_plane_cache
end
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Plane
# Tiles a bitmap across either the window rect, or a given viewport's rect.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Plane
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# initialize
# Setup an allocated instance of Plane.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def initialize(v = nil)
@sprite = Sprite.new(v)
@bitmap = nil
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# dispose
# Free an instance of Plane.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def dispose
@sprite.bitmap.dispose unless bitmap_disposed?
@sprite.dispose unless disposed?
return nil
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# bitmap_disposed?
# Check whether this instance of Plane's bitmap has been freed.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def bitmap_disposed?
disposed? || @sprite.bitmap.nil? || @sprite.bitmap.disposed?
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# disposed?
# Check whether this instance of Plane has been freed.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def disposed?
@sprite.nil? || @sprite.disposed?
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ox=
# Set the offset x of this instance of Plane.
# val : Integer
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def ox=(val)
error_disposed if disposed?
return if bitmap_disposed?
@sprite.ox = (val % (@bitmap.nil? ? 1 : @bitmap.width))
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# oy=
# Set the offset y of this instance of Plane.
# val : Integer
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def oy=(val)
error_disposed if disposed?
return if bitmap_disposed?
@sprite.oy = (val % (@bitmap.nil? ? 1 : @bitmap.height))
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# bitmap
# Get the tile bitmap of this instance of Plane.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def bitmap
@bitmap
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# viewport=
# Set the viewport, and refresh if the vrect has changed.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def viewport=(v)
error_disposed if disposed?
r = v.nil? ? Rect.new(0, 0, Graphics.width, Graphics.height) : v.rect
b = r != vrect
ret = @sprite.viewport = v
self.bitmap = @bitmap if b
return ret
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# bitmap=
# Set the tile bitmap of this instance of Plane.
# bmp : Bitmap
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def bitmap=(bmp)
error_disposed if disposed?
if bmp.nil?
@sprite.bitmap = nil
return @bitmap = nil
end
w, h = vrect.width, vrect.height
nw = bmp.width <= 100 ? 2 : 3
nh = bmp.height <= 100 ? 2 : 3
dx = [(w / bmp.width).ceil, 1].max * nw
dy = [(h / bmp.height).ceil, 1].max * nh
bw = dx * bmp.width
bh = dy * bmp.height
@bitmap = bmp
key = [vrect.to_a, bmp.name]
if Cache.has_plane?(key)
@sprite.bitmap = Cache.plane(key)
else
@sprite.bitmap = Bitmap.new(bw, bh)
dx.times do |x|
dy.times do |y|
@sprite.bitmap.blt(x * bmp.width, y * bmp.height, @bitmap, @bitmap.rect)
end
end
Cache.add_plane(key, @sprite.bitmap)
end
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# method_missing
# Here we let any methods not found in this class be redirected to our
# underlying sprite.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def method_missing(sym, *argv, &argb)
if @sprite.respond_to?(sym)
error_disposed if disposed?
return @sprite.send(sym, *argv, &argb)
end
super(sym, *argv, &argb)
end
# private methods from here down
private
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# error_disposed
# If this plane (and it's underlying sprite) has been freed, then throw an
# RGSSError describing a disposed Plane.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def error_disposed
raise RGSSError, 'disposed Plane', caller
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# vrect
# Get the view rect of this instance of Plane, which depends on if the
# viewport has been set or not.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
def vrect
@sprite.viewport.nil? ? Rect.new(0, 0, Graphics.width, Graphics.height) :
@sprite.viewport.rect
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# alias method: post_transfer
#--------------------------------------------------------------------------
alias scene_map_post_transfer_ace post_transfer
def post_transfer
@spriteset.update_viewport_sizes
scene_map_post_transfer_ace
end
end # Scene_Map
#-------------------------------------------------------------------------------
# Some Yanfly's codes
#-------------------------------------------------------------------------------
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# overwrite method: near_the_screen?
#--------------------------------------------------------------------------
def near_the_screen?(dx = nil, dy = nil)
dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil?
dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil?
ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32
ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32
ax >= -dx && ax <= dx && ay >= -dy && ay <= dy
end
end # Game_Event
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# overwrite method: setup
#--------------------------------------------------------------------------
def setup(troop_id)
clear
@troop_id = troop_id
@enemies = []
troop.members.each do |member|
next unless $data_enemies[member.enemy_id]
enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
enemy.hide if member.hidden
enemy.screen_x = member.x + (Graphics.width - 544)/2
enemy.screen_y = member.y + (Graphics.height - 416)
@enemies.push(enemy)
end
init_screen_tone
make_unique_names
end
end # Game_Troop
#==============================================================================
# ** CHANGED Game_Player
#------------------------------------------------------------------------------
# This one's making camera centred in any screen resolution.
#==============================================================================
class Game_Player < Game_Character
def center_x
(Graphics.width / 2 - 16) / 32.0
end
def center_y
(Graphics.height / 2 - 16) / 32.0
end
end
#==============================================================================
# ** CHANGED Spriteset_Battle
#------------------------------------------------------------------------------
# This one's making blurry background for any screen resolution.
#==============================================================================
class Spriteset_Battle
def create_blurry_background_bitmap
source = SceneManager.background_bitmap
bitmap = Bitmap.new(Graphics.width, Graphics.height)
bitmap.stretch_blt(bitmap.rect, source, source.rect)
bitmap.radial_blur(120, 16)
bitmap
end
end
#==============================================================================
# ** CHANGED Scene_Gameover
#------------------------------------------------------------------------------
# This is for higher resolutions.
#==============================================================================
class Scene_Gameover < Scene_Base
def create_background
@sprite = Sprite.new
@sprite.bitmap = Cache.system("GameOver")
center_sprite(@sprite)
end
def center_sprite(sprite)
sprite.ox = sprite.bitmap.width / 2
sprite.oy = sprite.bitmap.height / 2
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
end
end