O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

Resolução 640x480 para RMVX

Iniciado por Raizen, 22/02/2013 às 15:04

22/02/2013 às 15:04 Última edição: 22/02/2013 às 15:11 por Raizen
Resolução 640x480 para RMVX

Compativel com: RMVX
Compatibilidade :bom
Facilidade de uso: fácil
Lag gerado: nulo
[box class=titlebg]
Condições de Uso
[/box]
  Não especificado pelo autor

[box class=titlebg]
Para que serve o script
[/box]

  Ele muda o VX para 640x480, e além disso modifica as janelas e tudo mais que for necessário.

[box class=titlebg]
Script.
[/box]

#==============================================================================
# * Resolução 640X480 para VX[resolução XP]
#------------------------------------------------------------------------------
# Résolution 640x480 (pour RPG Maker VX) par Krazplay
# Version 1.0 (23/01/2008)
# Dernière version, commentaires : http://rpgmaker/forum/index.php?topic=12460
#------------------------------------------------------------------------------
# Ce script ne fait pas que changer la résolution, il modifie pas mal de choses
# pour que le jeu soit adapté à sa nouvelle résolution.
# Sachant que ce script redéfinit pas mal de méthodes, il est vivement conseillé
# de le placer au-dessus de vos autres scripts ajoutés (mais en-dessous de ceux
# de base, à part Main évidemment)
#
# Résolution de base  : 544x416 (17x13 cases de 32 pixels)
# Nouvelle résolution : 640x480 (20x15 cases de 32 pixels)
# On gagne donc 96x64 pixels
#------------------------------------------------------------------------------
# Toutes les méthodes modifiées :
#
# ? Game_Map          : calc_parallax_x, calc_parallax_y, setup_scroll,
#                        scroll_down, scroll_right
# ? Game_Player       : center
# ? Sprite_Base       : start_animation
# ? Sprite_Timer      : initialize
# ? Spriteset_Map     : create_viewports
# ? Spriteset_Battle  : create_viewports, create_enemies, create_battleback,
#                        create_battlefloor
# ? Window_Help, Window_SkillStatus, Window_Equip        : initialize
# ? Window_Status, Window_SaveFile, Window_NumberInput   : initialize
# ? Window_ShopBuy, Window_ShopStatus                    : initialize
# ? Window_MenuStatus : initialize, refresh, update_cursor
# ? Window_Message    : initialize, reset_window
# ? Scene_Title       : create_title_graphic, create_command_window
# ? Scene_Menu        : start
# ? Scene_Item        : start, show_target_window, hide_target_window
# ? Scene_Skill       : start, show_target_window, hide_target_window
# ? Scene_Equip       : create_item_windows
# ? Scene_End         : create_command_window
# ? Scene_Shop        : start
# ? Scene_Battle      : create_info_viewport, start_skill_selection,
#                        start_item_selection
#==============================================================================

# Agrandir les images Title.png et BattleFloor.png si elles sont trop petites.
AGRANDIR_IMAGES = true
Graphics.resize_screen(640, 480)

#==============================================================================
# ¦ Game_Objects
#==============================================================================

