#==============================================================================
# ** Blackmorning -> Icon Ring Command (modded from Syvkal)
#------------------------------------------------------------------------------
# Blackmorning
# Version 3.00
# updated 03/19/2014
# - more efficient coding
# VTS update 12/24/2024
# + added Command Window Y-Pos Option
#==============================================================================
# - INTRODUCTION -
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# - ring command made of icons assigned in BM - Icon
# - movement based off XRXS, Dubealex & Hypershadow180's original XP Ring Menu,
# - ring for menu commands, actor & party commands are setup
#==============================================================================
# ¨‹ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below BM - Base and other menu engines but above BM - Icon.
# Remember to save.
# can be used with YEA - menu engine
#==============================================================================
module BM
module RING
# VTS - Adjust Y-Position of Command Window
COMMAND_WINDOW_Y_POS = 72
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Ring Options
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
OPTIONS ={
:startup_frames => 20, # Amount of frames for the Startup Animation, default = 20
:moving_frames => 15, # Amount of frames for Movement Animation, default = 15
:menu_radius => 58, # Radius of Menu Command Ring, default = 60
:battle_radius => 34, # Radius of Actor & Party Command Rings (Battle Scene)
:title_radius => 34,
} # DO NOT REMOVE
ICON ={
:disable => 972, # The icon displayed over disabled options
} # DO NOT REMOVE
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Ring Menus Used
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
USE_RING_COMMAND ={ # which screens use the ring style commands
:menu => true,
:title => false,
:battle_actor => false,
:battle_party => false,
} # DO NOT REMOVE
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.
# Therefore, edit at your own risk.
#===============================================================================
module BM
def self.required(name, req, version, type = nil)
if !$imported[:bm_base]
msg = "The script '%s' requires the script\n"
msg += "'BM - Base' v%s or higher above it to work properly\n"
msg += "Go to bmscripts.weebly.com to download this script."
msgbox(sprintf(msg, self.script_name(name), version))
exit
else
self.required_script(name, req, version, type)
end
end
#--------------------------------------------------------------------------
# * script_name
# Get the script name base on the imported value
#--------------------------------------------------------------------------
def self.script_name(name, ext = "BM")
name = name.to_s.gsub("_", " ").upcase.split
name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
name.join(" ")
end
end
$imported ||= {}
$imported[:bm_ring] = 2.00
BM.required(:bm_ring, :bm_base, 1.00, :above)
BM.required(:bm_ring, :bm_icon, 1.00, :below)
#=============================================================================#
# ** Icon
#=============================================================================#
module Icon
def self.disable; BM::RING::ICON[:disable]; end
end
#==============================================================================
# ** Ring_Command
#==============================================================================
module Ring_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(*args, &block)
@spin_count = 0 # 0 is left, 1 is right
@startup = BM::RING::OPTIONS[:startup_frames]
@mode = :start
@spin_count = @startup
super(*args, &block)
end
#--------------------------------------------------------------------------
# * cx and cy
#--------------------------------------------------------------------------
def cx; contents.width/2; end
def cy; contents.height/2; end
#--------------------------------------------------------------------------
# * Default Radius
#--------------------------------------------------------------------------
def radius; 60; end
#--------------------------------------------------------------------------
# * item rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = 28
rect.height = 28
rect.x = (contents.width - rect.width) / 2
rect.y = cy - radius - rect.width/2
rect
end
#--------------------------------------------------------------------------
# * Determines if is moving
#--------------------------------------------------------------------------
def animation?; return @mode != :wait; end
#--------------------------------------------------------------------------
# * Move Cursor Down
#--------------------------------------------------------------------------
def cursor_down(wrap)
unless animation?
select((index + 1) % item_max)
@mode = :right
@spin_count = BM::RING::OPTIONS[:moving_frames]
Sound.play_cursor
end
end
#--------------------------------------------------------------------------
# * Move Cursor Up
#--------------------------------------------------------------------------
def cursor_up(wrap)
unless animation?
select((index - 1 + item_max) % item_max)
@mode = :left
@spin_count = BM::RING::OPTIONS[:moving_frames]
Sound.play_cursor
end
end
#--------------------------------------------------------------------------
# * Overwrite: Move Cursor Right
#--------------------------------------------------------------------------
def cursor_right(wrap); cursor_down(wrap); end
#--------------------------------------------------------------------------
# * Overwrite: Move Cursor Left
#--------------------------------------------------------------------------
def cursor_left(wrap); cursor_up(wrap); end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
refresh if animation?
end
#--------------------------------------------------------------------------
def index=(index)
super
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
refresh_ring
draw_current_index
end
#--------------------------------------------------------------------------
# * Get Command Name
#--------------------------------------------------------------------------
def command_name(index)
return "" if @list[index] == nil
super#@list[index][:name]
end
#--------------------------------------------------------------------------
# * Refresh ring
#--------------------------------------------------------------------------
def refresh_ring
angle_size = 2.0 * Math::PI / item_max
r1 = radius - 1.0 * radius * @spin_count / @startup
r = (@mode == :start) ? r1 : radius
angle = 0
angle = angle_size / BM::RING::OPTIONS[:moving_frames] if animation?
angle = 1.0 * Math::PI / @startup if @mode == :start
angle *= @spin_count
angle = (@mode == :right) ? angle : -angle
for i in 0...item_max
j = (@mode == :start) ? i : i - index
d = angle_size * j + angle
x = cx + ( r * Math.sin( d ) ).to_i
y = cy - ( r * Math.cos( d ) ).to_i
draw_ring_item(x, y, i)
end
return unless animation?
@spin_count -= 1
@mode = :wait if @spin_count < 0
end
#--------------------------------------------------------------------------
# * New method: draw current index
#--------------------------------------------------------------------------
def draw_current_index
rect = Rect.new(0, (contents.height - item_height) / 2, contents.width, line_height)
draw_text(rect, command_name(index), 1)
end
#--------------------------------------------------------------------------
# * Overwrite: Draw Item
#--------------------------------------------------------------------------
def draw_ring_item(x, y, i)
rect = Rect.new(0, 0, 24, 24)
name = command_name(i)
icon = command_icon(name)
enable = (i == index) ? command_enabled?(index) : false
draw_icon(Icon.border, x - rect.width/2, y - rect.height/2, enable)
draw_icon(icon, x - rect.width/2, y - rect.height/2, enable)
draw_icon(Icon.disable, x - rect.width/2, y - rect.height/2, i == index) unless command_enabled?(i)
end
end
if BM::RING::USE_RING_COMMAND[:menu]
#==============================================================================
# ** Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# * Includes The Ring_Command Module
#--------------------------------------------------------------------------
include Ring_Command
#--------------------------------------------------------------------------
# * Alias: Object Initialization
#--------------------------------------------------------------------------
alias :bm_ring_init :initialize
def initialize
bm_ring_init
self.y = BM::RING::COMMAND_WINDOW_Y_POS
if @@last_command_symbol != nil
index = @list.index(@@last_command_symbol)
@mode = :wait
end
refresh
end
#--------------------------------------------------------------------------
# * Radius
#--------------------------------------------------------------------------
def radius; BM::RING::OPTIONS[:menu_radius]; end
end
end
if BM::RING::USE_RING_COMMAND[:battle_actor]
#==============================================================================
# ** Window_ActorCommand
#==============================================================================
class Window_ActorCommand < Window_Command
#--------------------------------------------------------------------------
# * Includes The Ring_Command Module
#--------------------------------------------------------------------------
include Ring_Command
#--------------------------------------------------------------------------
# * New method: Refresh
#--------------------------------------------------------------------------
def draw_current_index
return unless @actor
super
end
#--------------------------------------------------------------------------
# * Get Item Height
#--------------------------------------------------------------------------
def item_height
(height - standard_padding * 2)/[4,item_max].max
end
#--------------------------------------------------------------------------
# * Overwrite: Move Cursor Right
#--------------------------------------------------------------------------
def cursor_right(wrap); end
#--------------------------------------------------------------------------
# * Overwrite: Move Cursor Left
#--------------------------------------------------------------------------
def cursor_left(wrap); end
#--------------------------------------------------------------------------
# * Overwrite: Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number; item_max; end
#--------------------------------------------------------------------------
# * Overwrite: Get Window Height
#--------------------------------------------------------------------------
def window_height; fitting_height(4); end
#--------------------------------------------------------------------------
# * Radius
#--------------------------------------------------------------------------
def radius; BM::RING::OPTIONS[:battle_radius]; end
end
end
if BM::RING::USE_RING_COMMAND[:battle_party]
#==============================================================================
# ** Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# * Includes The Ring_Command Module
#--------------------------------------------------------------------------
include Ring_Command
#--------------------------------------------------------------------------
# * Overwrite: Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number; item_max; end
#--------------------------------------------------------------------------
# * Overwrite: Get Window Height
#--------------------------------------------------------------------------
def window_height; fitting_height(4); end
#--------------------------------------------------------------------------
# * Radius
#--------------------------------------------------------------------------
def radius; BM::RING::OPTIONS[:battle_radius]; end
end
end
if BM::RING::USE_RING_COMMAND[:title]
#==============================================================================
# ** Window_TitleCommand
#==============================================================================
class Window_TitleCommand < Window_Command
#--------------------------------------------------------------------------
# * Includes The Ring_Command Module
#--------------------------------------------------------------------------
include Ring_Command
#--------------------------------------------------------------------------
# * Overwrite: Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number; item_max; end
#--------------------------------------------------------------------------
# * Overwrite: Get Window Height
#--------------------------------------------------------------------------
def window_height; fitting_height(4); end
#--------------------------------------------------------------------------
# * Radius
#--------------------------------------------------------------------------
def radius; BM::RING::OPTIONS[:title_radius]; end
end
end
#===============================================================================
#
# END OF FILE
#
#===============================================================================