#==============================================================================
# ★ ExBattle_Background
#------------------------------------------------------------------------------
#   在战斗画面显示背景
#==============================================================================

# 地图的战斗画面
# 地图ID对应文件名称
EXBTL_BACKGR_MAP = {
  1 => "Ocean", 
  2 => "Mountains", 
}

# 区域的战斗画面
# 区域的ID对应文件名称
EXBTL_BACKGR_AREA = {
  1 => "Sunset", 
  2 => "CloudySky", 
}

# 背景对齐方式
# (0:靠上 1:居中 2:靠下) ｡｣
EXBTL_BACKGR_POSITION = 1

# 是否显示战场
# (0:隐藏 1:显示)
EXBTL_BACKGR_FLOOR = 0

# 战斗背景文件夹
# 对应图档文件夹的 (Graphic/xxx/) 
# 0:System 1:Parallaxes 2:Pictures
EXBTL_BACKGR_FOLDER = 1

#------------------------------------------------------------------------------

class Spriteset_Battle
  alias _exbbackgr_create_battleback create_battleback
  alias _exbbackgr_create_battlefloor create_battlefloor
  #--------------------------------------------------------------------------
  # ● 生成战斗背景活动块
  #--------------------------------------------------------------------------
  def create_battleback
    fixed = false
    for area in $data_areas.values
      if $game_player.in_area?(area) and EXBTL_BACKGR_AREA.has_key?(area.id)
        source = EXBTL_BACKGR_AREA[area.id]
        fixed = true
      end
    end
    unless fixed
      if EXBTL_BACKGR_MAP.has_key?($game_map.map_id)
        source = EXBTL_BACKGR_MAP[$game_map.map_id]
        fixed = true
      end
    end
    if fixed
      case EXBTL_BACKGR_FOLDER
      when 0
        bitmap = Cache.system(source)
      when 1
        bitmap = Cache.parallax(source)
      when 2
        bitmap = Cache.picture(source)
      end
      @battleback_sprite = Sprite.new(@viewport1)
      @battleback_sprite.bitmap = bitmap
      @battleback_sprite.x = (544 - bitmap.width) / 2
      case EXBTL_BACKGR_POSITION
      when 0
        @battleback_sprite.y = 0
      when 1
        @battleback_sprite.y = (416 - bitmap.height) / 2
      when 2
        @battleback_sprite.y = 416 - bitmap.height
      end
    else
      _exbbackgr_create_battleback
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成战场活动块
  #--------------------------------------------------------------------------
  def create_battlefloor
    _exbbackgr_create_battlefloor
    @battlefloor_sprite.opacity = 0 if EXBTL_BACKGR_FLOOR == 0
  end
end


