#==============================================================================
# ★ 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


