Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Resolution Rmxp Script
Rukiri
post May 1 2007, 05:20 PM
Post #1


emerge -avt awesome! Wait... it brings me.... HERE?!
Group Icon

Group: Revolutionary
Posts: 1,723
Type: Scripter
RM Skill: Advanced




I've looked around but can't find one that actually works, I've been to rmxp.org and many places without any luck. I need a custom resolution if possible thanks.


__________________________
Xeilsoft
- Follow your dreams to the very end..

Kits that I'm working on.
[Unity3D 4.0] LTTP/Minish Cap - I don't have time for custom gfx like what the pze folks are doing but I will try and work on some enhanced LTTP graphics.

Main PC
Core i7 3820 overclocked @ 4.8GHZ
Galaxy: Nvidia Geforce GTX 680 GDDR5 2GB
Asrock X79 Extreme9 w' creative sound
64GB corsair platinum @ 1600MHZ
Muchkin 128GB SSD(boot), OZKIN 2TB SSD, Western Digital GREEN 1TB HDD.
Rosewill Lightning 1000W PSU
OS: Funtoo Linux, Windows 8 (Virtual Machine)

iMac (March 2013)
3.4GHz Quad-core Intel Core i7, Turbo Boost up to 3.9GHz
16GB 1600MHz DDR3 SDRAM - 2X8GB
1TB Serial ATA Drive @ 7200 rpm
NVIDIA GeForce GTX 680MX 2GB GDDR5
Go to the top of the page
 
+Quote Post
   
Zero767
post Jul 1 2007, 04:22 PM
Post #2


Level 1
Group Icon

Group: Member
Posts: 5
Type: Event Designer
RM Skill: Advanced




Well, not sure if you still need it but here is one:

CODE
#==============================================================================
# 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.fullscreen
    @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 = "fullscreen"
  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


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 Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  alias resolution_initialize initialize
  def initialize
    resolution_initialize
    self.x = 80 *- Setup.variance
    self.width = 480 *- Setup.variance
    self.height = 160 *- Setup.variance
    self.contents.font.name = 'Verdana'
    self.contents.font.size = Font.default_size * -Setup.variance
  end
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    x = y = 0
    @cursor_width = 0
    if $game_temp.choice_start == 0
      x = 8
    end
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      text.gsub!(/\\\\/) { "\000" }
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      while ((c = text.slice!(/./m)) != nil)
        if c == "\000"
          c = "\\"
        end
        if c == "\001"
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          if color >= 0 and color <= 7
            self.contents.font.color = text_color(color)
          end
          next
        end
        if c == "\002"
          if @gold_window == nil
            @gold_window = Window_Gold.new
            @gold_window.x = (Setup.h_value * 0.875) - @gold_window.width
            if $game_temp.in_battle
              @gold_window.y = (Setup.h_value / 10) * 3
            else
              @gold_window.y = self.y >= (128 * Setup.variance) ?
                (32 * Setup.variance) : (384 * Setup.variance)
            end
            @gold_window.opacity = self.opacity
            @gold_window.back_opacity = self.back_opacity
          end
          next
        end
        if c == "\n"
          if y >= $game_temp.choice_start
            @cursor_width = [@cursor_width, x].max
          end
          y += 1
          x = 0
          if y >= $game_temp.choice_start
            x = 8
          end
          next
        end
        draw_y = (26 *- Setup.variance) * y - (24 *- Setup.variance)
        self.contents.draw_text(4 *- Setup.variance + x, draw_y, 40, 32, c)
        x += self.contents.text_size(c).width
      end
    end
    if $game_temp.choice_max > 0
      @item_max = $game_temp.choice_max
      self.active = true
      self.index = 0
    end
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @input_number_window = Window_InputNumber.new(digits_max)
      @input_number_window.number = number
      @input_number_window.x = self.x + 8
      @input_number_window.y = self.y + $game_temp.num_input_start * 32
    end
  end
  #--------------------------------------------------------------------------
  def reset_window
    if $game_temp.in_battle
      self.y = (16 * Setup.variance)
    else
      case $game_system.message_position
      when 0
        self.y = (16 *- Setup.variance)
      when 1
        self.y = (160 *- Setup.variance)
      when 2
        self.y = (304 *- Setup.variance)
      end
    end
    if $game_system.message_frame == 0
      self.opacity = 255
    else
      self.opacity = 0
    end
    self.back_opacity = 160
  end
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index >= 0
      n = $game_temp.choice_start + @index
      self.cursor_rect.set(8, n * (24 *- Setup.variance), @cursor_width,
        (24 *- Setup.variance))
    else
      self.cursor_rect.empty
    end
  end
  #--------------------------------------------------------------------------