# ? Game_Map #
class Game_Map
  def calc_parallax_x(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_x
      return @parallax_x / 16
    elsif loop_horizontal?
      return 0
    else
      w1 = bitmap.width - 640
      w2 = @map.width * 32 - 640
      if w1 <= 0 or w2 <= 0
        return 0
      else
        return @parallax_x * w1 / w2 / 8
      end
    end
  end

  def calc_parallax_y(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_y
      return @parallax_y / 16
    elsif loop_vertical?
      return 0
    else
      h1 = bitmap.height - 480
      h2 = @map.height * 32 - 480
      if h1 <= 0 or h2 <= 0
        return 0
      else
        return @parallax_y * h1 / h2 / 8
      end
    end
  end
  
  def setup_scroll
    @scroll_direction = 2
    @scroll_rest = 0
    @scroll_speed = 4
    @margin_x = (width - 20) * 256 / 2      # ? / 2
    @margin_y = (height - 15) * 256 / 2     # ? / 2
  end
  
  def scroll_down(distance)
    if loop_vertical?
      @display_y += distance
      @display_y %= @map.height * 256
      @parallax_y += distance
    else
      last_y = @display_y
      @display_y = [@display_y + distance, (height - 15) * 256].min
      @parallax_y += @display_y - last_y
    end
  end

  def scroll_right(distance)
    if loop_horizontal?
      @display_x += distance
      @display_x %= @map.width * 256
      @parallax_x += distance
    else
      last_x = @display_x
      @display_x = [@display_x + distance, (width - 20) * 256].min
      @parallax_x += @display_x - last_x
    end
  end
end

# ? Game_Player #
class Game_Player < Game_Character
  CENTER_X = (640 / 2 - 16) * 8     # ? X ? * 8
  CENTER_Y = (480 / 2 - 16) * 8     # ? Y ? * 8
  
  def center(x, y)
    display_x = x * 256 - CENTER_X                    # ?
    unless $game_map.loop_horizontal?                 # ?
      max_x = ($game_map.width - 20) * 256            # ?
      display_x = [0, [display_x, max_x].min].max     # ?
    end
    display_y = y * 256 - CENTER_Y                    # ?
    unless $game_map.loop_vertical?                   # ?
      max_y = ($game_map.height - 15) * 256           # ?
      display_y = [0, [display_y, max_y].min].max     # ?
    end
    $game_map.set_display_pos(display_x, display_y)   # ?
  end
end

#==============================================================================
# ¦ Sprites
#==============================================================================

# ? Sprite_Base #
class Sprite_Base < Sprite
  def start_animation(animation, mirror = false)
    dispose_animation
    @animation = animation
    return if @animation == nil
    @animation_mirror = mirror
    @animation_duration = @animation.frame_max * 4 + 1
    load_animation_bitmap
    @animation_sprites = []
    if @animation.position != 3 or not @@animations.include?(animation)
      if @use_sprite
        for i in 0..15
          sprite = ::Sprite.new(viewport)
          sprite.visible = false
          @animation_sprites.push(sprite)
        end
        unless @@animations.include?(animation)
          @@animations.push(animation)
        end
      end
    end
    if @animation.position == 3
      if viewport == nil
        @animation_ox = 640 / 2
        @animation_oy = 480 / 2
      else
        @animation_ox = viewport.rect.width / 2
        @animation_oy = viewport.rect.height / 2
      end
    else
      @animation_ox = x - ox + width / 2
      @animation_oy = y - oy + height / 2
      if @animation.position == 0
        @animation_oy -= height / 2
      elsif @animation.position == 2
        @animation_oy += height / 2
      end
    end
  end
end

# ? Sprite_Timer #
class Sprite_Timer < Sprite
  def initialize(viewport)
    super(viewport)
    self.bitmap = Bitmap.new(88, 48)
    self.bitmap.font.name = "Arial"
    self.bitmap.font.size = 32
    self.x = 640 - self.bitmap.width
    self.y = 0
    self.z = 200
    update
  end
end

# ? Spriteset_Map #
class Spriteset_Map
  def create_viewports
    @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport2 = Viewport.new(0, 0, 640, 480)
    @viewport3 = Viewport.new(0, 0, 640, 480)
    @viewport2.z = 50
    @viewport3.z = 100
  end
end

# ? Spriteset_Battle #
class Spriteset_Battle
  def create_viewports
    @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport2 = Viewport.new(0, 0, 640, 480)
    @viewport3 = Viewport.new(0, 0, 640, 480)
    @viewport2.z = 50
    @viewport3.z = 100
  end
  
  def create_enemies
    @enemy_sprites = []
    for enemy in $game_troop.members.reverse
      enemy.screen_x += 48  # Recentrage des ennemis
      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
    end
  end

  def create_battleback
    source = $game_temp.background_bitmap
    bitmap = Bitmap.new(640+96, 480+64)
    bitmap.stretch_blt(bitmap.rect, source, source.rect)
    bitmap.radial_blur(90, 12)
    @battleback_sprite = Sprite.new(@viewport1)
    @battleback_sprite.bitmap = bitmap
    @battleback_sprite.ox = 320+48
    @battleback_sprite.oy = 240+32
    @battleback_sprite.x = 320 #272
    @battleback_sprite.y = 208 #176
    @battleback_sprite.wave_amp = 8
    @battleback_sprite.wave_length = 240
    @battleback_sprite.wave_speed = 120
  end

  def create_battlefloor
    @battlefloor_sprite = Sprite.new(@viewport1)
    battle_floor = Cache.system("BattleFloor")
    if AGRANDIR_IMAGES and battle_floor.width < 640
      rect_dest = Rect.new(0, 0, 640, battle_floor.height)
      new_bitmap = Bitmap.new(640, battle_floor.height)
      new_bitmap.stretch_blt(rect_dest, battle_floor, battle_floor.rect)
      @battlefloor_sprite.bitmap = new_bitmap
    else
      @battlefloor_sprite.bitmap = battle_floor
    end
    @battlefloor_sprite.x = 0
    @battlefloor_sprite.y = 192
    @battlefloor_sprite.z = 1
    @battlefloor_sprite.opacity = 128
  end
end

#==============================================================================
# ¦ Windows
#==============================================================================

# ? Window_Help #
class Window_Help < Window_Base
  def initialize
    super(0, 0, 640, WLH + 32)
  end
end

# ? Window_MenuStatus #
class Window_MenuStatus < Window_Selectable
  def initialize(x, y)
    super(x, y, 480, 480)
    refresh
    self.active = false
    self.index = -1
  end
  
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    for actor in $game_party.members
      draw_actor_face(actor, 2, actor.index * (96+21) + 2, 92)
      x = 104
      y = actor.index * (96+21) + WLH / 2
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 120, y)
      draw_actor_level(actor, x, y + WLH * 1)
      draw_actor_state(actor, x, y + WLH * 2)
      draw_actor_hp(actor, x + 120, y + WLH * 1, 216)
      draw_actor_mp(actor, x + 120, y + WLH * 2, 216)
    end
  end
  
  def update_cursor
    if @index < 0               # ?
      self.cursor_rect.empty
    elsif @index < @item_max    # ?
      self.cursor_rect.set(0, @index * (96+21), contents.width, 96)
    elsif @index >= 100         # ?
      self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
    else                        # ?
      self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
    end
  end
end

# ? Window_SkillStatus #
class Window_SkillStatus < Window_Base
  def initialize(x, y, actor)
    super(x, y, 640, WLH + 32)
    @actor = actor
    refresh
  end
end

# ? Window_Equip #
class Window_Equip < Window_Selectable
  def initialize(x, y, actor)
    super(x, y, 336+96, WLH * 5 + 32)
    @actor = actor
    refresh
    self.index = 0
  end
end

# ? Window_Status #
class Window_Status < Window_Base
  def initialize(actor)
    super(0, 0, 640, 480)
    @actor = actor
    refresh
  end
end

# ? Window_SaveFile #
class Window_SaveFile < Window_Base
  def initialize(file_index, filename)
    super(0, 56 + file_index % 4 * (90+21), 640, 90)
    @file_index = file_index
    @filename = filename
    load_gamedata
    refresh
    @selected = false
  end
end

# ? Window_NumberInput #
class Window_NumberInput < Window_Base
  def initialize
    super(0, 0, 640, 64)
    @number = 0
    @digits_max = 6
    @index = 0
    self.opacity = 0
    self.active = false
    self.z += 9999
    refresh
    update_cursor
  end
end

# ? Window_ShopBuy #
class Window_ShopBuy < Window_Selectable
  def initialize(x, y)
    super(x, y, 304+96, 304+64)
    @shop_goods = $game_temp.shop_goods
    refresh
    self.index = 0
  end
end

# ? Window_ShopStatus #
class Window_ShopStatus < Window_Base
  def initialize(x, y)
    super(x, y, 240, 304+64)
    @item = nil
    refresh
  end
end

# ? Window_Message #
class Window_Message < Window_Selectable
  def initialize
    super(0, 352, 640, 128)
    self.z = 200
    self.active = false
    self.index = -1
    self.openness = 0
    @opening = false            # ?
    @closing = false            # ?
    @text = nil                 # ?
    @contents_x = 0             # ? X ?
    @contents_y = 0             # ? Y ?
    @line_count = 0             # ?
    @wait_count = 0             # ?
    @background = 0             # ?
    @position = 2               # ?
    @show_fast = false          # ?
    @line_show_fast = false     # ?
    @pause_skip = false         # ?
    create_gold_window
    create_number_input_window
    create_back_sprite
  end
  
  def reset_window
    @background = $game_message.background
    @position = $game_message.position
    if @background == 0   # ?
      self.opacity = 255
    else                  # ?
      self.opacity = 0
    end
    case @position
    when 0  # ?
      self.y = 0
      @gold_window.y = 360
    when 1  # ?
      self.y = 208
      @gold_window.y = 0
    when 2  # ?
      self.y = 352
      @gold_window.y = 0
    end
  end
end

#==============================================================================
# ¦ Scenes
#==============================================================================

# ? Scene_Title #
class Scene_Title
  def create_title_graphic
    @sprite = Sprite.new
    cache_bitmap = Cache.system("Title")
    if AGRANDIR_IMAGES
      dest_rect = Rect.new(0, 0, Graphics.width, Graphics.height)
      bitmap = Bitmap.new(Graphics.width, Graphics.height)
      bitmap.stretch_blt(dest_rect, cache_bitmap, cache_bitmap.rect) 
      @sprite.bitmap = bitmap
    else
      @sprite.bitmap = cache_bitmap
    end
  end
  
  def create_command_window
    s1 = Vocab::new_game
    s2 = Vocab::continue
    s3 = Vocab::shutdown
    @command_window = Window_Command.new(172, [s1, s2, s3])
    @command_window.x = (640 - @command_window.width) / 2
    @command_window.y = 288
    if @continue_enabled                    # ?
      @command_window.index = 1             # ?
    else                                    # ?
      @command_window.draw_item(1, false)   # ?
    end
    @command_window.openness = 0
    @command_window.open
  end
end

# ? Scene_Menu #
class Scene_Menu < Scene_Base
  def start
    super
    create_menu_background
    create_command_window
    @gold_window = Window_Gold.new(0, 424)
    @status_window = Window_MenuStatus.new(160, 0)
  end
end

# ? Scene_Item #
class Scene_Item < Scene_Base
  def start
    super
    create_menu_background
    @viewport = Viewport.new(0, 0, 640, 480)
    @help_window = Window_Help.new
    @help_window.viewport = @viewport
    @item_window = Window_Item.new(0, 56, 640, 424)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.active = false
    @target_window = Window_MenuStatus.new(0, 0)
    hide_target_window
  end
  
  def show_target_window(right)
    @item_window.active = false
    width_remain = 640 - @target_window.width
    @target_window.x = right ? width_remain : 0
    @target_window.visible = true
    @target_window.active = true
    if right
      @viewport.rect.set(0, 0, width_remain, 480)
      @viewport.ox = 0
    else
      @viewport.rect.set(@target_window.width, 0, width_remain, 480)
      @viewport.ox = @target_window.width
    end
  end
  
  def hide_target_window
    @item_window.active = true
    @target_window.visible = false
    @target_window.active = false
    @viewport.rect.set(0, 0, 640, 480)
    @viewport.ox = 0
  end
end

# ? Scene_Skill #
class Scene_Skill < Scene_Base
  def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @viewport = Viewport.new(0, 0, 640, 480)
    @help_window = Window_Help.new
    @help_window.viewport = @viewport
    @status_window = Window_SkillStatus.new(0, 56, @actor)
    @status_window.viewport = @viewport
    @skill_window = Window_Skill.new(0, 112, 640, 368, @actor)
    @skill_window.viewport = @viewport
    @skill_window.help_window = @help_window
    @target_window = Window_MenuStatus.new(0, 0)
    hide_target_window
  end
  
  def show_target_window(right)
    @skill_window.active = false
    width_remain = 640 - @target_window.width
    @target_window.x = right ? width_remain : 0
    @target_window.visible = true
    @target_window.active = true
    if right
      @viewport.rect.set(0, 0, width_remain, 480)
      @viewport.ox = 0
    else
      @viewport.rect.set(@target_window.width, 0, width_remain, 480)
      @viewport.ox = @target_window.width
    end
  end
  
  def hide_target_window
    @skill_window.active = true
    @target_window.visible = false
    @target_window.active = false
    @viewport.rect.set(0, 0, 640, 480)
    @viewport.ox = 0
  end
end

# ? Scene_Equip #
class Scene_Equip < Scene_Base
  def create_item_windows
    @item_windows = []
    for i in 0...EQUIP_TYPE_MAX
      @item_windows[i] = Window_EquipItem.new(0, 208, 640, 272, @actor, i)
      @item_windows[i].help_window = @help_window
      @item_windows[i].visible = (@equip_index == i)
      @item_windows[i].active = false
      @item_windows[i].index = -1
    end
  end
end

# ? Scene_End #
class Scene_End < Scene_Base
  def create_command_window
    s1 = Vocab::to_title
    s2 = Vocab::shutdown
    s3 = Vocab::cancel
    @command_window = Window_Command.new(172, [s1, s2, s3])
    @command_window.x = (640 - @command_window.width) / 2
    @command_window.y = (480 - @command_window.height) / 2
    @command_window.openness = 0
  end
end

# ? Scene_Shop #
class Scene_Shop < Scene_Base
  def start
    super
    create_menu_background
    create_command_window
    @help_window = Window_Help.new
    @gold_window = Window_Gold.new(384+96, 56)
    @dummy_window = Window_Base.new(0, 112, 640, 368)
    @buy_window = Window_ShopBuy.new(0, 112)
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window
    @sell_window = Window_ShopSell.new(0, 112, 640, 368)
    @sell_window.active = false
    @sell_window.visible = false
    @sell_window.help_window = @help_window
    @number_window = Window_ShopNumber.new(0, 112)
    @number_window.active = false
    @number_window.visible = false
    @status_window = Window_ShopStatus.new(400, 112)
    @status_window.visible = false
  end
end

# ? Scene_Battle #
class Scene_Battle < Scene_Base
  def create_info_viewport
    @info_viewport = Viewport.new(0, 288+64, 640, 128)
    @info_viewport.z = 100
    @status_window = Window_BattleStatus.new
    @party_command_window = Window_PartyCommand.new
    @actor_command_window = Window_ActorCommand.new
    @status_window.viewport = @info_viewport
    @party_command_window.viewport = @info_viewport
    @actor_command_window.viewport = @info_viewport
    @status_window.x = 128
    @actor_command_window.x = 544
    @info_viewport.visible = false
  end
  
  def start_skill_selection
    @help_window = Window_Help.new
    @skill_window = Window_Skill.new(0, 56, 640, 296, @active_battler)
    @skill_window.help_window = @help_window
    @actor_command_window.active = false
  end
  
  def start_item_selection
    @help_window = Window_Help.new
    @item_window = Window_Item.new(0, 56, 640, 296)
    @item_window.help_window = @help_window
    @actor_command_window.active = false
  end
end


[box class=titlebg]
Imagens
[/box]

Não perceptível por imagens

[box class=titlebg]
Download
[/box]

Não necessário

[box class=titlebg]
Créditos e Avisos
[/box]

Krazplay