#===============================================================================
# 
# Yanfly Engine Melody - Snapshot Battle Back
# Last Date Updated: 2010.04.16
# Level: Easy
# 
# For a quick and easy way of getting a map-related backdrop without that
# cheesy radial blur that RPG Maker VX comes with, why not just use a snapshot
# of whatever map you're currently on instead? This script removes the radial
# blur and throws in a slightly zoomed snapshot of the current map without any
# events hindering it.
# 
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 2010.04.16 - Started and Finished Script.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials but above ▼ Main. Remember to save.
# 
#===============================================================================
# Compatibility
# -----------------------------------------------------------------------------
# - Works With: Anything that doesn't modify battlebacks.
#===============================================================================

$imported = {} if $imported == nil
$imported["SnapshotBattleBack"] = true

module YEM
  module SNAP_BATTLE_BACK
    
    # These two values adjust the width and height of the zoomed in background
    # snapshot. To disallow zooming, just set the values to 544 and 416 or
    # whatever resolution you're using.
    BITMAP_WIDTH  = 640
    BITMAP_HEIGHT = 480
    
    # This is the blur intensity of the snapshot used for the background. Note
    # that placing this at higher values may result in longer loading times.
    BLUR_INTENSITY = 3
    
    # These settings adjust the battlefloor. For those who'd like to either
    # move the battlefloor higher or to change the visibility of it. To make
    # the battlefloor invisible, set FLOOR_O to 0.
    FLOOR_X = 0        # Battle floor X value. Base script default is 0.
    FLOOR_Y = 128      # Battle floor y value. Base script default is 192.
    FLOOR_O = 64       # Battle floor opacity. Base script default is 128.
    
  end # SNAP_BATTLE_BACK
end # YEM

#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================

#===============================================================================
# Spriteset_Battle
#===============================================================================

class Spriteset_Battle

  #--------------------------------------------------------------------------
  # overwrite method: create_battleback
  #--------------------------------------------------------------------------
  def create_battleback
    source = $game_temp.background_bitmap
    width = YEM::SNAP_BATTLE_BACK::BITMAP_WIDTH
    height = YEM::SNAP_BATTLE_BACK::BITMAP_HEIGHT
    #---
    bitmap = Bitmap.new(width, height)
    bitmap.stretch_blt(bitmap.rect, source, source.rect)
    YEM::SNAP_BATTLE_BACK::BLUR_INTENSITY.times do bitmap.blur end
    #---
    @battleback_sprite = Sprite.new(@viewport1)
    @battleback_sprite.bitmap = bitmap
    @battleback_sprite.ox = width/2
    @battleback_sprite.oy = height/2
    @battleback_sprite.x = Graphics.width/2
    @battleback_sprite.y = (Graphics.height-128)/2+64
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: create_battlefloor
  #--------------------------------------------------------------------------
  def create_battlefloor
    @battlefloor_sprite = Sprite.new(@viewport1)
    @battlefloor_sprite.bitmap = Cache.system("BattleFloor")
    @battlefloor_sprite.x = YEM::SNAP_BATTLE_BACK::FLOOR_X
    @battlefloor_sprite.y = YEM::SNAP_BATTLE_BACK::FLOOR_Y
    @battlefloor_sprite.z = 1
    @battlefloor_sprite.opacity = YEM::SNAP_BATTLE_BACK::FLOOR_O
  end
  
end # Spriteset_Battle

#===============================================================================
# 
# END OF FILE
# 
#===============================================================================