end


begin
  Resolution.initialize
  Resolution.fullscreen
  $scene = nil
end


Sorry if this is a bump.

Edited by Night_Runner, put the code in a spoiler tag
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Jun 7 2010, 06:31 AM
Post #3


Level 50
Group Icon

Group: +Gold Member
Posts: 1,527
Type: Scripter
RM Skill: Undisclosed




Just a little bump here, the resolution script Zero767 posted was incomplete, that was just BlueScope's contribution, the working script used code from Sephiroth Spawn and Selwyn.

The complete version for anyone passing by:

CODE
#==============================================================================
# Tilemap Class
#------------------------------------------------------------------------------
# Script by SephirothSpawn
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  attr_reader   :map
  attr_accessor :tilemap_tone
  attr_accessor :tilemap_plane
  attr_accessor :tilemap_zoom_x
  attr_accessor :tilemap_zoom_y
  attr_accessor :tilemap_tile_width
  attr_accessor :tilemap_tile_height
  #--------------------------------------------------------------------------
  alias seph_tilemap_gmap_init initialize
  def initialize
    seph_tilemap_gmap_init
    @tilemap_tone        = nil
    @tilemap_plane       = false
    @tilemap_zoom_x      = 1.0
    @tilemap_zoom_y      = 1.0
    @tilemap_tile_width  = 32
    @tilemap_tile_height = 32
  end
  #--------------------------------------------------------------------------
end



