#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ System Options [RMXP]
# ■ Author: Bigace360
# ■ Version: 1.00
# ■ Date: Aug 16, 2012
# ■ Blog: http://bigaceworld.wordpress.com/
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# VERSION HISTORY #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# 8.16.2012 (v1.00) - Original script completed
# 8.17.2012 (v1.01) - Fixed line break issue in help window.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# INTRODUCTION #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# The "End Game" option is possibly the most useless function in RPG Maker XP
# games. Not only does it have little functionality but its functions can be
# reproduced by Alt+F4 and F12. This script replaces "End Game" with a new menu
# altogether and giving the player some familiar options seen in many of
# today's commercial RPG's such as changing window skins, adjust sound volume,
# turning off animations during battle, and the like.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# FEATURES #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ** Makes Scene_End not useless
# ** Allows the player to adjust the setting in the game.
# ** Has a Default feature to restore everything.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# INSTRUCTIONS #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# To install this script, open up your script editor and copy/paste this script
# to an open slot below Scene_Debug, and ACE Menu System but above Main.
# Remember to save.
#
# -----------------------------------------------------------------------------
# Script Calls - These commands are used with script calls.
# -----------------------------------------------------------------------------
# $game_system.volume_change(:bgm, x)
# $game_system.volume_change(:bgs, x)
# $game_system.volume_change(:sfx, x)
# ~ Use the script call to change the bgm, bgs, or sfx sound rate by
# x increment. Use a negative value to lower the volume.
#
# $game_system.set_autodash(true)
# $game_system.set_autodash(false)
# ~Turns autodash on (true) or off (false).
#
# $game_system.set_full_screen(true)
# $game_system.set_full_screen(false)
# ~Turns Full Screen on (true) or off (false).
#
#-------------------------------------------------------------------------------
#
# 1. Scroll down, adjust the various Variable values to something empty or
# predetermined.
# 2. Go to the Windowskin folder in your project's "Graphics" folder to insert
# the window skins you want to use there and adjust the WINDOW_HASH
# accordingly. Do the same with the Battle Music by going to your BGM folder
# in your project's Audio folder and then adjust the MUSIC_HASH in the module.
# 3. To Restore all back to default press [CTRL + ALT]
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# SECTIONS #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Game_Objects
# ** ACE Module
# ** Object
# ** Bitmap
# ** Game_System
#
# ■ Windows
# ** Window
# ** Window_Base
# ** Window_Option_Help
# ** Window_SaveFile
# ** Window_Font
# ** Window_Skins
# ** Window_BattleMusic
# ** Window_SystemOptions
#
# ■ Scenes
# ** Scene_Base
# ** Scene_End
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Credits/Thanks:
# - Bigace360, for the script.
# - ForeverZer0, for fixing the line break issue.
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Script Conflicts and Compatability #
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# - Requires Scene_Base
# - Overwrites: All of Scene_End. Expect no functionality with any scripts that
# will also replace Scene_End.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Module ACE::SYSTEM
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module ACE
#=============================================================================
# ▼ Warning DO NOT TOUCH THIS MODULE, altering this will ruin any chances of
# any script that requires this engine to run.
#
# For Configurations go to Module STATUS_SYSTEM below this one.
#=============================================================================
module CORE
def self.required_script(name, req, version, type = 0)
if type != :bellow && (!$ace_script[req] || $ace_script[req] < version)
msg = "The script '%s' requires the script\n"
case type
when :above then msg += "'%s' v%s or higher above it to work properly\n"
else msg += "'%s' v%s or higher to work properly\n"
end
msg += "Go to http://bigaceworld.wordpress.com/ to download this script."
self.exit_message(msg, name, req, version)
elsif type == :bellow && $ace_script[req]
msg = "The script '%s' requires the script\n"
msg += "'%s' to be put bellow it\n"
msg += "move the scripts to the proper position"
self.exit_message(msg, name, req, version)
end
end
def self.exit_message(message, name, req, version)
name = self.script_name(name)
req = self.script_name(req)
msgbox(sprintf(message, name, req, version))
exit
end
def self.script_name(name, ext = "System Base")
name = name.to_s.gsub("_", " ").upcase.split
name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
name.join(" ")
end
end
#=============================================================================
# ▼ BEGIN CONFIGURATIONS HERE BELOW
#=============================================================================
module SYSTEM
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Setting -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These are the general settings that govern the System settings.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Where in the command window?
MENU_INDEX = 5
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Backgrounds {can be found in the Menu/Background folder}
BACKGROUND2 = 'back04'
END_FX = 0 # Back FX (0=Moving/ 1=Still/ 2=Map)
END_TRAN_TIME = 10 # Transition Time.
END_TRAN_TYPE = '004-Blind04' # Transition Type (Name)
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Command Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust the commands shown in the command list. Add, remove
# or rearrange the commands as you see fit. Here's a list of which commands
# do what:
#
# -------------------------------------------------------------------------
# :command Description
# -------------------------------------------------------------------------
# :blank, - Blank Item.
# :default - Returns the option menu to its default settings
#
# :volume_bgm, - Adjusts BGM volume.
# :volume_bgs, - Adjusts BGS volume.
# :volume_sfx, - Adjusts SFX volume.
# :battle_bgm, - Change battle bgm name
# :windowskin, - Changes the windowskin.
# :font_name, - Change the font name
# :full_screen, - Do you want the game in full screen?
# :return_menu, - Return back to the menu screen.
# :return_title, - Return back to the title screen.
# :shutdown, - Shuts down the game.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COMMANDS =[# Do not remove this line.
:default, # Do you wish to restore settings?
:windowskin, # Changes the windowskin.
:font_name, # Change the font name
:battle_bgm, # Changes battle bgm name
:blank,
:volume_bgm, # Changes the BGM volume used.
:volume_bgs, # Changes the BGS volume used.
:volume_sfx, # Changes the SFX volume used.
:blank,
:full_screen, # Do you want the game in full screen?
:return_menu, # Return back to the menu screen.
:return_title, # Return back to the title screen.
:shutdown, # Shuts down the game.
] # Do not remove this.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Vocab Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This hash adjusts the vocab used for both the commands and the help
# description that appears above the command window. Note that for the
# command help descriptions, you may use text codes. Use \n to linebreak.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COMMAND_VOCAB ={
# -------------------------------------------------------------------------
# :command => [Command Name, Option1, Option2
# Help Window Description,
# ], # Do not remove this.
# -------------------------------------------------------------------------
:blank => ["", "None", "None",
""
], # Do not remove this.
# ------------------------------------------------------------------------
:windowskin => ["Windowskin", 21, "None", # Options 1 is a Variable.
"Changes the windowskin used for the game."
], # Do not remove this.
# ------------------------------------------------------------------------
:battle_bgm => ["Battle Music", 22, "None", # Options 1 is a Variable.
"Change the music played during battle"
], # Do not remove this.
# ------------------------------------------------------------------------
:volume_bgm => ["BGM Volume", Color.new(62,154,222), Color.new(153,204,255),
"Change the volume used for background music. \n" +
"Hold SHIFT to change increment by 10."
], # Do not remove this.
# ------------------------------------------------------------------------
:volume_bgs => ["BGS Volume", Color.new(160,152,255), Color.new(204,192,255),
"Change the volume used for background sound.\n" +
"Hold SHIFT to change increment by 10."
], # Do not remove this.
# ------------------------------------------------------------------------
:volume_sfx => ["SFX Volume", Color.new(255,204,32), Color.new(255,255,160),
"Change the volume used for sound effects.\n" +
"Hold SHIFT to change increment by 10."
], # Do not remove this.
# ------------------------------------------------------------------------
:font_name => ["Font Name", 23, "None", # Options 1 is a Variable.
"Change the font type name used in the game."
], # Do not remove this.
# ------------------------------------------------------------------------
:full_screen => ["Full Screen", "640x480", "Full",
"Switch to full screen?"
], # Do not remove this.
# ------------------------------------------------------------------------
:return_menu => ["Return to Main Menu", "None", "None",
"Do you wish to return back to the main menu?"
], # Do not remove this.
# ------------------------------------------------------------------------
:return_title => ["Return to Title Screen", "None", "None",
"Do you wish to go back to the title screen?"
], # Do not remove this.
# ------------------------------------------------------------------------
:shutdown => ["Shutdown Game", "None", "None",
"Do you wish to turns off the game?"
], # Do not remove this.
# ------------------------------------------------------------------------
:default => ["Default", "None", "None",
"Do you wish to restore the settings to default?"
], # Do not remove this.
# ------------------------------------------------------------------------
} # Do not remove this.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Window Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The following adjusts the window skins used for your game. Match the
# Window skins with the names accordingly. Within the windowskin hash,
# the following settings are adjusted as such:
# File - File Name
# Name - As it appears in the game
# Back - Back Opacity (0-255)
# Border - Border Opacity (0-255)
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
DEFAULT_SKIN_VALUE = 1
WINDOW_HASH ={
# Window ID => [ File, Name, Back, Border],
1 => ['001-Blue01', 'Blue', 200, 255],
} # Do not remove this.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Battle Music Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The following changes the battle music used in your game. Match the Song
# with the names accordingly. Within the battle music hash, the following
# settings are adjusted as such:
# File - File Name
# Name - As it appears in the game
# Pitch - Sets the pitch for sound playback
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
DEFAULT_MUSIC_VAULE = 1
BATTLE_HASH ={
# Music ID => [ File , Name, Pitch],
1 => ['001-Battle01', 'Battle Music 1', 80],
2 => ['002-Battle02', 'Battle Music 2', 80],
3 => ['003-Battle03', 'Battle Music 3', 80],
4 => ['004-Battle04', 'Battle Music 4', 80],
5 => ['005-Boss01', 'Boss Music 1', 80],
6 => ['006-Boss02', 'Boss Music 2', 80],
7 => ['007-Boss03', 'Boss Music 3', 80],
8 => ['008-Boss04', 'Boss Music 4', 80],
} # Do not remove this.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Font Names -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
DEFAULT_FONT_VAULE = 4
FONT_HASH = {
1 => 'Courier New',
2 => 'Times New Roman',
3 => 'Verdana',
4 => 'Arial',
5 => 'Myriad Pro',
6 => 'Mistral',
7 => 'Arial Black',
8 => 'Georgia',
9 => 'Comic Sans MS',
10 => 'Tahoma',
11 => 'Bookman Old Style',
12 => 'Papyrus',
} # Do not remove this.
end
end
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
$ace_script ||= {}
$ace_script[:ace_system_menu] = 1.00
ACE::SYSTEM::WINDOWSKIN_VARIABLE = ACE::SYSTEM::COMMAND_VOCAB[:windowskin][1]
ACE::SYSTEM::MUSIC_VARIABLE = ACE::SYSTEM::COMMAND_VOCAB[:battle_bgm][1]
ACE::SYSTEM::FONT_VARIABLE = ACE::SYSTEM::COMMAND_VOCAB[:font_name][1]
class Object; include ACE::SYSTEM; end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Bitmap
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Bitmap
def clear_rect(*args)
color = Color.new(0, 0, 0, 0)
args << color
fill_rect(*args)
end
#--------------------------------------------------------------------------
def gradient_fill_rect(*args)
if args[0].is_a?(Rect)
x, y, width, height = args[0].x,
args[0].y,
args[0].width,
args[0].height
color1 = args[1].dup
color2 = args[2]
vertical = args[3]
else
x, y, width, height = args[0..3]
color1 = args[4].dup
color2 = args[5]
vertical = args[6]
end
dr, dg, db, da = color2.red - color1.red,
color2.green - color1.green,
color2.blue - color1.blue,
color2.alpha - color1.alpha
start_rgba = [color1.red, color1.green, color1.blue, color1.alpha]
if vertical
dr, dg, db, da = dr / height, dg / height, db / height, da / height
(y...(y + height)).each do |i|
fill_rect(x, i, width, 1, color1)
start_rgba[0] = [start_rgba[0] + dr, 0].max
start_rgba[1] = [start_rgba[1] + dg, 0].max
start_rgba[2] = [start_rgba[2] + db, 0].max
start_rgba[3] = [start_rgba[3] + da, 0].max
color1.set(*start_rgba)
end
else
dr, dg, db, da = dr / width, dg / width, db / width, da / width
(x...(x + width)).each do |i|
fill_rect(i, y, 1, height, color1)
start_rgba[0] = [start_rgba[0] + dr, 0].max
start_rgba[1] = [start_rgba[1] + dg, 0].max
start_rgba[2] = [start_rgba[2] + db, 0].max
start_rgba[3] = [start_rgba[3] + da, 0].max
color1.set(*start_rgba)
end
end
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Game_System
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_System
attr_accessor :bar_style, :fullscreen, :autodash
attr_reader :bar_opacity
GetSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'l' , 'l') # EDIT #
alias :ace_initialize :initialize
def initialize(*args, &block)
ace_initialize(*args, &block) # Call Original Method
init_volume_control
init_gradient_style
init_bar_opacity
init_full_screen
init_autodash
end
#---------------------------------------------------------------
def init_volume_control
@volume = {}
@volume[:bgm] = 100
@volume[:bgs] = 100
@volume[:sfx] = 100
end
def volume(type)
init_volume_control if @volume.nil?
return [[@volume[type], 0].max, 100].min
end
def volume_change(type, increment)
init_volume_control if @volume.nil?
@volume[type] += increment
@volume[type] = [[@volume[type], 0].max, 100].min
end
#---------------------------------------------------------------
def init_gradient_style
@bar_style = 6
end
def bar_style?
init_gradient_style if @bar_style.nil?
return [[@bar_style, 1].max, 8].min
end
def set_bar_style(value)
init_gradient_style if @bar_style.nil?
@bar_style += value
@bar_style = [[@bar_style, 1].max, 8].min
end
#---------------------------------------------------------------
def init_bar_opacity
@bar_opacity = 255
end
def opacity
init_bar_opacity if @bar_opacity.nil?
return [[@bar_opacity, 0].max, 255].min
end
def opacity_change(increment)
init_bar_opacity if @bar_opacity.nil?
@bar_opacity += increment
@bar_opacity = [[@bar_opacity, 0].max, 255].min
end
#---------------------------------------------------------------
def init_full_screen
@fullscreen = false
end
def full_screen? # EDIT #
#init_full_screen if @fullscreen.nil?
if @called_set.nil?
w,h = GetSystemMetrics.call(0),GetSystemMetrics.call(1)
@fullscreen = (w == 640 && h == 480)
end
@called_set = nil
return @fullscreen
end
def set_full_screen(value) # EDIT #
@fullscreen = value
@called_set = 1
end
def call_screen_mode
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(18,0,0,0)
$showm.call(13,0,0,0)
$showm.call(13,0,2,0)
$showm.call(18,0,2,0)
end
#---------------------------------------------------------------
def init_autodash
@autodash = false
end
def autodash?
init_autodash if @autodash.nil?
return @autodash
end
def set_autodash(value)
@autodash = value
end
#---------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if !bgm.nil? && bgm.name != ""
volume = bgm.volume * $game_system.volume(:bgm) / 100
Audio.bgm_play("Audio/BGM/" + bgm.name, volume, bgm.pitch)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
def bgs_play(bgs)
@playing_bgs = bgs
if !bgs.nil? && bgs.name != ""
volume = bgs.volume * $game_system.volume(:bgs) / 100
Audio.bgs_play("Audio/BGS/" + bgs.name, volume, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
def me_play(me)
if !me.nil? && me.name != ""
volume = me.volume * $game_system.volume(:bgm) / 100
Audio.me_play("Audio/ME/" + me.name, volume, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
def se_play(se)
if !se.nil? && se.name != ""
volume = se.volume * $game_system.volume(:sfx) / 100
Audio.se_play("Audio/SE/" + se.name, volume, se.pitch)
end
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window
def update_windowskin
return if $game_variables.nil?
variable1 = WINDOWSKIN_VARIABLE
if $game_variables[variable1] == 0
$game_variables[variable1] = DEFAULT_SKIN_VALUE
elsif !WINDOW_HASH.include?($game_variables[variable1])
$game_variables[variable1] = DEFAULT_SKIN_VALUE
end
window = WINDOW_HASH[$game_variables[variable1]]
change_window_settings(window)
end
def change_window_settings(window)
self.windowskin = RPG::Cache.windowskin(window[0])
self.back_opacity = window[2]
self.opacity = window[3]
end
def update_font
self.contents = Bitmap.new(width - 32, height - 32)
return if $game_variables.nil?
variable2 = FONT_VARIABLE
if $game_variables[variable2] == 0
$game_variables[variable2] = DEFAULT_FONT_VAULE
elsif !FONT_HASH.include?($game_variables[variable2])
$game_variables[variable2] = DEFAULT_FONT_VAULE
end
font = FONT_HASH[$game_variables[variable2]]
change_font_settings(font)
end
def change_font_settings(new_font)
self.contents.font.bold = Font.default_bold
self.contents.font.italic = Font.default_italic
self.contents.font.size = Font.default_size
self.contents.font.name = Font.default_name = new_font
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Base
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Base < Window
alias initialize_window_ace initialize unless $@
def initialize(x, y, width, height)
initialize_window_ace(x, y, width, height)
self.update_windowskin
self.update_font
end
def gauge_back_color; return Color.new(32, 32, 64); end
def line_height; return 32; end
unless $ace_script[:ace_warrior_module]
def draw_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
gauge_y = y + line_height
contents.fill_rect(x, gauge_y, width, 10, gauge_back_color)
contents.gradient_fill_rect(x, gauge_y+2, fill_w, 6, color1, color2)
end
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Option_Help
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Option_Help < Window_Help
alias :multiline_set_text :set_text
def set_text(text, align = 0)
if text != nil
lines = text.split("\n")
if lines.size <= 1
multiline_set_text(text, align)
elsif @text != text || @align != align
self.contents.dispose
self.contents = Bitmap.new(self.width - 32, lines.size * 32)
lines.each_index do |i|
self.contents.draw_text(4, i*32, self.contents.width, 32, lines[i], align)
end
@text, @align, @actor = text, align, nil
end
self.visible = true
end
end
end
#===============================================================================
# Window_SaveFile
#===============================================================================
class Window_SaveFile < Window_Base
alias refresh_savefile_ace refresh unless $@
def refresh
if @file_exist
w = @game_variables[WINDOWSKIN_VARIABLE]
w = DEFAULT_SKIN_VALUE if w == 0 || !WINDOW_HASH.include?(w)
f = @game_variables[FONT_VARIABLE]
f = DEFAULT_FONT_VAULE if f == 0 || !FONT_HASH.include?(f)
window = WINDOW_HASH[w]
font = FONT_HASH[f]
change_window_settings(window)
change_font_settings(font)
end
refresh_savefile_ace
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_BattleMusic
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_BattleMusic < Window_Selectable
def initialize(dh)
super(160, 64, 320, dh)
@column_max = 1
self.index = 0
self.z = 999
self.back_opacity = 255
self.visible = false
self.active = false
refresh
end
def refresh
self.contents.dispose if self.contents != nil
self.contents = nil if self.contents != nil
@data = []
variable = $game_variables[MUSIC_VARIABLE]
hash = BATTLE_HASH.sort{|a,b| a[0] <=> b[0]}
hash.each do |key|
@data.push(key[0])
self.index = key[0] - 1 if key[0] == $game_variables[variable]
end
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32) if @item_max > 0
@item_max.times {|i| draw_item(i)} if @item_max > 0
end
def draw_item(index)
x = index % @column_max * (288)
y = index / @column_max * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.clear_rect(rect)
self.contents.draw_text(rect, BATTLE_HASH[@data[index]][1], 1)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Font
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Font < Window_Selectable
def initialize(dh)
super(160, 64, 320, dh)
@column_max = 1
self.index = 0
self.z = 999
self.back_opacity = 255
self.visible = self.active = false
refresh
end
def refresh
self.contents.dispose if self.contents != nil
self.contents = nil if self.contents != nil
@data = []
variable = $game_variables[FONT_VARIABLE]
hash = FONT_HASH.sort{|a,b| a[0] <=> b[0]}
hash.each do |key|
@data << key[0]
self.index = key[0] - 1 if key[0] == $game_variables[variable]
end
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32) if @item_max > 0
@item_max.times {|i| draw_item(i)} if @item_max > 0
end
def draw_item(index)
x = index % @column_max * (288)
y = index / @column_max * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.clear_rect(rect)
self.contents.draw_text(rect, FONT_HASH[@data[index]], 1)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Skins
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Skins < Window_Selectable
def initialize(dh)
super(160, 64, 320, dh)
@column_max = 1
self.index = 0
self.z = 999
self.back_opacity = 255
self.visible = false
self.active = false
refresh
end
def refresh
self.contents.dispose if self.contents != nil
self.contents = nil if self.contents != nil
@data = []
variable = $game_variables[WINDOWSKIN_VARIABLE]
hash = WINDOW_HASH.sort{|a,b| a[0] <=> b[0]}
hash.each do |key|
@data.push(key[0])
self.index = key[0] - 1 if key[0] == $game_variables[variable]
end
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32) if @item_max > 0
@item_max.times {|i| draw_item(i)} if @item_max > 0
end
def draw_item(index)
x = index % @column_max * (288)
y = index / @column_max * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.clear_rect(rect)
self.contents.draw_text(rect, WINDOW_HASH[@data[index]][1], 1)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_SystemOptions
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_SystemOptions < Window_Selectable
attr_reader :full_screen_index # EDIT #
def initialize(help_window)
super(0, help_window.height, 640, 480 - help_window.height)
@column_max = 1
self.index = 0
self.active = true
refresh
@help_window = help_window
end
def item; return @data[@index]; end
def refresh # EDIT #
self.contents.dispose unless self.contents.nil?
self.contents = nil unless self.contents.nil?
@data = []
COMMANDS.each do |command|
case command
when :blank, :volume_bgm, :volume_bgs, :volume_sfx, :windowskin,
:bar_style, :bar_opacity, :full_screen, :auto_dash, :default,
:return_title, :return_menu, :shutdown
end
if command == :full_screen
@full_screen_index = @data.size
end
@data << command
end
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32) if @item_max > 0
@item_max.times {|i| draw_item(i)} if @item_max > 0
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + 32) / @column_max - 32
rect.height = 32
rect.x = index % @column_max * (rect.width + 32)
rect.y = index / @column_max * 32
return rect
end
def draw_item(index)
item = @data[index]
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
dx = 4
dy = 32 * index
dw = self.width - 32 - 8
case item
when :blank
when :volume_bgm, :volume_bgs, :volume_sfx then draw_volume(item, dx, dy, dw)
when :windowskin, :battle_bgm, :font_name then draw_window(item, dx, dy, dw)
when :bar_style then draw_bar(item, dx, dy, dw)
when :bar_opacity then draw_bar_opacity(item, dx, dy, dw)
when :full_screen, :auto_dash then draw_toggle(item, dx, dy, dw)
when :return_title, :return_menu, :shutdown, :default
draw_return(item, dx, dy, dw)
end
end
def draw_volume(item, dx, dy, dw)
self.contents.draw_text(dx, dy, dw/2, line_height, COMMAND_VOCAB[item][0], 1)
case item
when :volume_bgm then rate = $game_system.volume(:bgm)
when :volume_bgs then rate = $game_system.volume(:bgs)
when :volume_sfx then rate = $game_system.volume(:sfx)
end
colour1 = COMMAND_VOCAB[item][1]
colour2 = COMMAND_VOCAB[item][2]
value = sprintf("%d%%", rate)
rate *= 0.01
draw_gauge(dw/2, dy-14, 280, rate, colour1, colour2)
contents.draw_text(dw/2, dy, 280, line_height, value, 2)
end
def draw_window(item, dx, dy, dw)
self.contents.draw_text(dx, dy, dw/2, line_height, COMMAND_VOCAB[item][0], 1)
case item
when :windowskin
variable = WINDOWSKIN_VARIABLE
if $game_variables[variable] == 0
$game_variables[variable] = DEFAULT_SKIN_VALUE
end
text = WINDOW_HASH[$game_variables[variable]][1]
when :battle_bgm
variable = MUSIC_VARIABLE
if $game_variables[variable] == 0
$game_variables[variable] = DEFAULT_MUSIC_VAULE
end
text = BATTLE_HASH[$game_variables[variable]][1]
when :font_name
variable = FONT_VARIABLE
if $game_variables[variable] == 0
$game_variables[variable] = DEFAULT_FONT_VAULE
end
text = FONT_HASH[$game_variables[variable]]
end
contents.draw_text(dw/2, dy, dw/2, line_height, text, 1)
end
def draw_bar(item, dx, dy, dw)
self.contents.draw_text(dx, dy, dw/2, line_height, COMMAND_VOCAB[item][0], 1)
value = $game_system.bar_style? - 1
8.times do |i|
self.contents.font.color = normal_color
dx2 = dx + dw * (8 + i)/16
self.contents.font.color.alpha = (value == i) ? 255 : 128
self.contents.draw_text(dx2, dy, dw/20, 32, (i + 1).to_s, 1)
end
end
def draw_bar_opacity(item, dx, dy, dw)
self.contents.draw_text(dx, dy, dw/2, line_height, COMMAND_VOCAB[item][0], 1)
rate = $game_system.opacity * 100.0 / 255
colour1 = COMMAND_VOCAB[item][1]
colour2 = COMMAND_VOCAB[item][2]
value = sprintf("%d%%", rate)
rate *= 0.01
draw_gauge(dw/2, dy-14, 280, rate, colour1, colour2)
contents.draw_text(dw/2, dy, 280, line_height, value, 2)
end
def draw_toggle(item, dx, dy, dw)
self.contents.draw_text(dx, dy, dw/2, line_height, COMMAND_VOCAB[item][0], 1)
case item
when :auto_dash then enabled = $game_system.autodash?
when :full_screen then enabled = $game_system.full_screen?
end
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 128 : 255
option1 = COMMAND_VOCAB[item][1]
self.contents.draw_text(dw/2, dy, dw/4, line_height, option1, 1)
self.contents.font.color.alpha = enabled ? 255 : 128
option2 = COMMAND_VOCAB[item][2]
self.contents.draw_text(dw*3/4, dy, dw/4, line_height, option2, 1)
end
def draw_return(item, dx, dy, dw)
contents.draw_text(dx, dy, dw, line_height, COMMAND_VOCAB[item][0], 1)
end
def update_help
@help_window.set_text(item.nil? ? '' : COMMAND_VOCAB[item][3])
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Scene_End
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Scene_End < Scene_Base
def start
super
@fullscreen = $game_system.full_screen? # EDIT #
create_menu_layout
create_help_window
create_option_window
create_windows
create_wait_window
end
def create_help_window
@help_window = Window_Option_Help.new
@help_window.height = fitting_height(2)
end
def create_option_window
@options_window = Window_SystemOptions.new(@help_window)
end
def create_windows
@skins_window = Window_Skins.new(fitting_height(10))
@font_window = Window_Font.new(fitting_height(10))
@music_window = Window_BattleMusic.new(fitting_height(10))
end
def create_wait_window
@a = 0
@wait_window = Window_Base.new(220, 190, 200, 100)
@wait_window.contents = Bitmap.new(168, 68)
@wait_window.contents.draw_text(0, 16, 168, 32, 'Please wait.', 1)
@wait_window.visible, @wait_window.z = false, 999
end
def fitting_height line_number
(line_number * line_height) + (standard_padding * 2)
end
def line_height; return 32; end
def standard_padding; return 16; end
def perform_transition; super; END_FX == 2 ? map_back : end_back; end
def end_back
@back = Plane.new
if $ace_script[:ace_main_menu]
@back.bitmap = RPG::Cache.menu('Background/' + BACKGROUND2)
else
@back.bitmap = RPG::Cache.picture(BACKGROUND2)
end
@back.z = 10
Graphics.transition(END_TRAN_TIME, 'Graphics/Transitions/' + END_TRAN_TYPE)
end
def map_back
@spriteset = Spriteset_Map.new
Graphics.transition(transition_speed)
end
def terminate; super; END_FX == 2 ? @spriteset.dispose : @back.dispose; end
def update # EDIT #
update_moving_windows?
if @options_window.active
@wait_window.visible = false
if $game_system.full_screen? != @fullscreen
@options_window.draw_item(@options_window.full_screen_index)
@fullscreen = $game_system.full_screen?
end
update_system_window
elsif @skins_window.active; update_skins_window
elsif @font_window.active; update_font_window
elsif @music_window.active; update_music_window
else
@wait_window.visible = true
update_wait
end
end
def update_moving_windows?
@back.ox += 1 if END_FX == 0
@back.oy += 1 if END_FX == 0
end
def update_system_window
options_input_c if Input.trigger?(Input::C)
options_input_b if Input.trigger?(Input::B)
restore_default if Input.trigger?(Input::SHIFT && Input::CTRL)
cursor_left (Input.trigger?(Input::LEFT)) if Input.repeat?(Input::LEFT)
cursor_right(Input.trigger?(Input::RIGHT)) if Input.repeat?(Input::RIGHT)
end
def options_input_c
case @options_window.item
when :windowskin
$game_system.se_play($data_system.decision_se)
@options_window.active = false
@skins_window.active = @skins_window.visible = true
when :battle_bgm
$game_system.se_play($data_system.decision_se)
@options_window.active = false
@music_window.active = @music_window.visible = true
when :font_name
$game_system.se_play($data_system.decision_se)
@options_window.active = false
@font_window.active = @font_window.visible = true
when :return_title then command_to_title
when :shutdown then command_shutdown
when :default then restore_default
when :return_menu
$game_system.se_play($data_system.decision_se)
command_cancel
end
end
def options_input_b
$game_system.se_play($data_system.cancel_se)
command_cancel
end
def cursor_right(wrap = false); cursor_change(Input::RIGHT); end
def cursor_left(wrap = false); cursor_change(Input::LEFT); end
def cursor_change(direction)
case @options_window.item
when :volume_bgm, :volume_bgs, :volume_sfx then change_volume(direction)
when :bar_opacity then change_opacity(direction)
when :bar_style then change_bar_style(direction)
when :full_screen, :auto_dash then change_toggle(direction)
end
end
def change_volume(direction)
value = direction == Input::LEFT ? -1 : 1
value *= 10 if Input.press?(Input::SHIFT)
case @options_window.item
when :volume_bgm
$game_system.volume_change(:bgm, value)
$game_system.bgm_play($game_system.bgm_memorize)
when :volume_bgs
$game_system.volume_change(:bgs, value)
$game_system.bgs_play($game_system.bgs_memorize)
when :volume_sfx then $game_system.volume_change(:sfx, value)
end
$game_system.se_play($data_system.cursor_se)
@options_window.draw_item(@options_window.index)
end
def change_opacity(direction)
$game_system.se_play($data_system.cursor_se)
value = direction == Input::LEFT ? -1 : 1
value *= 25.5 if Input.press?(Input::SHIFT)
$game_system.opacity_change(value)
@options_window.refresh
@options_window.draw_item(@options_window.index)
end
def change_bar_style(direction)
$game_system.se_play($data_system.cursor_se)
value = direction == Input::LEFT ? -1 : 1
$game_system.set_bar_style(value)
@options_window.refresh
@options_window.draw_item(@options_window.index)
end
def change_toggle(direction)
value = direction == Input::LEFT ? false : true
case @options_window.item
when :full_screen
current_case = $game_system.full_screen?
$game_system.set_full_screen(value)
return if value == current_case
$game_system.call_screen_mode
@options_window.active = false
when :auto_dash
current_case = $game_system.autodash?
$game_system.set_autodash(value)
end
$game_system.se_play($data_system.cursor_se) if value != current_case
@options_window.draw_item(@options_window.index)
end
def update_skins_window
if @last_index != @skins_window.index
@last_index = @skins_window.index
update_skins
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skins_window.active = @skins_window.visible = false
@options_window.active = true
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@skins_window.active = @skins_window.visible = false
@options_window.active = true
end
end
def update_skins
$game_variables[WINDOWSKIN_VARIABLE] = @skins_window.index + 1
@options_window.update_windowskin
@options_window.refresh
@help_window.update_windowskin
@help_window.set_text("")
@options_window.update_help
@skins_window.update_windowskin
@skins_window.refresh
@skins_window.back_opacity = 255
@options_window.refresh
@options_window.draw_item(@options_window.index)
end
def update_font_window
if @last_index != @font_window.index
@last_index = @font_window.index
update_fonts
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@font_window.active = @font_window.visible = false
@options_window.active = true
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@font_window.active = @font_window.visible = false
@options_window.active = true
end
end
def update_fonts
$game_variables[FONT_VARIABLE] = @font_window.index + 1
@options_window.update_font
@options_window.refresh
@font_window.update_font
@font_window.refresh
@font_window.back_opacity = 255
@options_window.refresh
@options_window.draw_item(@options_window.index)
end
def update_music_window
if @last_index != @music_window.index
@last_index = @music_window.index
update_songs
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@music_window.active = @music_window.visible = false
@options_window.active = true
$game_system.bgm_play($game_system.bgm_memorize)
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@music_window.active = @music_window.visible = false
@options_window.active = true
$data_system.battle_bgm.name = BATTLE_HASH[@music_window.index]
end
end
def update_songs
$game_variables[MUSIC_VARIABLE] = @music_window.index + 1
@music_window.refresh
@music_window.back_opacity = 255
@options_window.draw_item(@options_window.index)
end
def restore_default
$game_system.call_screen_mode if $game_system.fullscreen
$game_system.fullscreen = false
$game_system.autodash = false
$game_system.bar_style = 6
$game_system.opacity_change(255)
$game_system.volume_change(:bgm, 100)
$game_system.bgm_play($game_system.bgm_memorize)
$game_system.volume_change(:bgs, 100)
$game_system.bgs_play($game_system.bgs_memorize)
$game_system.volume_change(:sfx, 100)
@options_window.change_font_settings(FONT_HASH[DEFAULT_FONT_VAULE])
$game_variables[FONT_VARIABLE] = DEFAULT_FONT_VAULE
@options_window.change_window_settings(WINDOW_HASH[DEFAULT_SKIN_VALUE])
$game_variables[WINDOWSKIN_VARIABLE] = DEFAULT_SKIN_VALUE
$data_system.battle_bgm.name = BATTLE_HASH[DEFAULT_MUSIC_VAULE]
$game_variables[MUSIC_VARIABLE] = DEFAULT_MUSIC_VAULE
@options_window.refresh
end
def update_wait
@a += 1
if @a == 100
@a = 0
@options_window.active = true
end
end
def command_to_title
fadeout_all
$scene = Scene_Title.new
end
def command_shutdown
fadeout_all
$scene = nil
end
def fadeout_all
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
end
def command_cancel
$scene = Scene_Menu.new(MENU_INDEX)
end
end