#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Artwork Viewer by Blizzard
# Version: 1.2b
# Type: Picture Viewer
# Date: 16.1.2008
# Date v1.2b: 17.1.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# 99% compatible with SDK v1.x. 90% compatible with SDK v2.x. Should be
# compatible with everything else
#
#
# Features:
#
# - shows any pictures as special scene
# - easy to set up and use
# - trigger fullscreen display by pressing ENTER
# - resizes any picture in normal mode to a max size of 320x240 if exceeding
# - lagfree
#
# new in 1.2b:
#
# - add any artwork during the game
# - optionally adds enemy battler files (REQUIRES BLIZZARD'S BESTIARY!)
# - now beta
#
#
# Explanation:
#
# This script will allow you to use an artwork scene which shows pictures.
# The pictures will be displayed sized down and you can trigger fullscreen
# view by pressing ENTER.
#
#
# Configuration:
#
# AUTO_ENEMIES - if you set this to true it will add enemy battlers graphics,
# YOU MUST HAVE BLIZZARD'S BESTIARY INSTALLED TO USE THIS
# PATH - default folder is the Pictures folder (''), add a special
# path if you need it, this doesn't affect enemy battlers
# FILES - add any filenames of the art without extension that are
# available to be viewed initially
# NAMES - add any display names, in same order as filenames that are
# available to be viewed initially
# TITLEFONTNAME - font used for the names display
# TITLEFONTSIZE - font size used for the names display
#
# Set up the configuration below and add your pictures to the folder you
# specified. Call the scene with following syntax:
#
# $scene = Scene_Blakesartwork.new
#
# If you want to add art during the game, simply use following syntax:
#
# $game_system.add_art('FILENAME', 'ARTNAME')
#
#
# Important note:
#
# If you are using the AUTO_ENEMIES option, you need to have Blizzard's
# Bestiary installed, but you don't have to use it.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AUTO_ENEMIES = false
PATH = ''
FILES = ['custom_back3', 'sort1']
NAMES = ['TLoL 4 - CP title', 'Metal-Plate image 1']
TITLEFONTNAME = 'Arial'
TITLEFONTSIZE = 22
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if AUTO_ENEMIES && !$bestiary_enabled
raise 'Artwork Viewer requires Blizzard\'s Bestiary! RMXP will now close'
end
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_reader :artfiles
attr_reader :artnames
def add_art(file, name)
@artfiles = [] if @artfiles == nil
@artnames = [] if @artnames == nil
unless @artfiles.include?(file) || @artfiles.include?(file)
@artfiles.push(file)
@artnames.push(name)
end
end
def artfiles
return (@artfiles == nil ? [] : @artfiles)
end
def artnames
return (@artnames == nil ? [] : @artnames)
end
end
#==============================================================================
# Window_Artwork
#==============================================================================
class Window_Artwork < Window_Base
attr_reader :index
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = TITLEFONTNAME
self.contents.font.size = TITLEFONTSIZE
self.contents.draw_text(0, 416, 608, 32, 'Press ENTER to trigger fullscreen', 1)
@index, @names = 0, []
(NAMES + $game_system.artnames).each {|name| @names.push(PATH + name)}
$game_system.beasts.each {|id| @names.push($data_enemies[id].name)}
refresh
end
def index=(index)
@index = index
refresh
end
def refresh
self.contents.fill_rect(0, 0, 608, 32, Color.new(0, 0, 0, 0))
self.contents.draw_text(32, -3, 564, 32, '<<')
self.contents.draw_text(32, -3, 564, 32, '>>', 2)
self.contents.draw_text(0, 0, 608, 32, @names[@index], 1)
end
end
#==============================================================================
# Scene_Blakesartwork
#==============================================================================
class Scene_Blakesartwork
def initialize
@scene = $scene.class
end
def main
@files, @battlers = [], []
(FILES + $game_system.artfiles).each {|file| @files.push(PATH + file)}
if AUTO_ENEMIES
$game_system.beasts.each {|id|
@battlers.push([$data_enemies[id].battler_name,
$data_enemies[id].battler_hue])}
end
@back_window = Window_Artwork.new
@sprite = Sprite.new
@sprite.x, @sprite.y, @sprite.z = 320, 240, 200
@index, @names = 0, []
setup_sprite
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
[@back_window, @sprite].each {|obj| obj.dispose}
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @back_window.visible
$scene = @scene.new
else
@back_window.visible = true
setup_sprite
end
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@back_window.visible = !@back_window.visible
setup_sprite
elsif Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
size = @files.size + @battlers.size
@back_window.index = (@back_window.index + 1) % size
setup_sprite
elsif Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
size = @files.size + @battlers.size
@back_window.index = (@back_window.index + size - 1) % size
setup_sprite
end
end
def setup_sprite
if @back_window.index < @files.size
@sprite.bitmap = RPG::Cache.picture(@files[@back_window.index])
else
file, hue = @battlers[@back_window.index - @files.size]
@sprite.bitmap = RPG::Cache.battler(file, hue)
end
@sprite.ox, @sprite.oy = @sprite.bitmap.width/2, @sprite.bitmap.height/2
w, h = @sprite.bitmap.width, @sprite.bitmap.height
if @back_window.visible && (w > 320 || h > 240)
@sprite.zoom_x = @sprite.zoom_y = [320.0 / w, 240.0 / h].min
else
@sprite.zoom_x = @sprite.zoom_y = 1.0
end
end
end