class Tilemap
  #--------------------------------------------------------------------------
  Animated_Autotiles_Frames = 15
  #--------------------------------------------------------------------------
  Autotiles = [
    [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27,  6, 33, 34], [ 5,  6, 33, 34],
      [27, 28, 33, 12], [ 5, 28, 33, 12], [27,  6, 33, 12], [ 5,  6, 33, 12] ],
    [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27,  6, 11, 34], [ 5,  6, 11, 34],
      [27, 28, 11, 12], [ 5, 28, 11, 12], [27,  6, 11, 12], [ 5,  6, 11, 12] ],
    [ [25, 26, 31, 32], [25,  6, 31, 32], [25, 26, 31, 12], [25,  6, 31, 12],
      [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
    [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
      [39, 40, 45, 46], [ 5, 40, 45, 46], [39,  6, 45, 46], [ 5,  6, 45, 46] ],
    [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
      [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
    [ [37, 38, 43, 44], [37,  6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
      [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1,  2,  7,  8] ]
  ]
  #--------------------------------------------------------------------------
  attr_reader   :layers
  attr_accessor :tileset
  attr_accessor :autotiles
  attr_accessor :map_data
  attr_accessor :flash_data
  attr_accessor :priorities
  attr_accessor :visible
  attr_accessor :ox
  attr_accessor :oy
  #--------------------------------------------------------------------------
  def initialize(viewport, map = $game_map.map)
    @layers = []
    for l in 0...3
      layer = ($game_map.tilemap_plane ?
      Plane.new(viewport) : Sprite.new(viewport))
      layer.bitmap = Bitmap.new(map.width * 32, map.height * 32)
      layer.z = l * 150
      layer.zoom_x = $game_map.tilemap_zoom_x
      layer.zoom_y = $game_map.tilemap_zoom_y
      if (tone = $game_map.tilemap_tone).is_a?(Tone)
        layer.tone = tone
      end
      @layers << layer
    end
    @tileset    = nil  # Refers to Map Tileset Name
    @autotiles  = []   # Refers to Tileset Auto-Tiles (Actual Auto-Tiles)
    @map_data   = nil  # Refers to 3D Array Of Tile Settings
    @flash_data = nil  # Refers to 3D Array of Tile Flashdata
    @priorities = nil  # Refers to Tileset Priorities
    @visible    = true # Refers to Tilest Visibleness
    @ox         = 0    # Bitmap Offsets
    @oy         = 0    # bitmap Offsets
    @data       = nil  # Acts As Refresh Flag
    @map         = map
    @tone        = $game_map.tilemap_tone
    @plane       = $game_map.tilemap_plane
    @zoom_x      = $game_map.tilemap_zoom_x
    @zoom_y      = $game_map.tilemap_zoom_y
    @tile_width  = $game_map.tilemap_tile_width
    @tile_height = $game_map.tilemap_tile_height
  end
  #--------------------------------------------------------------------------
  def dispose
    for layer in @layers
      layer.dispose
    end
  end
  #--------------------------------------------------------------------------
  def update
    unless @data == @map_data && @tile_width == $game_map.tilemap_tile_width &&
           @tile_height == $game_map.tilemap_tile_height
      refresh
    end
    unless @tone == $game_map.tilemap_tone
      @tone = $game_map.tilemap_tone
      @tone = Tone.new(0, 0, 0, 0) if @tone.nil?
      for layer in @layers
        layer.tone = @tone
        layer.tone = @tone
      end
    end
    unless @zoom_x == $game_map.tilemap_zoom_x
      @zoom_x = $game_map.tilemap_zoom_x
      for layer in @layers
        layer.zoom_x = @zoom_x
        layer.zoom_x = @zoom_x
      end
    end
    unless @zoom_y == $game_map.tilemap_zoom_y
      @zoom_y = $game_map.tilemap_zoom_y
      for layer in @layers
        layer.zoom_y = @zoom_y
        layer.zoom_y = @zoom_y
      end
    end
    for layer in @layers
      layer.ox = @ox
      layer.oy = @oy
    end
    if Graphics.frame_count % Animated_Autotiles_Frames == 0
      refresh_autotiles
    end
  end
  #--------------------------------------------------------------------------
  def refresh
    @data = @map_data
    for p in 0..5
      for z in 0...@map_data.zsize
        for x in 0...@map_data.xsize
          for y in 0...@map_data.ysize
            id = @map_data[x, y, z]
            next if id == 0
            next unless p == @priorities[id]
            p = 2 if p > 2
            id < 384 ? draw_autotile(x, y, p, id) : draw_tile(x, y, p, id)
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def refresh_autotiles
    autotile_locations = Table.new(@map_data.xsize, @map_data.ysize,
      @map_data.zsize)
    for p in 0..5
      for z in 0...@map_data.zsize
        for x in 0...@map_data.xsize
          for y in 0...@map_data.ysize
            id = @map_data[x, y, z]
            next if id == 0
            next unless p == @priorities[id]
            p = 2 if p > 2
            if id < 384
              next unless @autotiles[id / 48 - 1].width / 96 > 1
              draw_autotile(x, y, p, id)
              autotile_locations[x, y, z] = 1
            else
              if autotile_locations[x, y, z] == 1
                draw_tile(x, y, p, id)
              end
            end
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def draw_tile(x, y, z, id)
    rect = Rect.new((id - 384) % 8 * 32, (id - 384) / 8 * 32, 32, 32)
    x *= @tile_width
    y *= @tile_height
    if @tile_width == 32 && @tile_height == 32
      @layers[z].bitmap.blt(x, y, @tileset, rect)
    else
      dest_rect = Rect.new(x, y, @tile_width, @tile_height)
      @layers[z].bitmap.stretch_blt(dest_rect, @tileset, rect)
    end
  end
  #--------------------------------------------------------------------------
  def draw_autotile(x, y, z, tile_id)
    autotile = @autotiles[tile_id / 48 - 1]
    tile_id %= 48
    bitmap = Bitmap.new(32, 32)
    tiles = Autotiles[tile_id / 8][tile_id % 8]
    frames = autotile.width / 96
    anim = (Graphics.frame_count / Animated_Autotiles_Frames) % frames * 96
    for i in 0...4
      tile_position = tiles[i] - 1
      src_rect = Rect.new(tile_position % 6 * 16 + anim,
        tile_position / 6 * 16, 16, 16)
      bitmap.blt(i % 2 * 16, i / 2 * 16, autotile, src_rect)
    end
    x *= @tile_width
    y *= @tile_height
    if @tile_width == 32 && @tile_height == 32
      @layers[z].bitmap.blt(x, y, bitmap, Rect.new(0, 0, 32, 32))
    else
      dest_rect = Rect.new(x, y, @tile_width, @tile_height)
      @layers[z].bitmap.stretch_blt(dest_rect, bitmap, Rect.new(0, 0, 32, 32))
    end
  end
  #--------------------------------------------------------------------------
  def bitmap
    bitmap = Bitmap.new(@layers[0].bitmap.width, @layers[0].bitmap.height)
    for layer in @layers
      bitmap.blt(0, 0, layer.bitmap, Rect.new(0, 0,
        bitmap.width, bitmap.height))
    end
    return bitmap
  end
  #--------------------------------------------------------------------------
end



#==============================================================================
# Resolution Script
#------------------------------------------------------------------------------
# Script by Selwyn
#==============================================================================

module Resolution
  #--------------------------------------------------------------------------
  attr_reader :state
  #--------------------------------------------------------------------------
  def initialize
    title = "\0" * 256
    Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L').call("Game", "Title", "", title, 256, ".\\Game.ini")
    title.delete!("\0")
    @set_resolution  = Win32API.new('Display.dll', 'SetResolution', 'III', 'I')
    @set_window_long = Win32API.new('user32', 'SetWindowLong', 'LIL', 'L')
    @set_window_pos  = Win32API.new('user32', 'SetWindowPos', 'LLIIIII', 'I')
    @gsm             = Win32API.new('user32', 'GetSystemMetrics', 'I', 'I')
    @gcr             = Win32API.new('user32', 'GetClientRect', 'LP', 'I')
    @kbe             = Win32API.new('user32', 'keybd_event', 'LLLL', '')
    @gaks            = Win32API.new('user32', 'GetAsyncKeyState', 'L', 'I')
    @window = Win32API.new('user32', 'FindWindow', 'PP', 'I').call("RGSS Player", title)
    @default_size = size
    #if size[0] < 800 or size[1] < 600
    #  print("A minimum screen resolution of [800 by 600] is required in order to play #{title}")
    #  exit
    #end
    @state = "default"
    self.default
  end
  #--------------------------------------------------------------------------
  def fullscreen
    @default_size = size
    @set_window_long.call(@window, -16, 0x14000000)
    @set_window_pos.call(@window, -1, 0, 0, 802, 602, 64)
    @set_resolution.call(800, 600, 4)
    @state = "fullscreen"
  end
  #--------------------------------------------------------------------------
  def default
    x = @default_size[0] / 2 - 403
    y = @default_size[1] / 2 - 316
    @set_window_long.call(@window, -16, 0x14CA0000)
    @set_window_pos.call(@window, 0, x, y, 808, 627, 0)
    @set_resolution.call(@default_size[0], @default_size[1], 0)
    @state = "default"
  end
  #--------------------------------------------------------------------------
  def trigger?(key)
    return @gaks.call(key) & 0x01 == 1
  end
  #--------------------------------------------------------------------------
  private :fullscreen
  private :default
  private :trigger?
  #--------------------------------------------------------------------------
  def size
    width = @gsm.call(0)
    height = @gsm.call(1)
    return width, height
  end
  #--------------------------------------------------------------------------
  def change
    if @state == "default"
      self.fullscreen
    else
      self.default
    end
  end
  #--------------------------------------------------------------------------
  def update
    if trigger?(121)
      self.default
      exit
    end
    if Input.trigger?(Input::ALT) or Input.press?(Input::ALT)
      @kbe.call(18, 0, 2, 0)
    end
  end
  #--------------------------------------------------------------------------
  module_function :initialize
  module_function :fullscreen
  module_function :default
  module_function :trigger?
  module_function :size
  module_function :change
  module_function :update
  #--------------------------------------------------------------------------
end



#==============================================================================
# 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.fullscreen
    @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 = "fullscreen"
  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
CODE
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


class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  alias resolution_initialize initialize
  def initialize
    resolution_initialize
    self.x = 80 *- Setup.variance
    self.width = 480 *- Setup.variance
    self.height = 160 *- Setup.variance
    self.contents.font.name = 'Verdana'
    self.contents.font.size = Font.default_size * -Setup.variance
  end
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    x = y = 0
    @cursor_width = 0
    if $game_temp.choice_start == 0
      x = 8
    end
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      text.gsub!(/\\\\/) { "\000" }
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      while ((c = text.slice!(/./m)) != nil)
        if c == "\000"
          c = "\\"
        end
        if c == "\001"
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          if color >= 0 and color <= 7
            self.contents.font.color = text_color(color)
          end
          next
        end
        if c == "\002"
          if @gold_window == nil
            @gold_window = Window_Gold.new
            @gold_window.x = (Setup.h_value * 0.875) - @gold_window.width
            if $game_temp.in_battle
              @gold_window.y = (Setup.h_value / 10) * 3
            else
              @gold_window.y = self.y >= (128 * Setup.variance) ?
                (32 * Setup.variance) : (384 * Setup.variance)
            end
            @gold_window.opacity = self.opacity
            @gold_window.back_opacity = self.back_opacity
          end
          next
        end
        if c == "\n"
          if y >= $game_temp.choice_start
            @cursor_width = [@cursor_width, x].max
          end
          y += 1
          x = 0
          if y >= $game_temp.choice_start
            x = 8
          end
          next
        end
        draw_y = (26 *- Setup.variance) * y - (24 *- Setup.variance)
        self.contents.draw_text(4 *- Setup.variance + x, draw_y, 40, 32, c)
        x += self.contents.text_size(c).width
      end
    end
    if $game_temp.choice_max > 0
      @item_max = $game_temp.choice_max
      self.active = true
      self.index = 0
    end
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @input_number_window = Window_InputNumber.new(digits_max)
      @input_number_window.number = number
      @input_number_window.x = self.x + 8
      @input_number_window.y = self.y + $game_temp.num_input_start * 32
    end
  end
  #--------------------------------------------------------------------------
  def reset_window
    if $game_temp.in_battle
      self.y = (16 * Setup.variance)
    else
      case $game_system.message_position
      when 0
        self.y = (16 *- Setup.variance)
      when 1
        self.y = (160 *- Setup.variance)
      when 2
        self.y = (304 *- Setup.variance)
      end
    end
    if $game_system.message_frame == 0
      self.opacity = 255
    else
      self.opacity = 0
    end
    self.back_opacity = 160
  end
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index >= 0
      n = $game_temp.choice_start + @index
      self.cursor_rect.set(8, n * (24 *- Setup.variance), @cursor_width,
        (24 *- Setup.variance))
    else
      self.cursor_rect.empty
    end
  end
  #--------------------------------------------------------------------------
end


begin
  Resolution.initialize
  Resolution.fullscreen
  $scene = nil
end




#==============================================================================
# Custom Resolution Script Tool - Scene_Title
#------------------------------------------------------------------------------
# Script by BlueScope
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  def main
    if $BTEST
      battle_test
      return
    end
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    @sprite.zoom_x = Setup.x_value
    @sprite.zoom_y = Setup.y_value
    s1 = "New Game"
    s2 = "Continue"
    s3 = "Shutdown"
    @command_window = Window_Command.new(192, [s1, s2, s3])
    @command_window.back_opacity = 255 # 160 // Changed for Demo
    @command_window.x = (320 * Setup.x_value) - @command_window.width / 2
    @command_window.y = (240 * Setup.y_value) - @command_window.height / 2
    @continue_enabled = false
    for i in 0..3
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end
    end
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.disable_item(1)
    end
    $game_system.bgm_play($data_system.title_bgm)
    Audio.me_stop
    Audio.bgs_stop
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      Resolution.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @sprite.bitmap.dispose
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
end


And needs Display.dll to be placed in the same folder as your game.exe is in (so if you open up your game, and select Game >> Open Game Folder, and put this in that folder Attached File  Display.txt ( 15.73K ) Number of downloads: 203
.... I really wish that worked, oh well, I can't upload dll's, so I've renamed it to Display.txt, download it, and change the name to Display.dll.
If the .txt doesn't show up on your computer, open a folder and select Tools >> Folder Options (Windows 7 users will need to press alt to find the Tools), second tab is View, and untick Hide extensions for known file types)


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 02:52 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker