#==============================================================================
# Custom Resolution Script v0.82
#------------------------------------------------------------------------------
# Script by BlueScope
#==============================================================================
module Setup
#--------------------------------------------------------------------------
RESOLUTION = [(320).to_f, (240).to_f]
#--------------------------------------------------------------------------
def self.x_value
return RESOLUTION[0] / 640
end
#--------------------------------------------------------------------------
def self.y_value
return RESOLUTION[1] / 480
end
#--------------------------------------------------------------------------
def self.c_value
return ((RESOLUTION[0] / 640) + (RESOLUTION[1] / 480)) / 2
end
#--------------------------------------------------------------------------
def self.h_value
return RESOLUTION[0]
end
#--------------------------------------------------------------------------
def self.v_value
return RESOLUTION[1]
end
#--------------------------------------------------------------------------
def self.variance
return (((RESOLUTION[0] / 640) + (RESOLUTION[1] / 480)) / 2) - 1
end
#--------------------------------------------------------------------------
end
module Resolution
#--------------------------------------------------------------------------
# The following method refers to the resolution changing script and has to
# be placed below Selwyn's resolution script in order to work properly
#--------------------------------------------------------------------------
def self.default
@default_size = size
@set_window_long.call(@window, -16, 0x14000000)
@set_window_pos.call(@window, -1, 0, 0, Setup.h_value, Setup.v_value, 64)
@set_resolution.call(Setup.h_value, Setup.v_value, 4)
@state = "default"
end
#--------------------------------------------------------------------------
end
class Game_Map
#--------------------------------------------------------------------------
# The following method refers to the Tilemap class and has to be placed
# below SephirothSpawn's Tilemap class rewrite in order to work properly
#--------------------------------------------------------------------------
alias resolution_initialize initialize
def initialize
resolution_initialize
@tilemap_tile_width = (32 * Setup.x_value)
@tilemap_tile_height = (32 * Setup.y_value)
end
#--------------------------------------------------------------------------
def scroll_down(distance)
@display_y = [@display_y + distance, (self.height - 15) *
(128 * Setup.y_value)].min
end
#--------------------------------------------------------------------------
def scroll_right(distance)
@display_x = [@display_x + distance, (self.width - 20) *
(128 * Setup.x_value)].min
end
#--------------------------------------------------------------------------
def start_scroll(direction, distance, speed)
@scroll_direction = direction
@scroll_rest = distance * (128 * Setup.c_value)
@scroll_speed = speed
end
#--------------------------------------------------------------------------
end
class Game_Character
#--------------------------------------------------------------------------
alias resolution_initialize initialize
def initialize
resolution_initialize
@move_speed = 4 + (Setup.variance * 2)
end
#--------------------------------------------------------------------------
def moving?
return (@real_x != @x * (128 * Setup.x_value) or
@real_y != @y * (128 * Setup.y_value))
end
#--------------------------------------------------------------------------
def moveto(x, y)
@x = x % $game_map.width
@y = y % $game_map.height
@real_x = @x * (128 * Setup.x_value)
@real_y = @y * (128 * Setup.y_value)
@prelock_direction = 0
end
#--------------------------------------------------------------------------
def screen_x
return (@real_x - $game_map.display_x + 3) / 4 + (16 * Setup.x_value)
end
#--------------------------------------------------------------------------
alias resolution_screen_y screen_y
def screen_y
y = (@real_y - $game_map.display_y + 3) / 4 + (32 * Setup.y_value)
resolution_screen_y
end
#--------------------------------------------------------------------------
def screen_z(height = 0)
if @always_on_top
return 999
end
z = (@real_y - $game_map.display_y + 3) / 4 + (32 * Setup.c_value)
if @tile_id > 0
return z + $game_map.priorities[@tile_id] * (32 * Setup.c_value)
else
return z + ((height > 32) ? 31 : 0)
end
end
#--------------------------------------------------------------------------
alias resolution_update update
def update
resolution_update
if @anime_count > 18 - @move_speed * (2 - (Setup.variance * 2))
if not @step_anime and @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % 4
end
@anime_count = 0
end
end
#--------------------------------------------------------------------------
def update_jump
@jump_count -= 1
@real_x = (@real_x * @jump_count + @x * (128 * Setup.x_value)) /
(@jump_count + 1)
@real_y = (@real_y * @jump_count + @y * (128 * Setup.y_value)) /
(@jump_count + 1)
end
#--------------------------------------------------------------------------
def update_move
distance = 2 ** @move_speed
if @y * (128 * Setup.y_value) > @real_y
@real_y = [@real_y + distance, @y * (128 * Setup.y_value)].min
end
if @x * (128 * Setup.x_value) < @real_x
@real_x = [@real_x - distance, @x * (128 * Setup.x_value)].max
end
if @x * (128 * Setup.x_value) > @real_x
@real_x = [@real_x + distance, @x * (128 * Setup.x_value)].min
end
if @y * (128 * Setup.y_value) < @real_y
@real_y = [@real_y - distance, @y * (128 * Setup.y_value)].max
end
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
#--------------------------------------------------------------------------
end
class Game_Player < Game_Character
#--------------------------------------------------------------------------
CENTER_X = ((320 * Setup.x_value) - 8) * 4
CENTER_Y = ((240 * Setup.y_value) - 8) * 4
#--------------------------------------------------------------------------
def center(x, y)
max_x = ($game_map.width - 20) * (128 * Setup.x_value)
max_y = ($game_map.height - 15) * (128 * Setup.y_value)
$game_map.display_x = [0,
[x * (128 * Setup.x_value) - CENTER_X, max_x].min].max
$game_map.display_y = [0,
[y * (128 * Setup.y_value) - CENTER_Y, max_y].min].max
end
#--------------------------------------------------------------------------
end
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
attr_accessor :character
#--------------------------------------------------------------------------
alias resolution_update update
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id,
@character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch - (32 * Setup.variance)
end
end
resolution_update
end
#--------------------------------------------------------------------------
end
class Spriteset_Map
#--------------------------------------------------------------------------
alias resolution_initialize initialize
def initialize
@viewport1 = Viewport.new(0, 0, Setup.h_value, Setup.v_value)
@viewport2 = Viewport.new(0, 0, Setup.h_value, Setup.v_value)
@viewport3 = Viewport.new(0, 0, Setup.h_value, Setup.v_value)
resolution_initialize
end
#--------------------------------------------------------------------------
end
begin
Resolution.initialize
Resolution.fullscreen
$scene = nil
end